From 1588b75a54bf43e135de2468b266b0edec0fde28 Mon Sep 17 00:00:00 2001 From: Magento Mirror Date: Sat, 17 Jan 2009 18:17:23 -0500 Subject: [PATCH] Import Magento Release 1.2.0 --- STATUS.txt | 232 +- app/Mage.php | 53 +- app/code/core/Mage/Admin/Model/Roles.php | 24 +- app/code/core/Mage/Admin/Model/Session.php | 327 +- app/code/core/Mage/Admin/Model/User.php | 563 +-- app/code/core/Mage/Admin/etc/admin.xml | 211 - .../Mage/AdminNotification/etc/config.xml | 14 +- .../Adminhtml/Block/Api/Tab/Rolesedit.php | 6 +- .../Adminhtml/Block/Catalog/Category/Tree.php | 21 +- .../Product/Attribute/Edit/Tab/Main.php | 105 +- .../Attribute/New/Product/Attributes.php | 13 +- .../Edit/Action/Attribute/Tab/Attributes.php | 5 +- .../Catalog/Product/Edit/Tab/Attributes.php | 14 +- .../Product/Edit/Tab/Options/Option.php | 2 +- .../Block/Catalog/Search/Edit/Form.php | 108 +- .../Adminhtml/Block/Catalog/Search/Grid.php | 62 +- .../Block/Customer/Edit/Tab/Orders.php | 14 +- .../Adminhtml/Block/Customer/Online/Grid.php | 29 +- .../Mage/Adminhtml/Block/Dashboard/Bar.php | 46 +- .../Mage/Adminhtml/Block/Dashboard/Graph.php | 12 +- .../Mage/Adminhtml/Block/Dashboard/Sales.php | 2 +- .../Block/Dashboard/Tab/Customers/Most.php | 4 +- .../Mage/Adminhtml/Block/Dashboard/Totals.php | 2 +- .../core/Mage/Adminhtml/Block/Html/Select.php | 95 +- .../Mage/Adminhtml/Block/Media/Uploader.php | 43 +- .../Adminhtml/Block/Notification/Window.php | 24 +- app/code/core/Mage/Adminhtml/Block/Page.php | 129 +- .../core/Mage/Adminhtml/Block/Page/Head.php | 10 + .../Block/Permissions/Tab/Rolesedit.php | 2 +- .../Block/Promo/Widget/Chooser/Sku.php | 2 +- .../Block/Report/Customer/Orders/Grid.php | 2 +- .../Block/Report/Customer/Totals/Grid.php | 2 +- .../core/Mage/Adminhtml/Block/Report/Grid.php | 26 + .../Grid/Column/Renderer/Blanknumber.php | 49 + .../Block/Report/Product/Downloads.php | 68 + .../Block/Report/Product/Downloads/Grid.php | 108 + .../Block/Report/Product/Ordered/Grid.php | 2 +- .../Block/Report/Product/Viewed/Grid.php | 2 +- .../Block/Report/Sales/Coupons/Grid.php | 2 +- .../Block/Report/Sales/Invoiced/Grid.php | 15 +- .../Block/Report/Sales/Refunded/Grid.php | 2 +- .../Block/Report/Sales/Sales/Grid.php | 2 +- .../Block/Report/Sales/Shipping/Grid.php | 2 +- .../Adminhtml/Block/Report/Sales/Tax/Grid.php | 11 +- .../Adminhtml/Block/Report/Search/Grid.php | 10 + .../Block/Report/Shopcart/Abandoned/Grid.php | 2 +- .../Block/Report/Shopcart/Customer/Grid.php | 2 +- .../Block/Report/Shopcart/Product/Grid.php | 2 +- .../core/Mage/Adminhtml/Block/Review/Add.php | 17 +- .../Adminhtml/Block/Review/Product/Grid.php | 14 +- .../Adminhtml/Block/Sales/Items/Abstract.php | 5 +- .../Block/Sales/Order/Comments/View.php | 2 +- .../Adminhtml/Block/Sales/Order/Create.php | 2 +- .../Sales/Order/Create/Billing/Address.php | 2 +- .../Block/Sales/Order/Create/Items/Grid.php | 8 +- .../Sales/Order/Create/Shipping/Address.php | 2 +- .../Mage/Adminhtml/Block/Sales/Order/Grid.php | 3 +- .../Block/Sales/Order/View/Giftmessage.php | 2 +- .../Order/View/Items/Renderer/Default.php | 2 +- .../Sales/Order/View/Tab/Creditmemos.php | 5 +- .../Block/Sales/Order/View/Tab/Invoices.php | 5 +- .../Adminhtml/Block/System/Cache/Edit.php | 283 +- .../Adminhtml/Block/System/Cache/Form.php | 57 +- .../Block/System/Convert/Profile/Run.php | 17 +- .../Adminhtml/Block/System/Store/Delete.php | 100 + .../Block/System/Store/Delete/Form.php | 80 + .../Block/System/Store/Delete/Store.php | 70 - .../Adminhtml/Block/System/Store/Edit.php | 200 +- .../Block/System/Store/Edit/Form.php | 661 ++- .../Mage/Adminhtml/Block/Tax/Rate/Grid.php | 1 + .../core/Mage/Adminhtml/Block/Template.php | 10 +- .../core/Mage/Adminhtml/Block/Urlrewrite.php | 27 +- .../Mage/Adminhtml/Block/Urlrewrite/Add.php | 206 - .../Adminhtml/Block/Urlrewrite/Add/Form.php | 156 - .../Block/Urlrewrite/Category/Tree.php | 135 +- .../Mage/Adminhtml/Block/Urlrewrite/Edit.php | 257 +- .../Adminhtml/Block/Urlrewrite/Edit/Form.php | 229 +- .../Mage/Adminhtml/Block/Urlrewrite/Link.php | 48 + .../Block/Urlrewrite/Product/Grid.php | 54 +- .../Adminhtml/Block/Urlrewrite/Selector.php | 88 + app/code/core/Mage/Adminhtml/Block/Widget.php | 155 +- .../Mage/Adminhtml/Block/Widget/Container.php | 100 +- .../core/Mage/Adminhtml/Block/Widget/Form.php | 370 +- .../Adminhtml/Block/Widget/Form/Container.php | 309 +- .../core/Mage/Adminhtml/Block/Widget/Grid.php | 41 +- .../Widget/Grid/Column/Renderer/Country.php | 2 +- .../Block/Widget/Grid/Massaction/Abstract.php | 4 +- .../Adminhtml/Block/Widget/Tab/Interface.php | 82 +- .../core/Mage/Adminhtml/Controller/Action.php | 674 +-- .../core/Mage/Adminhtml/Model/Extension.php | 6 +- .../Mage/Adminhtml/Model/Giftmessage/Save.php | 33 + .../core/Mage/Adminhtml/Model/Observer.php | 2 +- .../Adminhtml/Model/Sales/Order/Create.php | 9 + .../Config/Backend/Catalog/Search/Type.php | 56 + .../System/Config/Backend/Seo/Product.php | 9 +- .../Config/Source/Catalog/Search/Type.php | 53 + .../Catalog/CategoryController.php | 56 +- .../Product/Action/AttributeController.php | 7 +- .../Catalog/Product/SetController.php | 6 +- .../controllers/Catalog/ProductController.php | 5 +- .../controllers/CustomerController.php | 1146 +++-- .../controllers/DashboardController.php | 25 +- .../Adminhtml/controllers/IndexController.php | 2 +- .../Newsletter/SubscriberController.php | 266 +- .../controllers/Report/ProductController.php | 34 + .../Sales/Order/ShipmentController.php | 4 +- .../controllers/System/BackupController.php | 300 +- .../controllers/System/CacheController.php | 95 +- .../controllers/System/StoreController.php | 301 +- .../controllers/UrlrewriteController.php | 249 +- app/code/core/Mage/Adminhtml/etc/config.xml | 144 +- app/code/core/Mage/Api/Model/Config.php | 12 +- app/code/core/Mage/Api/Model/Roles.php | 12 +- app/code/core/Mage/Api/etc/config.xml | 36 +- app/code/core/Mage/Backup/etc/config.xml | 23 +- .../Catalog/Product/Edit/Tab/Bundle.php | 3 +- .../Catalog/Product/View/Type/Bundle.php | 268 +- .../Block/Checkout/Cart/Item/Renderer.php | 2 +- .../core/Mage/Bundle/Model/Mysql4/Bundle.php | 27 +- .../Mage/Bundle/Model/Mysql4/Selection.php | 4 +- .../core/Mage/Bundle/Model/Product/Price.php | 1125 ++--- .../core/Mage/Bundle/Model/Product/Type.php | 76 +- .../controllers/Product/EditController.php | 52 + app/code/core/Mage/Bundle/etc/config.xml | 1 + .../mysql4-upgrade-0.1.3-0.1.4.php | 4 +- .../core/Mage/Catalog/Block/Breadcrumbs.php | 26 +- .../core/Mage/Catalog/Block/Category/View.php | 2 +- .../Catalog/Block/Layer/Filter/Abstract.php | 3 +- .../core/Mage/Catalog/Block/Layer/State.php | 10 +- .../core/Mage/Catalog/Block/Layer/View.php | 53 +- .../Mage/Catalog/Block/Product/Abstract.php | 48 + .../Catalog/Block/Product/List/Toolbar.php | 260 +- .../core/Mage/Catalog/Block/Product/Price.php | 36 + .../core/Mage/Catalog/Block/Product/View.php | 36 +- .../Catalog/Block/Product/View/Attributes.php | 21 +- .../Catalog/Block/Seo/Sitemap/Product.php | 17 +- app/code/core/Mage/Catalog/Helper/Data.php | 18 + .../Catalog/Model/Convert/Parser/Product.php | 3 + app/code/core/Mage/Catalog/Model/Layer.php | 113 +- .../Catalog/Model/Layer/Filter/Abstract.php | 94 +- .../Catalog/Model/Layer/Filter/Attribute.php | 98 +- .../Catalog/Model/Layer/Filter/Category.php | 97 +- .../Mage/Catalog/Model/Layer/Filter/Item.php | 40 +- .../Mage/Catalog/Model/Layer/Filter/Price.php | 105 +- .../core/Mage/Catalog/Model/Layer/State.php | 34 +- app/code/core/Mage/Catalog/Model/Observer.php | 53 +- app/code/core/Mage/Catalog/Model/Product.php | 2686 +++++------ .../Model/Product/Attribute/Backend/Media.php | 24 +- .../Product/Attribute/Backend/Tierprice.php | 4 +- .../Mage/Catalog/Model/Product/Status.php | 14 + .../Catalog/Model/Product/Type/Abstract.php | 210 +- .../Model/Product/Type/Configurable.php | 40 +- .../Catalog/Model/Product/Type/Grouped.php | 26 +- .../Mage/Catalog/Model/Product/Type/Price.php | 1 + .../core/Mage/Catalog/Model/Product/Url.php | 19 +- .../Mage/Catalog/Model/Product/Website.php | 7 + .../Model/Resource/Eav/Mysql4/Category.php | 440 +- .../Eav/Mysql4/Category/Collection.php | 6 +- .../Eav/Mysql4/Collection/Abstract.php | 1 + .../Model/Resource/Eav/Mysql4/Product.php | 163 +- .../Product/Attribute/Backend/Tierprice.php | 15 +- .../Eav/Mysql4/Product/Collection.php | 196 +- .../Product/Link/Product/Collection.php | 17 +- .../Model/Resource/Eav/Mysql4/Setup.php | 10 +- .../Catalog/Model/Resource/Eav/Mysql4/Url.php | 33 +- app/code/core/Mage/Catalog/Model/Url.php | 132 +- app/code/core/Mage/Catalog/etc/api.xml | 154 +- app/code/core/Mage/Catalog/etc/config.xml | 73 +- .../mysql4-upgrade-0.7.37-0.7.38.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 6 +- .../mysql4-upgrade-0.7.47-0.7.48.php | 6 +- .../mysql4-upgrade-0.7.51-0.7.52.php | 2 +- .../mysql4-upgrade-0.7.53-0.7.54.php | 62 + .../mysql4-upgrade-0.7.54-0.7.55.php | 38 + .../mysql4-upgrade-0.7.55-0.7.56.php | 127 + .../mysql4-upgrade-0.7.56-0.7.57.php | 66 + .../Mage/CatalogIndex/Model/Aggregation.php | 166 + .../core/Mage/CatalogIndex/Model/Indexer.php | 343 +- .../CatalogIndex/Model/Mysql4/Abstract.php | 10 + .../CatalogIndex/Model/Mysql4/Aggregation.php | 214 + .../CatalogIndex/Model/Mysql4/Attribute.php | 2 +- .../Model/Mysql4/Data/Abstract.php | 5 +- .../Model/Mysql4/Data/Grouped.php | 7 +- .../CatalogIndex/Model/Mysql4/Indexer.php | 69 +- .../Mage/CatalogIndex/Model/Mysql4/Price.php | 106 +- .../Mage/CatalogIndex/Model/Mysql4/Setup.php | 57 + .../core/Mage/CatalogIndex/Model/Observer.php | 240 +- .../core/Mage/CatalogIndex/etc/config.xml | 102 +- .../mysql4-upgrade-0.7.7-0.7.8.php | 39 + .../mysql4-upgrade-0.7.8-0.7.9.php | 42 + .../mysql4-upgrade-0.7.9-0.7.10.php | 68 + .../Mage/CatalogInventory/Model/Observer.php | 34 +- .../CatalogInventory/Model/Stock/Item.php | 51 +- .../core/Mage/CatalogInventory/etc/api.xml | 21 +- .../core/Mage/CatalogInventory/etc/config.xml | 4 +- .../Mage/CatalogRule/Model/Mysql4/Rule.php | 17 +- .../Model/Rule/Condition/Product.php | 34 +- app/code/core/Mage/CatalogRule/etc/config.xml | 7 +- .../core/Mage/CatalogSearch/Block/Layer.php | 55 + .../core/Mage/CatalogSearch/Block/Result.php | 103 +- .../core/Mage/CatalogSearch/Helper/Data.php | 164 +- .../Mage/CatalogSearch/Model/Advanced.php | 41 +- .../Mage/CatalogSearch/Model/Fulltext.php | 124 + .../CatalogSearch/Model/Fulltext/Observer.php | 136 + .../core/Mage/CatalogSearch/Model/Layer.php | 123 + .../CatalogSearch/Model/Mysql4/Fulltext.php | 555 +++ .../Model/Mysql4/Fulltext/Collection.php | 80 + .../Mage/CatalogSearch/Model/Mysql4/Query.php | 36 +- .../Model/Mysql4/Query/Collection.php | 91 +- .../Model/Mysql4/Search/Collection.php | 3 - .../core/Mage/CatalogSearch/Model/Query.php | 97 +- .../controllers/ResultController.php | 49 +- .../core/Mage/CatalogSearch/etc/config.xml | 88 +- .../core/Mage/CatalogSearch/etc/system.xml | 54 + .../mysql4-upgrade-0.7.4-0.7.5.php | 31 + .../mysql4-upgrade-0.7.5-0.7.6.php | 75 + app/code/core/Mage/Checkout/Block/Cart.php | 8 + .../Mage/Checkout/Block/Cart/Crosssell.php | 75 +- .../Block/Cart/Item/Renderer/Configurable.php | 2 +- app/code/core/Mage/Checkout/Block/Links.php | 18 +- .../Mage/Checkout/Block/Onepage/Success.php | 1 + app/code/core/Mage/Checkout/Helper/Data.php | 45 + app/code/core/Mage/Checkout/Helper/Url.php | 18 +- app/code/core/Mage/Checkout/Model/Cart.php | 13 +- app/code/core/Mage/Checkout/Model/Session.php | 13 +- .../Mage/Checkout/Model/Type/Abstract.php | 17 +- .../core/Mage/Checkout/Model/Type/Onepage.php | 5 +- .../Checkout/controllers/CartController.php | 9 + .../controllers/OnepageController.php | 4 +- app/code/core/Mage/Checkout/etc/config.xml | 24 +- app/code/core/Mage/Cms/Controller/Router.php | 2 +- app/code/core/Mage/Cms/etc/config.xml | 8 +- .../Contacts/controllers/IndexController.php | 17 + app/code/core/Mage/Contacts/etc/config.xml | 2 +- app/code/core/Mage/Core/Block/Abstract.php | 7 +- .../Mage/Core/Controller/Front/Action.php | 2 - .../Mage/Core/Controller/Request/Http.php | 4 +- .../Mage/Core/Controller/Varien/Action.php | 21 +- .../Core/Controller/Varien/Router/Admin.php | 2 +- .../Controller/Varien/Router/Standard.php | 2 +- app/code/core/Mage/Core/Helper/Abstract.php | 24 +- app/code/core/Mage/Core/Helper/Data.php | 24 +- app/code/core/Mage/Core/Helper/String.php | 27 + app/code/core/Mage/Core/Model/App.php | 78 +- app/code/core/Mage/Core/Model/Config.php | 149 +- app/code/core/Mage/Core/Model/Config/Data.php | 27 +- .../Mage/Core/Model/Design/Source/Design.php | 2 +- .../core/Mage/Core/Model/Email/Template.php | 30 +- app/code/core/Mage/Core/Model/Locale.php | 74 +- .../core/Mage/Core/Model/Locale/Currency.php | 140 +- .../core/Mage/Core/Model/Mysql4/Config.php | 9 +- .../core/Mage/Core/Model/Mysql4/Translate.php | 4 +- app/code/core/Mage/Core/Model/Resource.php | 4 +- .../Mage/Core/Model/Resource/Abstract.php | 5 + .../core/Mage/Core/Model/Resource/Setup.php | 21 +- app/code/core/Mage/Core/Model/Session.php | 15 +- .../core/Mage/Core/Model/Session/Abstract.php | 55 +- .../Core/Model/Session/Abstract/Varien.php | 76 +- app/code/core/Mage/Core/Model/Store.php | 10 +- app/code/core/Mage/Core/Model/Translate.php | 36 +- .../core/Mage/Core/Model/Translate/Inline.php | 51 +- app/code/core/Mage/Core/Model/Url.php | 38 +- app/code/core/Mage/Core/Model/Url/Rewrite.php | 16 +- app/code/core/Mage/Core/Model/Website.php | 29 + .../mysql4-upgrade-0.8.10-0.8.11.php | 10 + .../mysql4-upgrade-0.8.11-0.8.12.php | 5 +- .../core_setup/mysql4-upgrade-0.8.8-0.8.9.php | 6 +- app/code/core/Mage/Cron/etc/system.xml | 4 +- .../core/Mage/Customer/Block/Widget/Dob.php | 10 + .../Model/Entity/Customer/Collection.php | 40 + app/code/core/Mage/Customer/Model/Session.php | 8 +- .../controllers/AccountController.php | 7 +- .../controllers/AddressController.php | 7 +- app/code/core/Mage/Customer/etc/api.xml | 46 +- app/code/core/Mage/Customer/etc/config.xml | 22 +- .../mysql4-upgrade-0.8.8-0.8.9.php | 44 + .../Dataflow/Model/Convert/Adapter/Io.php | 50 +- app/code/core/Mage/Dataflow/Model/Profile.php | 3 + .../core/Mage/Directory/Block/Currency.php | 2 +- .../core/Mage/Directory/Model/Country.php | 2 +- .../Mage/Directory/Model/Currency/Filter.php | 2 +- .../Model/Mysql4/Country/Collection.php | 2 +- app/code/core/Mage/Directory/etc/api.xml | 21 +- app/code/core/Mage/Directory/etc/config.xml | 4 +- .../mysql4-upgrade-0.8.2-0.8.3.php | 38 + .../Catalog/Product/Edit/Tab/Downloadable.php | 144 + .../Product/Edit/Tab/Downloadable/Links.php | 268 ++ .../Product/Edit/Tab/Downloadable/Samples.php | 168 + .../Sales/Items/Column/Downloadable/Name.php | 56 + .../Block/Catalog/Product/Links.php | 155 + .../Block/Catalog/Product/Samples.php | 84 + .../Block/Catalog/Product/View/Type.php | 37 + .../Block/Checkout/Cart/Item/Renderer.php | 69 + .../Downloadable/Block/Checkout/Success.php | 59 + .../Block/Customer/Products/List.php | 133 + .../Sales/Order/Email/Items/Downloadable.php | 67 + .../Order/Email/Items/Order/Downloadable.php | 67 + .../Order/Item/Renderer/Downloadable.php | 62 + .../core/Mage/Downloadable/Helper/Data.php | 55 + .../Mage/Downloadable/Helper/Download.php | 297 ++ .../core/Mage/Downloadable/Helper/File.php | 126 + .../Model/CatalogIndex/Data/Downloadable.php | 47 + .../core/Mage/Downloadable/Model/Link.php | 96 + .../Downloadable/Model/Link/Purchased.php | 46 + .../Model/Link/Purchased/Item.php | 52 + .../Mage/Downloadable/Model/Mysql4/Link.php | 133 + .../Model/Mysql4/Link/Collection.php | 106 + .../Model/Mysql4/Link/Purchased.php | 46 + .../Mysql4/Link/Purchased/Collection.php | 53 + .../Model/Mysql4/Link/Purchased/Item.php | 46 + .../Mysql4/Link/Purchased/Item/Collection.php | 46 + .../Mage/Downloadable/Model/Mysql4/Sample.php | 104 + .../Model/Mysql4/Sample/Collection.php | 88 + .../core/Mage/Downloadable/Model/Observer.php | 200 + .../Mage/Downloadable/Model/Product/Price.php | 72 + .../Mage/Downloadable/Model/Product/Type.php | 327 ++ .../Model/Sales/Order/Pdf/Items/Abstract.php | 69 + .../Sales/Order/Pdf/Items/Creditmemo.php | 137 + .../Model/Sales/Order/Pdf/Items/Invoice.php | 120 + .../core/Mage/Downloadable/Model/Sample.php | 93 + .../Config/Source/Contentdisposition.php | 50 + .../controllers/CustomerController.php | 62 + .../controllers/DownloadController.php | 210 + .../controllers/FileController.php | 74 + .../controllers/Product/EditController.php | 61 + .../core/Mage/Downloadable/etc/config.xml | 904 ++++ .../core/Mage/Downloadable/etc/system.xml | 115 + .../mysql4-install-0.1.0.php | 53 + .../mysql4-upgrade-0.1.0-0.1.1.php | 54 + .../mysql4-upgrade-0.1.1-0.1.2.php | 126 + .../mysql4-upgrade-0.1.10-0.1.11.php | 90 + .../mysql4-upgrade-0.1.11-0.1.12.php | 34 + .../mysql4-upgrade-0.1.2-0.1.3.php | 54 + .../mysql4-upgrade-0.1.3-0.1.4.php | 34 + .../mysql4-upgrade-0.1.4-0.1.5.php | 34 + .../mysql4-upgrade-0.1.5-0.1.6.php | 59 + .../mysql4-upgrade-0.1.6-0.1.7.php | 167 + .../mysql4-upgrade-0.1.7-0.1.8.php | 34 + .../mysql4-upgrade-0.1.8-0.1.9.php | 34 + .../mysql4-upgrade-0.1.9-0.1.10.php | 76 + .../core/Mage/Eav/Model/Entity/Attribute.php | 43 +- .../Eav/Model/Entity/Attribute/Abstract.php | 12 + .../Mage/Eav/Model/Entity/Attribute/Set.php | 8 +- .../Model/Entity/Attribute/Source/Table.php | 27 +- .../Eav/Model/Entity/Collection/Abstract.php | 3 + app/code/core/Mage/Eav/Model/Entity/Setup.php | 55 +- .../Eav/Model/Mysql4/Entity/Attribute.php | 739 +-- .../Mysql4/Entity/Attribute/Collection.php | 11 + .../Eav/Model/Mysql4/Entity/Attribute/Set.php | 17 + app/code/core/Mage/Eav/etc/config.xml | 2 +- .../mysql4-upgrade-0.7.10-0.7.11.php | 49 + .../core/Mage/GiftMessage/Model/Observer.php | 25 +- app/code/core/Mage/GiftMessage/etc/config.xml | 9 + .../core/Mage/GoogleAnalytics/Block/Ga.php | 18 +- .../core/Mage/GoogleAnalytics/etc/config.xml | 2 +- .../GoogleBase/Block/Adminhtml/Captcha.php | 57 + .../Mage/GoogleBase/Block/Adminhtml/Items.php | 9 + .../GoogleBase/Block/Adminhtml/Items/Item.php | 1 + app/code/core/Mage/GoogleBase/Model/Item.php | 2 +- .../core/Mage/GoogleBase/Model/Service.php | 10 +- .../controllers/ItemsController.php | 71 +- .../controllers/SelectionController.php | 1 + app/code/core/Mage/GoogleBase/etc/config.xml | 6 +- .../googlebase_setup/mysql4-install-0.1.0.php | 2 +- .../core/Mage/GoogleCheckout/Block/Form.php | 13 +- .../core/Mage/GoogleCheckout/Block/Link.php | 13 + .../GoogleCheckout/Model/Api/Xml/Callback.php | 36 +- .../core/Mage/GoogleCheckout/etc/config.xml | 13 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 60 + .../core/Mage/GoogleOptimizer/Helper/Data.php | 4 +- .../Mage/GoogleOptimizer/Model/Observer.php | 26 +- .../core/Mage/GoogleOptimizer/etc/config.xml | 78 +- app/code/core/Mage/Install/Block/Locale.php | 3 +- .../core/Mage/Install/Model/Installer.php | 2 +- .../Mage/Install/Model/Installer/Console.php | 8 +- .../Install/controllers/WizardController.php | 4 + .../Log/Model/Mysql4/Visitor/Collection.php | 1 + .../Model/Mysql4/Subscriber/Collection.php | 16 +- .../core/Mage/Newsletter/Model/Subscriber.php | 12 +- .../controllers/ManageController.php | 5 +- .../controllers/SubscriberController.php | 65 +- app/code/core/Mage/Newsletter/etc/config.xml | 12 +- app/code/core/Mage/Page/Block/Html.php | 10 +- app/code/core/Mage/Page/Block/Html/Head.php | 13 + app/code/core/Mage/Page/Block/Html/Header.php | 4 +- app/code/core/Mage/Page/etc/system.xml | 11 +- app/code/core/Mage/Paygate/etc/system.xml | 16 +- app/code/core/Mage/Payment/Model/Config.php | 2 +- app/code/core/Mage/Payment/etc/config.xml | 2 +- app/code/core/Mage/Payment/etc/system.xml | 34 +- app/code/core/Mage/Paypal/Model/Express.php | 47 + .../core/Mage/Paypal/Model/Express/Review.php | 19 +- app/code/core/Mage/Paypal/Model/Standard.php | 2 +- .../Paypal/controllers/ExpressController.php | 17 + app/code/core/Mage/Paypal/etc/system.xml | 24 +- app/code/core/Mage/PaypalUk/Model/Express.php | 22 +- .../Mage/PaypalUk/Model/Express/Review.php | 20 +- .../controllers/ExpressController.php | 9 + app/code/core/Mage/PaypalUk/etc/system.xml | 16 +- app/code/core/Mage/Poll/etc/system.xml | 4 +- app/code/core/Mage/Rating/etc/config.xml | 19 + .../Model/Mysql4/Coupons/Collection.php | 12 +- .../Model/Mysql4/Customer/Collection.php | 14 +- .../Model/Mysql4/Invoiced/Collection.php | 15 +- .../Reports/Model/Mysql4/Order/Collection.php | 97 +- .../Mysql4/Product/Downloads/Collection.php | 101 + .../Reports/Model/Mysql4/Quote/Collection.php | 4 +- .../Model/Mysql4/Refunded/Collection.php | 12 +- .../Model/Mysql4/Shipping/Collection.php | 4 +- .../Reports/Model/Mysql4/Tax/Collection.php | 77 +- app/code/core/Mage/Reports/etc/config.xml | 61 +- app/code/core/Mage/Reports/etc/system.xml | 4 +- .../mysql4-upgrade-0.7.5-0.7.7.php | 1 - app/code/core/Mage/Review/etc/config.xml | 28 + app/code/core/Mage/Rss/etc/config.xml | 27 +- app/code/core/Mage/Rule/Block/Editable.php | 2 +- .../Mage/Rule/Model/Condition/Abstract.php | 71 +- .../core/Mage/Sales/Block/Items/Abstract.php | 2 + .../core/Mage/Sales/Model/Entity/Setup.php | 18 + .../core/Mage/Sales/Model/Mysql4/Quote.php | 17 + .../Model/Mysql4/Quote/Address/Collection.php | 9 +- .../Model/Mysql4/Quote/Item/Collection.php | 13 +- .../core/Mage/Sales/Model/Mysql4/Setup.php | 18 + app/code/core/Mage/Sales/Model/Observer.php | 23 +- app/code/core/Mage/Sales/Model/Order.php | 42 +- .../Mage/Sales/Model/Order/Creditmemo.php | 7 + .../core/Mage/Sales/Model/Order/Invoice.php | 7 + app/code/core/Mage/Sales/Model/Quote.php | 63 +- .../Model/Quote/Address/Total/Discount.php | 5 +- .../Sales/Model/Quote/Address/Total/Tax.php | 21 +- app/code/core/Mage/Sales/Model/Quote/Item.php | 26 + .../Mage/Sales/Model/Quote/Item/Option.php | 2 +- app/code/core/Mage/Sales/doc/order.txt | 11 +- app/code/core/Mage/Sales/doc/quote.txt | 3 + app/code/core/Mage/Sales/etc/api.xml | 20 +- app/code/core/Mage/Sales/etc/config.xml | 32 +- .../mysql4-upgrade-0.9.26-0.9.27.php | 162 + .../mysql4-upgrade-0.9.27-0.9.28.php | 44 + .../mysql4-upgrade-0.9.28-0.9.29.php | 145 + .../core/Mage/SalesRule/Model/Validator.php | 78 +- app/code/core/Mage/SalesRule/etc/config.xml | 15 + app/code/core/Mage/Sendfriend/etc/config.xml | 4 +- app/code/core/Mage/Sendfriend/etc/system.xml | 2 +- .../sendfriend_setup/mysql4-install-0.7.0.php | 4 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 37 + .../Mage/Shipping/Model/Carrier/Abstract.php | 26 +- .../Model/Mysql4/Carrier/Tablerate.php | 3 +- app/code/core/Mage/Shipping/etc/config.xml | 4 +- app/code/core/Mage/Sitemap/Model/Sitemap.php | 2 +- app/code/core/Mage/Sitemap/etc/config.xml | 12 +- app/code/core/Mage/Tag/etc/config.xml | 23 + app/code/core/Mage/Tax/Helper/Data.php | 6 +- .../core/Mage/Tax/Model/Calculation/Rate.php | 31 +- .../core/Mage/Tax/Model/Calculation/Rule.php | 34 +- .../Mage/Tax/Model/Mysql4/Calculation.php | 6 + app/code/core/Mage/Tax/Model/Observer.php | 41 +- app/code/core/Mage/Tax/etc/config.xml | 41 +- .../tax_setup/mysql4-upgrade-0.7.7-0.7.8.php | 33 + .../Mage/Usa/Model/Shipping/Carrier/Dhl.php | 7 +- .../Mage/Usa/Model/Shipping/Carrier/Ups.php | 11 +- .../Mage/Usa/Model/Shipping/Carrier/Usps.php | 4 +- .../core/Mage/Weee/Block/Element/Weee/Tax.php | 29 + .../Mage/Weee/Block/Renderer/Weee/Tax.php | 162 + app/code/core/Mage/Weee/Helper/Data.php | 255 ++ .../Weee/Model/Attribute/Backend/Weee/Tax.php | 141 + .../Mage/Weee/Model/Config/Source/Display.php | 40 + .../Mysql4/Attribute/Backend/Weee/Tax.php | 90 + .../core/Mage/Weee/Model/Mysql4/Setup.php | 37 + app/code/core/Mage/Weee/Model/Mysql4/Tax.php | 71 + app/code/core/Mage/Weee/Model/Observer.php | 255 ++ app/code/core/Mage/Weee/Model/Tax.php | 160 + .../Mage/Weee/Model/Total/Creditmemo/Weee.php | 75 + .../Mage/Weee/Model/Total/Invoice/Weee.php | 83 + .../core/Mage/Weee/Model/Total/Quote/Weee.php | 275 ++ app/code/core/Mage/Weee/etc/config.xml | 300 ++ app/code/core/Mage/Weee/etc/system.xml | 132 + .../sql/weee_setup/mysql4-install-0.1.php | 49 + .../sql/weee_setup/mysql4-upgrade-0.1-0.2.php | 34 + .../weee_setup/mysql4-upgrade-0.10-0.11.php | 47 + .../weee_setup/mysql4-upgrade-0.11-0.12.php | 47 + .../sql/weee_setup/mysql4-upgrade-0.2-0.3.php | 34 + .../sql/weee_setup/mysql4-upgrade-0.3-0.4.php | 35 + .../sql/weee_setup/mysql4-upgrade-0.4-0.5.php | 38 + .../sql/weee_setup/mysql4-upgrade-0.5-0.6.php | 50 + .../sql/weee_setup/mysql4-upgrade-0.6-0.7.php | 35 + .../sql/weee_setup/mysql4-upgrade-0.7-0.8.php | 34 + .../sql/weee_setup/mysql4-upgrade-0.8-0.9.php | 41 + .../weee_setup/mysql4-upgrade-0.9-0.10.php | 59 + .../Wishlist/controllers/IndexController.php | 9 +- app/code/core/Mage/Wishlist/etc/config.xml | 2 +- .../default/default/layout/downloadable.xml | 86 + .../adminhtml/default/default/layout/main.xml | 3 +- .../default/template/api/roleinfo.phtml | 9 +- .../default/template/api/userinfo.phtml | 1 + .../edit/bundle/option/selection.phtml | 2 +- .../creditmemo/create/items/renderer.phtml | 634 ++- .../creditmemo/view/items/renderer.phtml | 498 ++- .../sales/invoice/create/items/renderer.phtml | 612 ++- .../sales/invoice/view/items/renderer.phtml | 496 ++- .../sales/order/view/items/renderer.phtml | 762 ++-- .../template/catalog/category/edit.phtml | 18 +- .../template/catalog/category/edit/form.phtml | 11 +- .../template/catalog/category/tree.phtml | 257 +- .../catalog/product/attribute/js.phtml | 88 +- .../catalog/product/attribute/set/main.phtml | 11 + .../template/catalog/product/edit.phtml | 5 +- .../product/edit/action/attribute.phtml | 2 +- .../catalog/product/edit/options.phtml | 4 +- .../catalog/product/edit/options/option.phtml | 4 +- .../template/customer/tab/wishlist.phtml | 6 +- .../default/template/dashboard/index.phtml | 5 +- .../product/edit/downloadable.phtml | 241 + .../product/edit/downloadable/links.phtml | 355 ++ .../product/edit/downloadable/samples.phtml | 210 + .../column/downloadable/creditmemo/name.phtml | 58 + .../column/downloadable/invoice/name.phtml | 58 + .../items/column/downloadable/name.phtml | 58 + .../create/items/renderer/downloadable.phtml | 135 + .../view/items/renderer/downloadable.phtml | 123 + .../create/items/renderer/downloadable.phtml | 133 + .../view/items/renderer/downloadable.phtml | 123 + .../view/items/renderer/downloadable.phtml | 180 + .../default/template/email/order/items.phtml | 76 +- .../template/extensions/console/form.phtml | 1 + .../template/extensions/file/form.phtml | 15 +- .../template/extensions/mass/install.phtml | 1 + .../template/extensions/mass/uninstall.phtml | 1 + .../template/extensions/mass/upgrade.phtml | 1 + .../default/template/forgotpassword.phtml | 5 +- .../default/default/template/formkey.phtml | 27 + .../default/template/giftmessage/form.phtml | 2 +- .../default/template/googlebase/captcha.phtml | 35 + .../default/template/googlebase/items.phtml | 4 + .../default/default/template/login.phtml | 2 +- .../default/template/media/uploader.phtml | 9 + .../template/newsletter/problem/list.phtml | 16 +- .../template/newsletter/queue/edit.phtml | 45 +- .../template/newsletter/subscriber/list.phtml | 5 +- .../template/newsletter/template/edit.phtml | 20 +- .../default/default/template/page.phtml | 180 +- .../default/default/template/page/head.phtml | 4 +- .../permissions/role_users_grid_js.phtml | 80 +- .../template/permissions/roleinfo.phtml | 9 +- .../template/permissions/userinfo.phtml | 1 + .../template/sales/order/create/comment.phtml | 2 +- .../template/sales/order/create/data.phtml | 26 +- .../template/sales/order/create/form.phtml | 9 +- .../sales/order/create/form/address.phtml | 8 +- .../sales/order/create/giftmessage.phtml | 2 +- .../sales/order/create/items/grid.phtml | 292 +- .../order/create/shipping/method/form.phtml | 10 +- .../template/sales/order/create/sidebar.phtml | 2 +- .../sales/order/create/totals/tax.phtml | 7 +- .../sales/order/creditmemo/create/form.phtml | 1 + .../create/items/renderer/configurable.phtml | 222 +- .../create/items/renderer/default.phtml | 222 +- .../view/items/renderer/configurable.phtml | 223 +- .../view/items/renderer/default.phtml | 223 +- .../sales/order/invoice/create/form.phtml | 1 + .../create/items/renderer/configurable.phtml | 223 +- .../create/items/renderer/default.phtml | 223 +- .../view/items/renderer/configurable.phtml | 223 +- .../invoice/view/items/renderer/default.phtml | 223 +- .../sales/order/shipment/create/form.phtml | 1 + .../template/sales/order/totals/tax.phtml | 7 +- .../template/sales/order/view/history.phtml | 4 +- .../template/sales/order/view/info.phtml | 12 + .../order/view/items/renderer/default.phtml | 223 +- .../template/sales/order/view/tab/info.phtml | 2 +- .../default/template/system/cache/edit.phtml | 81 +- .../default/template/system/config/edit.phtml | 15 +- .../system/convert/profile/wizard.phtml | 195 +- .../system/currency/rate/matrix.phtml | 1 + .../template/system/currency/rates.phtml | 1 + .../default/template/system/design/edit.phtml | 1 + .../template/system/email/template/edit.phtml | 19 +- .../default/default/template/tag/edit.phtml | 1 + .../default/template/tax/importExport.phtml | 2 + .../template/urlrewrite/categories.phtml | 149 + .../urlrewrite/{form.phtml => edit.phtml} | 28 +- .../urlrewrite/product/categories.phtml | 310 -- .../selector.phtml} | 39 +- .../default/template/weee/renderer/tax.phtml | 197 + .../template/widget/form/container.phtml | 82 +- .../template/widget/grid/massaction.phtml | 1 + .../default/default/layout/catalog.xml | 7 +- .../default/default/layout/catalogsearch.xml | 13 +- .../frontend/default/default/layout/core.xml | 5 +- .../default/default/layout/customer.xml | 1 - .../default/default/layout/directory.xml | 15 +- .../default/default/layout/downloadable.xml | 167 + .../frontend/default/default/layout/weee.xml | 53 + .../bundle/catalog/product/price.phtml | 363 +- .../bundle/catalog/product/view/price.phtml | 147 +- .../view/type/bundle/option/radio.phtml | 2 +- .../view/type/bundle/option/select.phtml | 2 +- .../order/items/creditmemo/default.phtml | 79 +- .../email/order/items/invoice/default.phtml | 79 +- .../email/order/items/order/default.phtml | 81 +- .../order/creditmemo/items/renderer.phtml | 257 +- .../sales/order/invoice/items/renderer.phtml | 255 +- .../bundle/sales/order/items/renderer.phtml | 254 +- .../template/catalog/product/list.phtml | 8 +- .../template/catalog/product/price.phtml | 374 +- .../template/catalog/product/view.phtml | 2 +- .../catalog/product/view/attributes.phtml | 2 +- .../template/catalog/product/view/media.phtml | 4 +- .../catalog/product/view/tierprices.phtml | 145 +- .../catalog/product/view/type/grouped.phtml | 2 + .../catalogsearch/advanced/form.phtml | 3 +- .../template/catalogsearch/result.phtml | 12 + .../template/checkout/cart/item/default.phtml | 175 +- .../checkout/cart/render/default.phtml | 4 +- .../checkout/cart/render/simple.phtml | 4 +- .../checkout/cart/sidebar/default.phtml | 85 +- .../checkout/multishipping/billing.phtml | 2 +- .../checkout/multishipping/overview.phtml | 8 +- .../checkout/multishipping/shipping.phtml | 2 +- .../checkout/multishipping/success.phtml | 1 + .../template/checkout/onepage/billing.phtml | 19 +- .../template/checkout/onepage/login.phtml | 4 +- .../template/checkout/onepage/progress.phtml | 8 +- .../checkout/onepage/review/item.phtml | 182 +- .../default/template/checkout/success.phtml | 5 +- .../default/template/checkout/total/tax.phtml | 11 +- .../default/template/contacts/form.phtml | 2 +- .../default/template/core/formkey.phtml | 27 + .../template/customer/address/edit.phtml | 1 + .../default/template/customer/form/edit.phtml | 1 + .../template/customer/form/login.phtml | 4 +- .../template/customer/form/newsletter.phtml | 3 +- .../template/customer/widget/dob.phtml | 2 +- .../downloadable/catalog/product/links.phtml | 111 + .../catalog/product/samples.phtml} | 36 +- .../downloadable/catalog/product/type.phtml} | 36 +- .../checkout/cart/item/default.phtml | 103 + .../multishipping/item/downloadable.phtml | 57 + .../checkout/onepage/review/item.phtml | 72 + .../downloadable/checkout/success.phtml | 29 + .../downloadable/customer/products/list.phtml | 62 + .../order/items/creditmemo/downloadable.phtml | 128 + .../order/items/invoice/downloadable.phtml | 131 + .../order/items/order/downloadable.phtml | 137 + .../items/renderer/downloadable.phtml | 113 + .../invoice/items/renderer/downloadable.phtml | 110 + .../sales/order/items/renderer.phtml | 130 + .../order/items/renderer/downloadable.phtml | 132 + .../order/items/creditmemo/default.phtml | 81 +- .../email/order/items/invoice/default.phtml | 81 +- .../email/order/items/order/default.phtml | 81 +- .../template/googlecheckout/link.phtml | 22 +- .../default/template/page/html/head.phtml | 5 +- .../paypal/express/review/details.phtml | 16 +- .../creditmemo/items/renderer/default.phtml | 216 +- .../invoice/items/renderer/default.phtml | 214 +- .../sales/order/items/renderer/default.phtml | 214 +- .../template/sales/order/print/tax.phtml | 8 +- .../default/template/sales/order/tax.phtml | 7 +- .../default/template/wishlist/sharing.phtml | 1 + .../default/template/wishlist/view.phtml | 1 + .../default/template/install/config.phtml | 2 +- .../default/template/install/locale.phtml | 2 +- app/etc/config.xml | 3 +- app/etc/local.xml.additional | 55 + app/etc/local.xml.template | 13 +- app/etc/modules/Mage_All.xml | 59 +- app/etc/modules/Mage_Api.xml | 3 + app/etc/modules/Mage_Downloadable.xml | 38 + app/etc/modules/Mage_Weee.xml | 40 + app/locale/en_US/Mage_AdminNotification.csv | 3 + app/locale/en_US/Mage_Adminhtml.csv | 64 +- app/locale/en_US/Mage_Api.csv | 332 ++ app/locale/en_US/Mage_Backup.csv | 3 +- app/locale/en_US/Mage_Bundle.csv | 3 + app/locale/en_US/Mage_Catalog.csv | 25 +- app/locale/en_US/Mage_CatalogInventory.csv | 4 + app/locale/en_US/Mage_CatalogSearch.csv | 14 + app/locale/en_US/Mage_Checkout.csv | 8 +- app/locale/en_US/Mage_Cms.csv | 1 - app/locale/en_US/Mage_Contacts.csv | 1 + app/locale/en_US/Mage_Core.csv | 23 +- app/locale/en_US/Mage_Cron.csv | 8 + app/locale/en_US/Mage_Customer.csv | 7 +- app/locale/en_US/Mage_Directory.csv | 1 + app/locale/en_US/Mage_Downloadable.csv | 60 + app/locale/en_US/Mage_Eav.csv | 1 + app/locale/en_US/Mage_GoogleBase.csv | 9 + app/locale/en_US/Mage_Install.csv | 1 + app/locale/en_US/Mage_Log.csv | 4 +- app/locale/en_US/Mage_Media.csv | 2 + app/locale/en_US/Mage_Newsletter.csv | 2 + app/locale/en_US/Mage_Payment.csv | 1 + app/locale/en_US/Mage_Poll.csv | 1 + app/locale/en_US/Mage_Reports.csv | 9 +- app/locale/en_US/Mage_Review.csv | 2 +- app/locale/en_US/Mage_Rss.csv | 3 + app/locale/en_US/Mage_Sales.csv | 37 + app/locale/en_US/Mage_SalesRule.csv | 1 - app/locale/en_US/Mage_Shipping.csv | 2 + app/locale/en_US/Mage_Sitemap.csv | 1 + app/locale/en_US/Mage_Strikeiron.csv | 46 + app/locale/en_US/Mage_Tag.csv | 1 + app/locale/en_US/Mage_Tax.csv | 1 + app/locale/en_US/Mage_Weee.csv | 18 + app/locale/en_US/Mage_Wishlist.csv | 1 + .../email/newsletter_unsub_success.html | 1 - cron.php | 7 +- downloader/Maged/Controller.php | 4 +- downloader/Maged/Model/Pear.php | 35 +- downloader/Maged/Model/Session.php | 6 +- downloader/template/install/footer.phtml | 4 +- js/index.php | 50 +- js/lib/flex.js | 203 +- js/mage/adminhtml/events.js | 43 +- js/mage/adminhtml/flexuploader.js | 100 +- js/mage/adminhtml/form.js | 6 +- js/mage/adminhtml/grid.js | 16 +- js/mage/adminhtml/loader.js | 133 +- js/mage/adminhtml/product.js | 15 +- js/mage/adminhtml/rules.js | 239 +- js/mage/adminhtml/sales.js | 29 +- js/mage/adminhtml/tabs.js | 15 +- js/mage/translate_inline.js | 2 +- js/varien/js.js | 8 +- js/varien/product.js | 35 +- js/varien/weee.js | 11 + lib/Varien/Data/Collection/Db.php | 29 +- lib/Varien/Data/Form.php | 13 +- lib/Varien/Data/Form/Element/Multiselect.php | 2 +- lib/Varien/Db/Adapter/Pdo/Mysql.php | 142 +- lib/Varien/Db/Select.php | 129 + lib/Varien/Io/File.php | 27 +- lib/Varien/Simplexml/Element.php | 6 +- lib/Zend/Acl.php | 45 +- lib/Zend/Amf/Constants.php | 79 + lib/Zend/Amf/Exception.php | 33 + lib/Zend/Amf/Parse/Amf0/Deserializer.php | 321 ++ lib/Zend/Amf/Parse/Amf0/Serializer.php | 296 ++ lib/Zend/Amf/Parse/Amf3/Deserializer.php | 410 ++ lib/Zend/Amf/Parse/Amf3/Serializer.php | 328 ++ lib/Zend/Amf/Parse/Deserializer.php | 64 + lib/Zend/Amf/Parse/InputStream.php | 38 + lib/Zend/Amf/Parse/OutputStream.php | 48 + lib/Zend/Amf/Parse/Serializer.php | 58 + lib/Zend/Amf/Parse/TypeLoader.php | 133 + lib/Zend/Amf/Request.php | 249 ++ lib/Zend/Amf/Request/Http.php | 79 + lib/Zend/Amf/Response.php | 193 + lib/Zend/Amf/Response/Http.php | 47 + lib/Zend/Amf/Server.php | 622 +++ lib/Zend/Amf/Server/Exception.php | 35 + lib/Zend/Amf/Util/BinaryStream.php | 278 ++ lib/Zend/Amf/Value/ByteArray.php | 57 + lib/Zend/Amf/Value/MessageBody.php | 181 + lib/Zend/Amf/Value/MessageHeader.php | 80 + .../Amf/Value/Messaging/AbstractMessage.php | 91 + .../Value/Messaging/AcknowledgeMessage.php | 59 + lib/Zend/Amf/Value/Messaging/AsyncMessage.php | 42 + .../Amf/Value/Messaging/CommandMessage.php | 127 + lib/Zend/Amf/Value/Messaging/ErrorMessage.php | 66 + .../Amf/Value/Messaging/RemotingMessage.php | 72 + lib/Zend/Amf/Value/TraitsInfo.php | 153 + lib/Zend/Auth.php | 7 +- lib/Zend/Auth/Adapter/DbTable.php | 24 +- lib/Zend/Auth/Adapter/Digest.php | 4 +- lib/Zend/Auth/Adapter/Http.php | 16 +- lib/Zend/Auth/Adapter/InfoCard.php | 4 +- lib/Zend/Auth/Adapter/Ldap.php | 66 +- lib/Zend/Auth/Adapter/OpenId.php | 32 +- lib/Zend/Auth/Storage/Exception.php | 3 +- lib/Zend/Cache.php | 190 +- lib/Zend/Cache/Backend.php | 19 +- lib/Zend/Cache/Backend/Apc.php | 235 +- lib/Zend/Cache/Backend/ExtendedInterface.php | 125 + lib/Zend/Cache/Backend/File.php | 418 +- lib/Zend/Cache/Backend/Interface.php | 2 + lib/Zend/Cache/Backend/Memcached.php | 311 +- lib/Zend/Cache/Backend/Sqlite.php | 395 +- lib/Zend/Cache/Backend/Test.php | 12 +- lib/Zend/Cache/Backend/TwoLevels.php | 501 +++ lib/Zend/Cache/Backend/Xcache.php | 215 + lib/Zend/Cache/Backend/ZendPlatform.php | 91 +- lib/Zend/Cache/Core.php | 230 +- lib/Zend/Cache/Frontend/Class.php | 79 +- lib/Zend/Cache/Frontend/File.php | 119 +- lib/Zend/Cache/Frontend/Function.php | 7 +- lib/Zend/Cache/Frontend/Output.php | 47 +- lib/Zend/Cache/Frontend/Page.php | 137 +- lib/Zend/Captcha/Adapter.php | 76 + lib/Zend/Captcha/Base.php | 176 + lib/Zend/Captcha/Dumb.php | 52 + lib/Zend/Captcha/Exception.php | 34 + lib/Zend/Captcha/Figlet.php | 85 + lib/Zend/Captcha/Image.php | 589 +++ lib/Zend/Captcha/ReCaptcha.php | 267 ++ lib/Zend/Captcha/Word.php | 369 ++ lib/Zend/Config.php | 101 +- lib/Zend/Config/Ini.php | 18 +- lib/Zend/Config/Writer.php | 101 + lib/Zend/Config/Writer/Array.php | 101 + lib/Zend/Config/Writer/Ini.php | 174 + lib/Zend/Config/Writer/Xml.php | 140 + lib/Zend/Config/Xml.php | 151 +- lib/Zend/Console/Getopt.php | 75 +- lib/Zend/Controller/Action.php | 33 +- .../Controller/Action/Helper/Abstract.php | 9 +- .../Controller/Action/Helper/ActionStack.php | 21 +- .../Controller/Action/Helper/AjaxContext.php | 16 +- .../Action/Helper/AutoComplete/Abstract.php | 16 +- .../Action/Helper/AutoCompleteDojo.php | 55 +- .../Helper/AutoCompleteScriptaculous.php | 16 +- .../Action/Helper/ContextSwitch.php | 295 +- .../Action/Helper/FlashMessenger.php | 5 + lib/Zend/Controller/Action/Helper/Json.php | 16 +- .../Controller/Action/Helper/Redirector.php | 131 +- lib/Zend/Controller/Action/Helper/Url.php | 54 +- .../Controller/Action/Helper/ViewRenderer.php | 52 +- lib/Zend/Controller/Action/HelperBroker.php | 354 +- .../Action/HelperBroker/PriorityStack.php | 280 ++ lib/Zend/Controller/Dispatcher/Abstract.php | 9 - lib/Zend/Controller/Dispatcher/Interface.php | 34 +- lib/Zend/Controller/Dispatcher/Standard.php | 35 +- lib/Zend/Controller/Front.php | 68 +- lib/Zend/Controller/Plugin/Abstract.php | 6 - lib/Zend/Controller/Plugin/Broker.php | 13 +- lib/Zend/Controller/Request/Abstract.php | 6 + lib/Zend/Controller/Request/Apache404.php | 19 +- lib/Zend/Controller/Request/Http.php | 158 +- lib/Zend/Controller/Request/HttpTestCase.php | 275 ++ lib/Zend/Controller/Response/HttpTestCase.php | 129 + lib/Zend/Controller/Router/Abstract.php | 15 +- lib/Zend/Controller/Router/Interface.php | 44 +- lib/Zend/Controller/Router/Rewrite.php | 136 +- lib/Zend/Controller/Router/Route.php | 212 +- lib/Zend/Controller/Router/Route/Abstract.php | 52 + lib/Zend/Controller/Router/Route/Chain.php | 135 + lib/Zend/Controller/Router/Route/Hostname.php | 341 ++ .../Controller/Router/Route/Interface.php | 4 +- lib/Zend/Controller/Router/Route/Module.php | 38 +- lib/Zend/Controller/Router/Route/Regex.php | 20 +- lib/Zend/Controller/Router/Route/Static.php | 12 +- lib/Zend/Currency.php | 1223 ++--- lib/Zend/Currency/Exception.php | 22 +- lib/Zend/Date.php | 1354 +++--- lib/Zend/Date/Cities.php | 59 +- lib/Zend/Date/DateObject.php | 30 +- lib/Zend/Db.php | 22 +- lib/Zend/Db/Adapter/Abstract.php | 151 +- lib/Zend/Db/Adapter/Db2.php | 316 +- lib/Zend/Db/Adapter/Db2/Exception.php | 16 +- lib/Zend/Db/Adapter/Mysqli.php | 76 +- lib/Zend/Db/Adapter/Oracle.php | 148 +- lib/Zend/Db/Adapter/Pdo/Abstract.php | 56 +- lib/Zend/Db/Adapter/Pdo/Ibm.php | 33 +- lib/Zend/Db/Adapter/Pdo/Ibm/Db2.php | 6 +- lib/Zend/Db/Adapter/Pdo/Ibm/Ids.php | 6 +- lib/Zend/Db/Adapter/Pdo/Mssql.php | 23 +- lib/Zend/Db/Adapter/Pdo/Mysql.php | 7 +- lib/Zend/Db/Adapter/Pdo/Oci.php | 64 +- lib/Zend/Db/Adapter/Pdo/Pgsql.php | 3 +- lib/Zend/Db/Adapter/Pdo/Sqlite.php | 3 +- lib/Zend/Db/Expr.php | 3 +- lib/Zend/Db/Profiler.php | 3 +- lib/Zend/Db/Profiler/Exception.php | 3 +- lib/Zend/Db/Profiler/Firebug.php | 159 + lib/Zend/Db/Profiler/Query.php | 3 +- lib/Zend/Db/Select.php | 160 +- lib/Zend/Db/Statement.php | 10 +- lib/Zend/Db/Statement/Db2.php | 50 +- lib/Zend/Db/Statement/Db2/Exception.php | 16 +- lib/Zend/Db/Statement/Mysqli.php | 62 +- lib/Zend/Db/Statement/Mysqli/Exception.php | 14 +- lib/Zend/Db/Statement/Oracle.php | 50 +- lib/Zend/Db/Statement/Pdo.php | 14 +- lib/Zend/Db/Table/Abstract.php | 199 +- lib/Zend/Db/Table/Row.php | 3 +- lib/Zend/Db/Table/Row/Abstract.php | 103 +- lib/Zend/Db/Table/Rowset/Abstract.php | 52 +- lib/Zend/Db/Table/Select.php | 27 +- lib/Zend/Debug.php | 6 +- lib/Zend/Dojo.php | 87 + lib/Zend/Dojo/Data.php | 563 +++ lib/Zend/Dojo/Exception.php | 35 + lib/Zend/Dojo/Form.php | 89 + .../Form/Decorator/AccordionContainer.php | 43 + .../Dojo/Form/Decorator/AccordionPane.php | 43 + .../Dojo/Form/Decorator/BorderContainer.php | 43 + lib/Zend/Dojo/Form/Decorator/ContentPane.php | 43 + .../Dojo/Form/Decorator/DijitContainer.php | 200 + lib/Zend/Dojo/Form/Decorator/DijitElement.php | 195 + lib/Zend/Dojo/Form/Decorator/DijitForm.php | 61 + .../Dojo/Form/Decorator/SplitContainer.php | 43 + .../Dojo/Form/Decorator/StackContainer.php | 44 + lib/Zend/Dojo/Form/Decorator/TabContainer.php | 43 + lib/Zend/Dojo/Form/DisplayGroup.php | 68 + lib/Zend/Dojo/Form/Element/Button.php | 121 + lib/Zend/Dojo/Form/Element/CheckBox.php | 212 + lib/Zend/Dojo/Form/Element/ComboBox.php | 186 + .../Dojo/Form/Element/CurrencyTextBox.php | 120 + lib/Zend/Dojo/Form/Element/DateTextBox.php | 214 + lib/Zend/Dojo/Form/Element/Dijit.php | 189 + lib/Zend/Dojo/Form/Element/DijitMulti.php | 304 ++ lib/Zend/Dojo/Form/Element/Editor.php | 598 +++ .../Dojo/Form/Element/FilteringSelect.php | 48 + .../Dojo/Form/Element/HorizontalSlider.php | 208 + lib/Zend/Dojo/Form/Element/NumberSpinner.php | 245 + lib/Zend/Dojo/Form/Element/NumberTextBox.php | 173 + .../Dojo/Form/Element/PasswordTextBox.php | 42 + lib/Zend/Dojo/Form/Element/RadioButton.php | 42 + lib/Zend/Dojo/Form/Element/SimpleTextarea.php | 43 + lib/Zend/Dojo/Form/Element/Slider.php | 199 + lib/Zend/Dojo/Form/Element/SubmitButton.php | 42 + lib/Zend/Dojo/Form/Element/TextBox.php | 164 + lib/Zend/Dojo/Form/Element/Textarea.php | 42 + lib/Zend/Dojo/Form/Element/TimeTextBox.php | 152 + .../Dojo/Form/Element/ValidationTextBox.php | 218 + lib/Zend/Dojo/Form/Element/VerticalSlider.php | 208 + lib/Zend/Dojo/Form/SubForm.php | 94 + lib/Zend/Dojo/View/Exception.php | 27 + .../Dojo/View/Helper/AccordionContainer.php | 66 + lib/Zend/Dojo/View/Helper/AccordionPane.php | 66 + lib/Zend/Dojo/View/Helper/BorderContainer.php | 79 + lib/Zend/Dojo/View/Helper/Button.php | 68 + lib/Zend/Dojo/View/Helper/CheckBox.php | 100 + lib/Zend/Dojo/View/Helper/ComboBox.php | 151 + lib/Zend/Dojo/View/Helper/ContentPane.php | 66 + lib/Zend/Dojo/View/Helper/CurrencyTextBox.php | 68 + lib/Zend/Dojo/View/Helper/DateTextBox.php | 68 + lib/Zend/Dojo/View/Helper/Dijit.php | 311 ++ lib/Zend/Dojo/View/Helper/DijitContainer.php | 92 + lib/Zend/Dojo/View/Helper/Dojo.php | 176 + lib/Zend/Dojo/View/Helper/Dojo/Container.php | 1070 +++++ lib/Zend/Dojo/View/Helper/Editor.php | 132 + lib/Zend/Dojo/View/Helper/FilteringSelect.php | 63 + lib/Zend/Dojo/View/Helper/Form.php | 96 + .../Dojo/View/Helper/HorizontalSlider.php | 62 + lib/Zend/Dojo/View/Helper/NumberSpinner.php | 90 + lib/Zend/Dojo/View/Helper/NumberTextBox.php | 68 + lib/Zend/Dojo/View/Helper/PasswordTextBox.php | 56 + lib/Zend/Dojo/View/Helper/RadioButton.php | 89 + lib/Zend/Dojo/View/Helper/SimpleTextarea.php | 78 + lib/Zend/Dojo/View/Helper/Slider.php | 239 + lib/Zend/Dojo/View/Helper/SplitContainer.php | 66 + lib/Zend/Dojo/View/Helper/StackContainer.php | 66 + lib/Zend/Dojo/View/Helper/SubmitButton.php | 67 + lib/Zend/Dojo/View/Helper/TabContainer.php | 66 + lib/Zend/Dojo/View/Helper/TextBox.php | 68 + lib/Zend/Dojo/View/Helper/Textarea.php | 80 + lib/Zend/Dojo/View/Helper/TimeTextBox.php | 68 + .../Dojo/View/Helper/ValidationTextBox.php | 68 + lib/Zend/Dojo/View/Helper/VerticalSlider.php | 62 + lib/Zend/Dom/Exception.php | 26 + lib/Zend/Dom/Query.php | 221 + lib/Zend/Dom/Query/Css2Xpath.php | 141 + lib/Zend/Dom/Query/Result.php | 183 + lib/Zend/Feed.php | 7 +- lib/Zend/Feed/Abstract.php | 9 +- lib/Zend/Feed/Atom.php | 4 +- lib/Zend/Feed/Entry/Abstract.php | 7 +- lib/Zend/Feed/Entry/Atom.php | 7 +- lib/Zend/Feed/Rss.php | 4 +- lib/Zend/File/Transfer.php | 57 + lib/Zend/File/Transfer/Adapter/Abstract.php | 1315 ++++++ lib/Zend/File/Transfer/Adapter/Http.php | 241 + lib/Zend/File/Transfer/Exception.php | 55 + lib/Zend/Filter.php | 4 +- lib/Zend/Filter/Alnum.php | 37 +- lib/Zend/Filter/Alpha.php | 37 +- lib/Zend/Filter/File/LowerCase.php | 84 + lib/Zend/Filter/File/Rename.php | 282 ++ lib/Zend/Filter/File/UpperCase.php | 84 + lib/Zend/Filter/HtmlEntities.php | 3 +- lib/Zend/Filter/Inflector.php | 42 +- lib/Zend/Filter/Input.php | 74 +- lib/Zend/Filter/StripNewlines.php | 48 + lib/Zend/Filter/Word/Separator/Abstract.php | 1 + lib/Zend/Form.php | 670 ++- lib/Zend/Form/Decorator/Captcha.php | 72 + lib/Zend/Form/Decorator/Captcha/Word.php | 73 + lib/Zend/Form/Decorator/Description.php | 10 +- lib/Zend/Form/Decorator/DtDdWrapper.php | 4 +- lib/Zend/Form/Decorator/Fieldset.php | 33 +- lib/Zend/Form/Decorator/File.php | 128 + lib/Zend/Form/Decorator/Form.php | 9 +- lib/Zend/Form/Decorator/FormElements.php | 28 +- lib/Zend/Form/Decorator/FormErrors.php | 397 ++ lib/Zend/Form/Decorator/HtmlTag.php | 14 +- lib/Zend/Form/Decorator/Image.php | 13 +- lib/Zend/Form/Decorator/Label.php | 82 +- lib/Zend/Form/Decorator/PrepareElements.php | 90 + lib/Zend/Form/Decorator/ViewHelper.php | 32 +- lib/Zend/Form/DisplayGroup.php | 167 +- lib/Zend/Form/Element.php | 668 ++- lib/Zend/Form/Element/Captcha.php | 279 ++ lib/Zend/Form/Element/Checkbox.php | 21 +- lib/Zend/Form/Element/File.php | 819 ++++ lib/Zend/Form/Element/Hash.php | 4 +- lib/Zend/Form/Element/Multi.php | 133 +- lib/Zend/Form/Element/Password.php | 29 +- lib/Zend/Gdata.php | 109 +- lib/Zend/Gdata/App.php | 882 ++-- lib/Zend/Gdata/App/AuthException.php | 5 +- lib/Zend/Gdata/App/BadMethodCallException.php | 2 + lib/Zend/Gdata/App/Base.php | 113 +- lib/Zend/Gdata/App/BaseMediaSource.php | 2 + .../Gdata/App/CaptchaRequiredException.php | 2 + lib/Zend/Gdata/App/Entry.php | 77 +- lib/Zend/Gdata/App/Exception.php | 2 + lib/Zend/Gdata/App/Extension.php | 2 + lib/Zend/Gdata/App/Extension/Author.php | 2 + lib/Zend/Gdata/App/Extension/Category.php | 26 +- lib/Zend/Gdata/App/Extension/Content.php | 12 +- lib/Zend/Gdata/App/Extension/Contributor.php | 2 + lib/Zend/Gdata/App/Extension/Control.php | 6 +- lib/Zend/Gdata/App/Extension/Draft.php | 2 + lib/Zend/Gdata/App/Extension/Element.php | 2 + lib/Zend/Gdata/App/Extension/Email.php | 2 + lib/Zend/Gdata/App/Extension/Generator.php | 10 +- lib/Zend/Gdata/App/Extension/Icon.php | 2 + lib/Zend/Gdata/App/Extension/Id.php | 2 + lib/Zend/Gdata/App/Extension/Link.php | 42 +- lib/Zend/Gdata/App/Extension/Logo.php | 2 + lib/Zend/Gdata/App/Extension/Name.php | 2 + lib/Zend/Gdata/App/Extension/Person.php | 6 +- lib/Zend/Gdata/App/Extension/Published.php | 2 + lib/Zend/Gdata/App/Extension/Rights.php | 2 + lib/Zend/Gdata/App/Extension/Source.php | 2 + lib/Zend/Gdata/App/Extension/Subtitle.php | 2 + lib/Zend/Gdata/App/Extension/Summary.php | 2 + lib/Zend/Gdata/App/Extension/Text.php | 8 +- lib/Zend/Gdata/App/Extension/Title.php | 2 + lib/Zend/Gdata/App/Extension/Updated.php | 2 + lib/Zend/Gdata/App/Extension/Uri.php | 2 + lib/Zend/Gdata/App/Feed.php | 99 +- lib/Zend/Gdata/App/FeedEntryParent.php | 243 +- lib/Zend/Gdata/App/FeedSourceParent.php | 29 +- lib/Zend/Gdata/App/HttpException.php | 43 + lib/Zend/Gdata/App/IOException.php | 2 + .../Gdata/App/InvalidArgumentException.php | 2 + .../App/LoggingHttpClientAdapterSocket.php | 4 +- lib/Zend/Gdata/App/MediaEntry.php | 2 + lib/Zend/Gdata/App/MediaFileSource.php | 2 + lib/Zend/Gdata/App/MediaSource.php | 2 + lib/Zend/Gdata/App/Util.php | 51 + lib/Zend/Gdata/App/VersionException.php | 41 + lib/Zend/Gdata/AuthSub.php | 99 +- lib/Zend/Gdata/Books.php | 200 + lib/Zend/Gdata/Books/CollectionEntry.php | 57 + lib/Zend/Gdata/Books/CollectionFeed.php | 63 + .../Gdata/Books/Extension/AnnotationLink.php | 64 + .../Gdata/Books/Extension/BooksCategory.php | 60 + lib/Zend/Gdata/Books/Extension/BooksLink.php | 62 + .../Gdata/Books/Extension/Embeddability.php | 123 + lib/Zend/Gdata/Books/Extension/InfoLink.php | 61 + .../Gdata/Books/Extension/PreviewLink.php | 61 + lib/Zend/Gdata/Books/Extension/Review.php | 153 + .../Gdata/Books/Extension/ThumbnailLink.php | 61 + .../Gdata/Books/Extension/Viewability.php | 124 + lib/Zend/Gdata/Books/VolumeEntry.php | 688 +++ lib/Zend/Gdata/Books/VolumeFeed.php | 63 + lib/Zend/Gdata/Books/VolumeQuery.php | 111 + lib/Zend/Gdata/Calendar.php | 10 +- lib/Zend/Gdata/Calendar/EventEntry.php | 14 +- lib/Zend/Gdata/Calendar/EventFeed.php | 11 +- lib/Zend/Gdata/Calendar/EventQuery.php | 2 + .../Gdata/Calendar/Extension/AccessLevel.php | 10 +- lib/Zend/Gdata/Calendar/Extension/Color.php | 10 +- lib/Zend/Gdata/Calendar/Extension/Hidden.php | 10 +- lib/Zend/Gdata/Calendar/Extension/Link.php | 10 +- .../Gdata/Calendar/Extension/QuickAdd.php | 10 +- .../Gdata/Calendar/Extension/Selected.php | 10 +- .../Extension/SendEventNotifications.php | 10 +- .../Gdata/Calendar/Extension/Timezone.php | 10 +- .../Gdata/Calendar/Extension/WebContent.php | 10 +- lib/Zend/Gdata/Calendar/ListEntry.php | 10 +- lib/Zend/Gdata/Calendar/ListFeed.php | 10 +- lib/Zend/Gdata/ClientLogin.php | 38 +- lib/Zend/Gdata/Docs.php | 2 + lib/Zend/Gdata/Docs/DocumentListEntry.php | 6 +- lib/Zend/Gdata/Docs/DocumentListFeed.php | 6 +- lib/Zend/Gdata/Docs/Query.php | 2 + lib/Zend/Gdata/DublinCore.php | 64 + .../Gdata/DublinCore/Extension/Creator.php | 59 + lib/Zend/Gdata/DublinCore/Extension/Date.php | 61 + .../DublinCore/Extension/Description.php | 59 + .../Gdata/DublinCore/Extension/Format.php | 59 + .../Gdata/DublinCore/Extension/Identifier.php | 59 + .../Gdata/DublinCore/Extension/Language.php | 59 + .../Gdata/DublinCore/Extension/Publisher.php | 59 + .../Gdata/DublinCore/Extension/Rights.php | 59 + .../Gdata/DublinCore/Extension/Subject.php | 59 + lib/Zend/Gdata/DublinCore/Extension/Title.php | 59 + lib/Zend/Gdata/Entry.php | 91 +- lib/Zend/Gdata/Exif.php | 12 +- lib/Zend/Gdata/Exif/Entry.php | 40 +- lib/Zend/Gdata/Exif/Extension/Distance.php | 12 +- lib/Zend/Gdata/Exif/Extension/Exposure.php | 12 +- lib/Zend/Gdata/Exif/Extension/FStop.php | 12 +- lib/Zend/Gdata/Exif/Extension/Flash.php | 12 +- lib/Zend/Gdata/Exif/Extension/FocalLength.php | 12 +- .../Gdata/Exif/Extension/ImageUniqueId.php | 12 +- lib/Zend/Gdata/Exif/Extension/Iso.php | 12 +- lib/Zend/Gdata/Exif/Extension/Make.php | 12 +- lib/Zend/Gdata/Exif/Extension/Model.php | 12 +- lib/Zend/Gdata/Exif/Extension/Tags.php | 122 +- lib/Zend/Gdata/Exif/Extension/Time.php | 12 +- lib/Zend/Gdata/Exif/Feed.php | 10 +- lib/Zend/Gdata/Extension.php | 13 +- lib/Zend/Gdata/Extension/AttendeeStatus.php | 6 +- lib/Zend/Gdata/Extension/AttendeeType.php | 10 +- lib/Zend/Gdata/Extension/Comments.php | 10 +- lib/Zend/Gdata/Extension/EntryLink.php | 14 +- lib/Zend/Gdata/Extension/EventStatus.php | 8 +- lib/Zend/Gdata/Extension/ExtendedProperty.php | 12 +- lib/Zend/Gdata/Extension/FeedLink.php | 16 +- .../Extension/OpenSearchItemsPerPage.php | 2 + .../Gdata/Extension/OpenSearchStartIndex.php | 2 + .../Extension/OpenSearchTotalResults.php | 2 + lib/Zend/Gdata/Extension/OriginalEvent.php | 12 +- lib/Zend/Gdata/Extension/Rating.php | 131 +- lib/Zend/Gdata/Extension/Recurrence.php | 2 + .../Gdata/Extension/RecurrenceException.php | 28 +- lib/Zend/Gdata/Extension/Reminder.php | 16 +- lib/Zend/Gdata/Extension/Transparency.php | 10 +- lib/Zend/Gdata/Extension/Visibility.php | 10 +- lib/Zend/Gdata/Extension/When.php | 14 +- lib/Zend/Gdata/Extension/Where.php | 19 +- lib/Zend/Gdata/Extension/Who.php | 23 +- lib/Zend/Gdata/Feed.php | 89 +- lib/Zend/Gdata/Gapps.php | 376 +- lib/Zend/Gdata/Gapps/EmailListEntry.php | 78 +- lib/Zend/Gdata/Gapps/EmailListFeed.php | 2 + lib/Zend/Gdata/Gapps/EmailListQuery.php | 2 + .../Gdata/Gapps/EmailListRecipientEntry.php | 48 +- .../Gdata/Gapps/EmailListRecipientFeed.php | 2 + .../Gdata/Gapps/EmailListRecipientQuery.php | 2 + lib/Zend/Gdata/Gapps/Error.php | 8 +- lib/Zend/Gdata/Gapps/Extension/EmailList.php | 42 +- lib/Zend/Gdata/Gapps/Extension/Login.php | 140 +- lib/Zend/Gdata/Gapps/Extension/Name.php | 46 +- lib/Zend/Gdata/Gapps/Extension/Nickname.php | 38 +- lib/Zend/Gdata/Gapps/Extension/Quota.php | 40 +- lib/Zend/Gdata/Gapps/NicknameEntry.php | 54 +- lib/Zend/Gdata/Gapps/NicknameFeed.php | 2 + lib/Zend/Gdata/Gapps/NicknameQuery.php | 2 + lib/Zend/Gdata/Gapps/Query.php | 2 + lib/Zend/Gdata/Gapps/ServiceException.php | 2 + lib/Zend/Gdata/Gapps/UserEntry.php | 100 +- lib/Zend/Gdata/Gapps/UserFeed.php | 2 + lib/Zend/Gdata/Gapps/UserQuery.php | 2 + lib/Zend/Gdata/Gbase.php | 408 +- lib/Zend/Gdata/Gbase/Entry.php | 18 +- .../Gdata/Gbase/Extension/BaseAttribute.php | 230 +- lib/Zend/Gdata/Gbase/Feed.php | 8 +- lib/Zend/Gdata/Gbase/ItemEntry.php | 29 +- lib/Zend/Gdata/Gbase/ItemFeed.php | 2 + lib/Zend/Gdata/Gbase/ItemQuery.php | 2 + lib/Zend/Gdata/Gbase/Query.php | 2 + lib/Zend/Gdata/Gbase/SnippetEntry.php | 2 + lib/Zend/Gdata/Gbase/SnippetFeed.php | 2 + lib/Zend/Gdata/Gbase/SnippetQuery.php | 2 + lib/Zend/Gdata/Geo.php | 17 +- lib/Zend/Gdata/Geo/Entry.php | 14 +- lib/Zend/Gdata/Geo/Extension/GeoRssWhere.php | 30 +- lib/Zend/Gdata/Geo/Extension/GmlPoint.php | 30 +- lib/Zend/Gdata/Geo/Extension/GmlPos.php | 12 +- lib/Zend/Gdata/Geo/Feed.php | 6 +- lib/Zend/Gdata/Health.php | 273 ++ lib/Zend/Gdata/Health/Extension/Ccr.php | 125 + lib/Zend/Gdata/Health/ProfileEntry.php | 134 + lib/Zend/Gdata/Health/ProfileFeed.php | 66 + lib/Zend/Gdata/Health/ProfileListEntry.php | 99 + lib/Zend/Gdata/Health/ProfileListFeed.php | 52 + lib/Zend/Gdata/Health/Query.php | 284 ++ lib/Zend/Gdata/HttpClient.php | 240 + lib/Zend/Gdata/Kind/EventEntry.php | 41 +- lib/Zend/Gdata/Media.php | 10 +- lib/Zend/Gdata/Media/Entry.php | 36 +- .../Gdata/Media/Extension/MediaCategory.php | 28 +- .../Gdata/Media/Extension/MediaContent.php | 60 +- .../Gdata/Media/Extension/MediaCopyright.php | 26 +- .../Gdata/Media/Extension/MediaCredit.php | 24 +- .../Media/Extension/MediaDescription.php | 22 +- lib/Zend/Gdata/Media/Extension/MediaGroup.php | 77 +- lib/Zend/Gdata/Media/Extension/MediaHash.php | 24 +- .../Gdata/Media/Extension/MediaKeywords.php | 6 +- .../Gdata/Media/Extension/MediaPlayer.php | 32 +- .../Gdata/Media/Extension/MediaRating.php | 22 +- .../Media/Extension/MediaRestriction.php | 36 +- lib/Zend/Gdata/Media/Extension/MediaText.php | 32 +- .../Gdata/Media/Extension/MediaThumbnail.php | 34 +- lib/Zend/Gdata/Media/Extension/MediaTitle.php | 24 +- lib/Zend/Gdata/Media/Feed.php | 10 +- lib/Zend/Gdata/Photos.php | 132 +- lib/Zend/Gdata/Photos/AlbumEntry.php | 90 +- lib/Zend/Gdata/Photos/AlbumFeed.php | 58 +- lib/Zend/Gdata/Photos/AlbumQuery.php | 2 + lib/Zend/Gdata/Photos/CommentEntry.php | 28 +- lib/Zend/Gdata/Photos/Extension/Access.php | 14 +- lib/Zend/Gdata/Photos/Extension/AlbumId.php | 16 +- lib/Zend/Gdata/Photos/Extension/BytesUsed.php | 12 +- lib/Zend/Gdata/Photos/Extension/Checksum.php | 12 +- lib/Zend/Gdata/Photos/Extension/Client.php | 12 +- .../Gdata/Photos/Extension/CommentCount.php | 16 +- .../Photos/Extension/CommentingEnabled.php | 12 +- lib/Zend/Gdata/Photos/Extension/Height.php | 12 +- lib/Zend/Gdata/Photos/Extension/Id.php | 12 +- lib/Zend/Gdata/Photos/Extension/Location.php | 12 +- .../Photos/Extension/MaxPhotosPerAlbum.php | 12 +- lib/Zend/Gdata/Photos/Extension/Name.php | 14 +- lib/Zend/Gdata/Photos/Extension/Nickname.php | 12 +- lib/Zend/Gdata/Photos/Extension/NumPhotos.php | 12 +- .../Photos/Extension/NumPhotosRemaining.php | 12 +- lib/Zend/Gdata/Photos/Extension/PhotoId.php | 12 +- lib/Zend/Gdata/Photos/Extension/Position.php | 12 +- .../Gdata/Photos/Extension/QuotaCurrent.php | 12 +- .../Gdata/Photos/Extension/QuotaLimit.php | 12 +- lib/Zend/Gdata/Photos/Extension/Rotation.php | 12 +- lib/Zend/Gdata/Photos/Extension/Size.php | 12 +- lib/Zend/Gdata/Photos/Extension/Thumbnail.php | 12 +- lib/Zend/Gdata/Photos/Extension/Timestamp.php | 12 +- lib/Zend/Gdata/Photos/Extension/User.php | 12 +- lib/Zend/Gdata/Photos/Extension/Version.php | 12 +- lib/Zend/Gdata/Photos/Extension/Weight.php | 12 +- lib/Zend/Gdata/Photos/Extension/Width.php | 12 +- lib/Zend/Gdata/Photos/PhotoEntry.php | 86 +- lib/Zend/Gdata/Photos/PhotoFeed.php | 46 +- lib/Zend/Gdata/Photos/PhotoQuery.php | 2 + lib/Zend/Gdata/Photos/TagEntry.php | 24 +- lib/Zend/Gdata/Photos/UserEntry.php | 62 +- lib/Zend/Gdata/Photos/UserFeed.php | 34 +- lib/Zend/Gdata/Photos/UserQuery.php | 2 + lib/Zend/Gdata/Query.php | 6 +- lib/Zend/Gdata/Spreadsheets.php | 197 +- lib/Zend/Gdata/Spreadsheets/CellEntry.php | 10 +- lib/Zend/Gdata/Spreadsheets/CellFeed.php | 10 +- lib/Zend/Gdata/Spreadsheets/CellQuery.php | 116 +- lib/Zend/Gdata/Spreadsheets/DocumentQuery.php | 2 + .../Gdata/Spreadsheets/Extension/Cell.php | 10 +- .../Gdata/Spreadsheets/Extension/ColCount.php | 6 +- .../Gdata/Spreadsheets/Extension/Custom.php | 10 +- .../Gdata/Spreadsheets/Extension/RowCount.php | 6 +- lib/Zend/Gdata/Spreadsheets/ListEntry.php | 16 +- lib/Zend/Gdata/Spreadsheets/ListFeed.php | 6 +- lib/Zend/Gdata/Spreadsheets/ListQuery.php | 2 + .../Gdata/Spreadsheets/SpreadsheetEntry.php | 17 +- .../Gdata/Spreadsheets/SpreadsheetFeed.php | 6 +- .../Gdata/Spreadsheets/WorksheetEntry.php | 70 +- lib/Zend/Gdata/Spreadsheets/WorksheetFeed.php | 6 +- lib/Zend/Gdata/YouTube.php | 190 +- lib/Zend/Gdata/YouTube/CommentEntry.php | 2 + lib/Zend/Gdata/YouTube/CommentFeed.php | 6 +- lib/Zend/Gdata/YouTube/ContactEntry.php | 18 +- lib/Zend/Gdata/YouTube/ContactFeed.php | 6 +- lib/Zend/Gdata/YouTube/Extension/AboutMe.php | 50 + lib/Zend/Gdata/YouTube/Extension/Age.php | 6 +- lib/Zend/Gdata/YouTube/Extension/Books.php | 8 +- lib/Zend/Gdata/YouTube/Extension/Company.php | 6 +- lib/Zend/Gdata/YouTube/Extension/Control.php | 12 +- .../Gdata/YouTube/Extension/CountHint.php | 50 + .../Gdata/YouTube/Extension/Description.php | 6 +- lib/Zend/Gdata/YouTube/Extension/Duration.php | 26 +- .../Gdata/YouTube/Extension/FirstName.php | 50 + lib/Zend/Gdata/YouTube/Extension/Gender.php | 6 +- lib/Zend/Gdata/YouTube/Extension/Hobbies.php | 6 +- lib/Zend/Gdata/YouTube/Extension/Hometown.php | 6 +- lib/Zend/Gdata/YouTube/Extension/LastName.php | 50 + lib/Zend/Gdata/YouTube/Extension/Link.php | 12 +- lib/Zend/Gdata/YouTube/Extension/Location.php | 6 +- .../Gdata/YouTube/Extension/MediaContent.php | 16 +- .../Gdata/YouTube/Extension/MediaCredit.php | 188 + .../Gdata/YouTube/Extension/MediaGroup.php | 230 +- .../Gdata/YouTube/Extension/MediaRating.php | 149 + lib/Zend/Gdata/YouTube/Extension/Movies.php | 6 +- lib/Zend/Gdata/YouTube/Extension/Music.php | 6 +- lib/Zend/Gdata/YouTube/Extension/NoEmbed.php | 10 +- .../Gdata/YouTube/Extension/Occupation.php | 6 +- .../Gdata/YouTube/Extension/PlaylistId.php | 50 + .../Gdata/YouTube/Extension/PlaylistTitle.php | 50 + lib/Zend/Gdata/YouTube/Extension/Position.php | 12 +- lib/Zend/Gdata/YouTube/Extension/Private.php | 80 + .../Gdata/YouTube/Extension/QueryString.php | 50 + lib/Zend/Gdata/YouTube/Extension/Racy.php | 26 +- lib/Zend/Gdata/YouTube/Extension/Recorded.php | 50 + .../Gdata/YouTube/Extension/Relationship.php | 6 +- .../Gdata/YouTube/Extension/ReleaseDate.php | 6 +- lib/Zend/Gdata/YouTube/Extension/School.php | 6 +- lib/Zend/Gdata/YouTube/Extension/State.php | 34 +- .../Gdata/YouTube/Extension/Statistics.php | 28 +- lib/Zend/Gdata/YouTube/Extension/Status.php | 6 +- lib/Zend/Gdata/YouTube/Extension/Token.php | 12 +- lib/Zend/Gdata/YouTube/Extension/Uploaded.php | 50 + lib/Zend/Gdata/YouTube/Extension/Username.php | 6 +- lib/Zend/Gdata/YouTube/Extension/VideoId.php | 50 + lib/Zend/Gdata/YouTube/MediaEntry.php | 6 +- lib/Zend/Gdata/YouTube/PlaylistListEntry.php | 130 +- lib/Zend/Gdata/YouTube/PlaylistListFeed.php | 6 +- lib/Zend/Gdata/YouTube/PlaylistVideoEntry.php | 20 +- lib/Zend/Gdata/YouTube/PlaylistVideoFeed.php | 6 +- lib/Zend/Gdata/YouTube/SubscriptionEntry.php | 310 +- lib/Zend/Gdata/YouTube/SubscriptionFeed.php | 6 +- lib/Zend/Gdata/YouTube/UserProfileEntry.php | 467 +- lib/Zend/Gdata/YouTube/VideoEntry.php | 519 ++- lib/Zend/Gdata/YouTube/VideoFeed.php | 6 +- lib/Zend/Gdata/YouTube/VideoQuery.php | 315 +- lib/Zend/Http/Client.php | 179 +- lib/Zend/Http/Client/Adapter/Proxy.php | 52 +- lib/Zend/Http/Client/Adapter/Socket.php | 110 +- lib/Zend/Http/Client/Adapter/Test.php | 2 +- lib/Zend/Http/Cookie.php | 16 +- lib/Zend/Http/CookieJar.php | 16 +- lib/Zend/Http/Response.php | 14 +- lib/Zend/InfoCard.php | 61 +- lib/Zend/InfoCard/Adapter/Default.php | 9 +- lib/Zend/InfoCard/Adapter/Exception.php | 4 +- lib/Zend/InfoCard/Adapter/Interface.php | 4 +- lib/Zend/InfoCard/Cipher.php | 12 +- lib/Zend/InfoCard/Cipher/Exception.php | 4 +- .../InfoCard/Cipher/Pki/Adapter/Abstract.php | 11 +- lib/Zend/InfoCard/Cipher/Pki/Adapter/Rsa.php | 7 +- lib/Zend/InfoCard/Cipher/Pki/Interface.php | 4 +- .../InfoCard/Cipher/Pki/Rsa/Interface.php | 4 +- .../Cipher/Symmetric/Adapter/Abstract.php | 4 +- .../Cipher/Symmetric/Adapter/Aes128cbc.php | 4 +- .../Cipher/Symmetric/Adapter/Aes256cbc.php | 11 +- .../Cipher/Symmetric/Aes128cbc/Interface.php | 4 +- .../Cipher/Symmetric/Aes256cbc/Interface.php | 4 +- .../InfoCard/Cipher/Symmetric/Interface.php | 4 +- lib/Zend/InfoCard/Claims.php | 15 +- lib/Zend/InfoCard/Exception.php | 4 +- lib/Zend/InfoCard/Xml/Assertion.php | 11 +- lib/Zend/InfoCard/Xml/Assertion/Interface.php | 4 +- lib/Zend/InfoCard/Xml/Assertion/Saml.php | 4 +- lib/Zend/InfoCard/Xml/Element.php | 12 +- lib/Zend/InfoCard/Xml/Element/Interface.php | 4 +- lib/Zend/InfoCard/Xml/EncryptedData.php | 12 +- .../InfoCard/Xml/EncryptedData/Abstract.php | 4 +- .../InfoCard/Xml/EncryptedData/XmlEnc.php | 4 +- lib/Zend/InfoCard/Xml/EncryptedKey.php | 4 +- lib/Zend/InfoCard/Xml/Exception.php | 4 +- lib/Zend/InfoCard/Xml/KeyInfo.php | 4 +- lib/Zend/InfoCard/Xml/KeyInfo/Abstract.php | 4 +- lib/Zend/InfoCard/Xml/KeyInfo/Default.php | 4 +- lib/Zend/InfoCard/Xml/KeyInfo/Interface.php | 4 +- lib/Zend/InfoCard/Xml/KeyInfo/XmlDSig.php | 4 +- lib/Zend/InfoCard/Xml/Security.php | 29 +- lib/Zend/InfoCard/Xml/Security/Exception.php | 4 +- lib/Zend/InfoCard/Xml/Security/Transform.php | 6 +- .../Security/Transform/EnvelopedSignature.php | 10 +- .../Xml/Security/Transform/Exception.php | 4 +- .../Xml/Security/Transform/Interface.php | 4 +- .../Xml/Security/Transform/XmlExcC14N.php | 10 +- .../InfoCard/Xml/SecurityTokenReference.php | 4 +- lib/Zend/Json.php | 292 +- lib/Zend/Json/Decoder.php | 22 +- lib/Zend/Json/Encoder.php | 52 +- lib/Zend/Json/Server.php | 537 +++ lib/Zend/Json/Server/Cache.php | 102 + lib/Zend/Json/Server/Error.php | 197 + lib/Zend/Json/Server/Exception.php | 35 + lib/Zend/Json/Server/Request.php | 288 ++ lib/Zend/Json/Server/Request/Http.php | 65 + lib/Zend/Json/Server/Response.php | 247 ++ lib/Zend/Json/Server/Response/Http.php | 80 + lib/Zend/Json/Server/Smd.php | 479 ++ lib/Zend/Json/Server/Smd/Service.php | 473 ++ lib/Zend/Layout.php | 41 +- .../Controller/Action/Helper/Layout.php | 26 +- lib/Zend/Ldap.php | 172 +- lib/Zend/Loader.php | 15 +- lib/Zend/Loader/Exception.php | 33 +- lib/Zend/Loader/PluginLoader.php | 203 +- lib/Zend/Locale.php | 947 ++-- lib/Zend/Locale/Data.php | 107 +- lib/Zend/Locale/Data/Translation.php | 27 +- lib/Zend/Locale/Data/aa.xml | 11 +- lib/Zend/Locale/Data/aa_DJ.xml | 7 +- lib/Zend/Locale/Data/aa_ER.xml | 7 +- lib/Zend/Locale/Data/aa_ER_SAAHO.xml | 40 - lib/Zend/Locale/Data/aa_ET.xml | 7 +- lib/Zend/Locale/Data/af.xml | 107 +- lib/Zend/Locale/Data/af_NA.xml | 8 +- lib/Zend/Locale/Data/af_ZA.xml | 7 +- lib/Zend/Locale/Data/ak.xml | 6 +- lib/Zend/Locale/Data/ak_GH.xml | 7 +- lib/Zend/Locale/Data/am.xml | 106 +- lib/Zend/Locale/Data/am_ET.xml | 7 +- lib/Zend/Locale/Data/ar.xml | 297 +- lib/Zend/Locale/Data/ar_AE.xml | 7 +- lib/Zend/Locale/Data/ar_BH.xml | 7 +- lib/Zend/Locale/Data/ar_DZ.xml | 7 +- lib/Zend/Locale/Data/ar_EG.xml | 7 +- lib/Zend/Locale/Data/ar_IQ.xml | 7 +- lib/Zend/Locale/Data/ar_JO.xml | 7 +- lib/Zend/Locale/Data/ar_KW.xml | 7 +- lib/Zend/Locale/Data/ar_LB.xml | 6 +- lib/Zend/Locale/Data/ar_LY.xml | 7 +- lib/Zend/Locale/Data/ar_MA.xml | 7 +- lib/Zend/Locale/Data/ar_OM.xml | 7 +- lib/Zend/Locale/Data/ar_QA.xml | 7 +- lib/Zend/Locale/Data/ar_SA.xml | 7 +- lib/Zend/Locale/Data/ar_SD.xml | 7 +- lib/Zend/Locale/Data/ar_SY.xml | 7 +- lib/Zend/Locale/Data/ar_TN.xml | 7 +- lib/Zend/Locale/Data/ar_YE.xml | 7 +- lib/Zend/Locale/Data/as.xml | 51 +- lib/Zend/Locale/Data/as_IN.xml | 7 +- lib/Zend/Locale/Data/az.xml | 2621 ++++++++++- lib/Zend/Locale/Data/az_AZ.xml | 6 +- lib/Zend/Locale/Data/az_Cyrl.xml | 7 +- lib/Zend/Locale/Data/az_Cyrl_AZ.xml | 7 +- lib/Zend/Locale/Data/az_Latn.xml | 7 +- lib/Zend/Locale/Data/az_Latn_AZ.xml | 7 +- lib/Zend/Locale/Data/be.xml | 512 ++- lib/Zend/Locale/Data/be_BY.xml | 7 +- lib/Zend/Locale/Data/bg.xml | 202 +- lib/Zend/Locale/Data/bg_BG.xml | 7 +- lib/Zend/Locale/Data/bn.xml | 2635 ++++++++++- lib/Zend/Locale/Data/bn_BD.xml | 7 +- lib/Zend/Locale/Data/bn_IN.xml | 22 +- lib/Zend/Locale/Data/bo.xml | 506 --- lib/Zend/Locale/Data/bo_CN.xml | 10 - lib/Zend/Locale/Data/bo_IN.xml | 11 - lib/Zend/Locale/Data/bs.xml | 7 +- lib/Zend/Locale/Data/bs_BA.xml | 7 +- lib/Zend/Locale/Data/byn.xml | 7 +- lib/Zend/Locale/Data/byn_ER.xml | 7 +- lib/Zend/Locale/Data/ca.xml | 712 ++- lib/Zend/Locale/Data/ca_ES.xml | 7 +- lib/Zend/Locale/Data/cch.xml | 7 +- lib/Zend/Locale/Data/cch_NG.xml | 7 +- lib/Zend/Locale/Data/characters.xml | 1888 ++++++++ lib/Zend/Locale/Data/cop.xml | 6 +- lib/Zend/Locale/Data/cop_Arab.xml | 23 - lib/Zend/Locale/Data/cop_Arab_EG.xml | 12 - lib/Zend/Locale/Data/cop_Arab_US.xml | 12 - lib/Zend/Locale/Data/cop_EG.xml | 11 - lib/Zend/Locale/Data/cop_US.xml | 11 - lib/Zend/Locale/Data/cs.xml | 280 +- lib/Zend/Locale/Data/cs_CZ.xml | 7 +- lib/Zend/Locale/Data/cy.xml | 245 +- lib/Zend/Locale/Data/cy_GB.xml | 7 +- lib/Zend/Locale/Data/da.xml | 807 +++- lib/Zend/Locale/Data/da_DK.xml | 7 +- lib/Zend/Locale/Data/de.xml | 872 +++- lib/Zend/Locale/Data/de_AT.xml | 31 +- lib/Zend/Locale/Data/de_BE.xml | 54 +- lib/Zend/Locale/Data/de_CH.xml | 8 +- lib/Zend/Locale/Data/de_DE.xml | 7 +- lib/Zend/Locale/Data/de_LI.xml | 8 +- lib/Zend/Locale/Data/de_LU.xml | 7 +- lib/Zend/Locale/Data/dv.xml | 11 +- lib/Zend/Locale/Data/dv_MV.xml | 7 +- lib/Zend/Locale/Data/dz.xml | 9 +- lib/Zend/Locale/Data/dz_BT.xml | 7 +- lib/Zend/Locale/Data/ee.xml | 6 +- lib/Zend/Locale/Data/ee_GH.xml | 7 +- lib/Zend/Locale/Data/ee_TG.xml | 7 +- lib/Zend/Locale/Data/el.xml | 248 +- lib/Zend/Locale/Data/el_CY.xml | 7 +- lib/Zend/Locale/Data/el_GR.xml | 7 +- lib/Zend/Locale/Data/el_POLYTON.xml | 6 +- lib/Zend/Locale/Data/el_POLYTONI.xml | 559 --- lib/Zend/Locale/Data/en.xml | 1445 +++--- lib/Zend/Locale/Data/en_AS.xml | 7 +- lib/Zend/Locale/Data/en_AU.xml | 83 +- lib/Zend/Locale/Data/en_BE.xml | 81 +- lib/Zend/Locale/Data/en_BW.xml | 84 +- lib/Zend/Locale/Data/en_BZ.xml | 92 +- lib/Zend/Locale/Data/en_CA.xml | 85 +- lib/Zend/Locale/Data/en_GB.xml | 78 +- lib/Zend/Locale/Data/en_GU.xml | 7 +- lib/Zend/Locale/Data/en_HK.xml | 84 +- lib/Zend/Locale/Data/en_IE.xml | 76 +- lib/Zend/Locale/Data/en_IN.xml | 85 +- lib/Zend/Locale/Data/en_JM.xml | 7 +- lib/Zend/Locale/Data/en_MH.xml | 7 +- lib/Zend/Locale/Data/en_MP.xml | 7 +- lib/Zend/Locale/Data/en_MT.xml | 79 +- lib/Zend/Locale/Data/en_NA.xml | 7 +- lib/Zend/Locale/Data/en_NZ.xml | 85 +- lib/Zend/Locale/Data/en_PH.xml | 7 +- lib/Zend/Locale/Data/en_PK.xml | 85 +- lib/Zend/Locale/Data/en_SG.xml | 83 +- lib/Zend/Locale/Data/en_Shaw.xml | 186 + lib/Zend/Locale/Data/en_TT.xml | 7 +- lib/Zend/Locale/Data/en_UM.xml | 7 +- lib/Zend/Locale/Data/en_US.xml | 7 +- lib/Zend/Locale/Data/en_US_POSIX.xml | 8 +- lib/Zend/Locale/Data/en_VI.xml | 7 +- lib/Zend/Locale/Data/en_ZA.xml | 86 +- lib/Zend/Locale/Data/en_ZW.xml | 84 +- lib/Zend/Locale/Data/eo.xml | 91 +- lib/Zend/Locale/Data/es.xml | 758 +++- lib/Zend/Locale/Data/es_AR.xml | 103 +- lib/Zend/Locale/Data/es_BO.xml | 7 +- lib/Zend/Locale/Data/es_CL.xml | 84 +- lib/Zend/Locale/Data/es_CO.xml | 82 +- lib/Zend/Locale/Data/es_CR.xml | 14 +- lib/Zend/Locale/Data/es_DO.xml | 7 +- lib/Zend/Locale/Data/es_EC.xml | 82 +- lib/Zend/Locale/Data/es_ES.xml | 101 +- lib/Zend/Locale/Data/es_GT.xml | 82 +- lib/Zend/Locale/Data/es_HN.xml | 82 +- lib/Zend/Locale/Data/es_MX.xml | 7 +- lib/Zend/Locale/Data/es_NI.xml | 7 +- lib/Zend/Locale/Data/es_PA.xml | 80 +- lib/Zend/Locale/Data/es_PE.xml | 81 +- lib/Zend/Locale/Data/es_PR.xml | 82 +- lib/Zend/Locale/Data/es_PY.xml | 8 +- lib/Zend/Locale/Data/es_SV.xml | 7 +- lib/Zend/Locale/Data/es_US.xml | 84 +- lib/Zend/Locale/Data/es_UY.xml | 8 +- lib/Zend/Locale/Data/es_VE.xml | 8 +- lib/Zend/Locale/Data/et.xml | 90 +- lib/Zend/Locale/Data/et_EE.xml | 7 +- lib/Zend/Locale/Data/eu.xml | 8 +- lib/Zend/Locale/Data/eu_ES.xml | 7 +- lib/Zend/Locale/Data/fa.xml | 2040 ++++++++- lib/Zend/Locale/Data/fa_AF.xml | 33 +- lib/Zend/Locale/Data/fa_IR.xml | 6 +- lib/Zend/Locale/Data/fi.xml | 621 ++- lib/Zend/Locale/Data/fi_FI.xml | 7 +- lib/Zend/Locale/Data/fil.xml | 438 +- lib/Zend/Locale/Data/fil_PH.xml | 10 + lib/Zend/Locale/Data/fo.xml | 382 +- lib/Zend/Locale/Data/fo_FO.xml | 7 +- lib/Zend/Locale/Data/fr.xml | 3152 +++++++++++-- lib/Zend/Locale/Data/fr_BE.xml | 74 +- lib/Zend/Locale/Data/fr_CA.xml | 79 +- lib/Zend/Locale/Data/fr_CH.xml | 74 +- lib/Zend/Locale/Data/fr_FR.xml | 7 +- lib/Zend/Locale/Data/fr_LU.xml | 6 +- lib/Zend/Locale/Data/fr_MC.xml | 7 +- lib/Zend/Locale/Data/fr_SN.xml | 10 + lib/Zend/Locale/Data/fur.xml | 281 +- lib/Zend/Locale/Data/fur_IT.xml | 7 +- lib/Zend/Locale/Data/ga.xml | 25 +- lib/Zend/Locale/Data/ga_IE.xml | 7 +- lib/Zend/Locale/Data/gaa.xml | 7 +- lib/Zend/Locale/Data/gaa_GH.xml | 7 +- lib/Zend/Locale/Data/gez.xml | 8 +- lib/Zend/Locale/Data/gez_ER.xml | 7 +- lib/Zend/Locale/Data/gez_ET.xml | 7 +- lib/Zend/Locale/Data/gl.xml | 872 +++- lib/Zend/Locale/Data/gl_ES.xml | 7 +- lib/Zend/Locale/Data/gu.xml | 22 +- lib/Zend/Locale/Data/gu_IN.xml | 7 +- lib/Zend/Locale/Data/gv.xml | 6 +- lib/Zend/Locale/Data/gv_GB.xml | 7 +- lib/Zend/Locale/Data/ha.xml | 124 +- lib/Zend/Locale/Data/ha_Arab.xml | 10 +- lib/Zend/Locale/Data/ha_Arab_NG.xml | 7 +- lib/Zend/Locale/Data/ha_Arab_SD.xml | 11 + lib/Zend/Locale/Data/ha_GH.xml | 7 +- lib/Zend/Locale/Data/ha_Latn.xml | 7 +- lib/Zend/Locale/Data/ha_Latn_GH.xml | 7 +- lib/Zend/Locale/Data/ha_Latn_NE.xml | 7 +- lib/Zend/Locale/Data/ha_Latn_NG.xml | 7 +- lib/Zend/Locale/Data/ha_NE.xml | 7 +- lib/Zend/Locale/Data/ha_NG.xml | 7 +- lib/Zend/Locale/Data/ha_SD.xml | 11 + lib/Zend/Locale/Data/haw.xml | 7 +- lib/Zend/Locale/Data/haw_US.xml | 7 +- lib/Zend/Locale/Data/he.xml | 463 +- lib/Zend/Locale/Data/he_IL.xml | 7 +- lib/Zend/Locale/Data/hi.xml | 1574 ++++++- lib/Zend/Locale/Data/hi_IN.xml | 7 +- lib/Zend/Locale/Data/hr.xml | 195 +- lib/Zend/Locale/Data/hr_HR.xml | 6 +- lib/Zend/Locale/Data/hu.xml | 1573 +++---- lib/Zend/Locale/Data/hu_HU.xml | 7 +- lib/Zend/Locale/Data/hy.xml | 86 +- lib/Zend/Locale/Data/hy_AM.xml | 7 +- lib/Zend/Locale/Data/hy_AM_REVISED.xml | 6 +- lib/Zend/Locale/Data/ia.xml | 7 +- lib/Zend/Locale/Data/id.xml | 6 +- lib/Zend/Locale/Data/id_ID.xml | 7 +- lib/Zend/Locale/Data/ig.xml | 9 +- lib/Zend/Locale/Data/ig_NG.xml | 7 +- lib/Zend/Locale/Data/ii.xml | 7 +- lib/Zend/Locale/Data/ii_CN.xml | 7 +- lib/Zend/Locale/Data/in.xml | 10 + lib/Zend/Locale/Data/is.xml | 414 +- lib/Zend/Locale/Data/is_IS.xml | 7 +- lib/Zend/Locale/Data/it.xml | 746 ++-- lib/Zend/Locale/Data/it_CH.xml | 51 +- lib/Zend/Locale/Data/it_IT.xml | 7 +- lib/Zend/Locale/Data/iu.xml | 7 +- lib/Zend/Locale/Data/iw.xml | 10 + lib/Zend/Locale/Data/ja.xml | 843 ++-- lib/Zend/Locale/Data/ja_JP.xml | 7 +- lib/Zend/Locale/Data/ka.xml | 594 ++- lib/Zend/Locale/Data/ka_GE.xml | 7 +- lib/Zend/Locale/Data/kaj.xml | 7 +- lib/Zend/Locale/Data/kaj_NG.xml | 7 +- lib/Zend/Locale/Data/kam.xml | 7 +- lib/Zend/Locale/Data/kam_KE.xml | 7 +- lib/Zend/Locale/Data/kcg.xml | 7 +- lib/Zend/Locale/Data/kcg_NG.xml | 7 +- lib/Zend/Locale/Data/kfo.xml | 7 +- lib/Zend/Locale/Data/kfo_CI.xml | 10 + lib/Zend/Locale/Data/kfo_NG.xml | 11 - lib/Zend/Locale/Data/kk.xml | 85 +- lib/Zend/Locale/Data/kk_Cyrl.xml | 10 + lib/Zend/Locale/Data/kk_Cyrl_KZ.xml | 11 + lib/Zend/Locale/Data/kk_KZ.xml | 8 +- lib/Zend/Locale/Data/kl.xml | 8 +- lib/Zend/Locale/Data/kl_GL.xml | 7 +- lib/Zend/Locale/Data/km.xml | 83 +- lib/Zend/Locale/Data/km_KH.xml | 7 +- lib/Zend/Locale/Data/kn.xml | 153 +- lib/Zend/Locale/Data/kn_IN.xml | 7 +- lib/Zend/Locale/Data/ko.xml | 1371 +++++- lib/Zend/Locale/Data/ko_KR.xml | 7 +- lib/Zend/Locale/Data/kok.xml | 11 +- lib/Zend/Locale/Data/kok_IN.xml | 7 +- lib/Zend/Locale/Data/kpe.xml | 6 +- lib/Zend/Locale/Data/kpe_GN.xml | 7 +- lib/Zend/Locale/Data/kpe_LR.xml | 7 +- lib/Zend/Locale/Data/ku.xml | 342 +- lib/Zend/Locale/Data/ku_Arab.xml | 118 +- lib/Zend/Locale/Data/ku_IQ.xml | 12 - lib/Zend/Locale/Data/ku_IR.xml | 12 - lib/Zend/Locale/Data/ku_Latn.xml | 182 +- lib/Zend/Locale/Data/ku_Latn_IQ.xml | 12 - lib/Zend/Locale/Data/ku_Latn_IR.xml | 12 - lib/Zend/Locale/Data/ku_Latn_SY.xml | 12 - lib/Zend/Locale/Data/ku_Latn_TR.xml | 7 +- lib/Zend/Locale/Data/ku_SY.xml | 12 - lib/Zend/Locale/Data/ku_TR.xml | 7 +- lib/Zend/Locale/Data/kw.xml | 6 +- lib/Zend/Locale/Data/kw_GB.xml | 7 +- lib/Zend/Locale/Data/ky.xml | 7 +- lib/Zend/Locale/Data/ky_KG.xml | 7 +- lib/Zend/Locale/Data/ln.xml | 93 +- lib/Zend/Locale/Data/ln_CD.xml | 7 +- lib/Zend/Locale/Data/ln_CG.xml | 7 +- lib/Zend/Locale/Data/lo.xml | 6 +- lib/Zend/Locale/Data/lo_LA.xml | 7 +- lib/Zend/Locale/Data/lt.xml | 1282 +++++- lib/Zend/Locale/Data/lt_LT.xml | 7 +- lib/Zend/Locale/Data/lv.xml | 3944 ++++++++++------- lib/Zend/Locale/Data/lv_LV.xml | 7 +- lib/Zend/Locale/Data/mk.xml | 83 +- lib/Zend/Locale/Data/mk_MK.xml | 7 +- lib/Zend/Locale/Data/ml.xml | 3941 +++++++++++++++- lib/Zend/Locale/Data/ml_IN.xml | 7 +- lib/Zend/Locale/Data/mn.xml | 6 +- lib/Zend/Locale/Data/mn_CN.xml | 11 + lib/Zend/Locale/Data/mn_Cyrl.xml | 10 + lib/Zend/Locale/Data/mn_Cyrl_MN.xml | 11 + lib/Zend/Locale/Data/mn_MN.xml | 8 +- lib/Zend/Locale/Data/mn_Mong.xml | 17 + lib/Zend/Locale/Data/mn_Mong_CN.xml | 11 + lib/Zend/Locale/Data/mo.xml | 10 + lib/Zend/Locale/Data/mr.xml | 15 +- lib/Zend/Locale/Data/mr_IN.xml | 7 +- lib/Zend/Locale/Data/ms.xml | 110 +- lib/Zend/Locale/Data/ms_BN.xml | 74 +- lib/Zend/Locale/Data/ms_MY.xml | 7 +- lib/Zend/Locale/Data/mt.xml | 84 +- lib/Zend/Locale/Data/mt_MT.xml | 6 +- lib/Zend/Locale/Data/my.xml | 1561 ++++++- lib/Zend/Locale/Data/my_MM.xml | 6 +- lib/Zend/Locale/Data/nb.xml | 491 +- lib/Zend/Locale/Data/nb_NO.xml | 6 +- lib/Zend/Locale/Data/ne.xml | 1160 ++++- lib/Zend/Locale/Data/ne_IN.xml | 10 + lib/Zend/Locale/Data/ne_NP.xml | 6 +- lib/Zend/Locale/Data/nl.xml | 1648 ++++++- lib/Zend/Locale/Data/nl_BE.xml | 37 +- lib/Zend/Locale/Data/nl_NL.xml | 6 +- lib/Zend/Locale/Data/nn.xml | 288 +- lib/Zend/Locale/Data/nn_NO.xml | 6 +- lib/Zend/Locale/Data/no.xml | 10 + lib/Zend/Locale/Data/nr.xml | 38 +- lib/Zend/Locale/Data/nr_ZA.xml | 6 +- lib/Zend/Locale/Data/nso.xml | 43 +- lib/Zend/Locale/Data/nso_ZA.xml | 6 +- lib/Zend/Locale/Data/ny.xml | 6 +- lib/Zend/Locale/Data/ny_MW.xml | 6 +- lib/Zend/Locale/Data/om.xml | 6 +- lib/Zend/Locale/Data/om_ET.xml | 6 +- lib/Zend/Locale/Data/om_KE.xml | 6 +- lib/Zend/Locale/Data/or.xml | 51 +- lib/Zend/Locale/Data/or_IN.xml | 6 +- lib/Zend/Locale/Data/pa.xml | 27 +- lib/Zend/Locale/Data/pa_Arab.xml | 16 +- lib/Zend/Locale/Data/pa_Arab_PK.xml | 6 +- lib/Zend/Locale/Data/pa_Guru.xml | 6 +- lib/Zend/Locale/Data/pa_Guru_IN.xml | 6 +- lib/Zend/Locale/Data/pa_IN.xml | 6 +- lib/Zend/Locale/Data/pa_PK.xml | 6 +- lib/Zend/Locale/Data/pl.xml | 1155 +++-- lib/Zend/Locale/Data/pl_PL.xml | 6 +- lib/Zend/Locale/Data/plurals.xml | 76 + lib/Zend/Locale/Data/ps.xml | 9 +- lib/Zend/Locale/Data/ps_AF.xml | 6 +- lib/Zend/Locale/Data/pt.xml | 1763 ++++++-- lib/Zend/Locale/Data/pt_BR.xml | 6 +- lib/Zend/Locale/Data/pt_PT.xml | 1551 ++++++- lib/Zend/Locale/Data/ro.xml | 170 +- lib/Zend/Locale/Data/ro_MD.xml | 10 + lib/Zend/Locale/Data/ro_RO.xml | 6 +- lib/Zend/Locale/Data/root.xml | 1344 +++++- lib/Zend/Locale/Data/ru.xml | 869 +++- lib/Zend/Locale/Data/ru_RU.xml | 6 +- lib/Zend/Locale/Data/ru_UA.xml | 55 +- lib/Zend/Locale/Data/rw.xml | 7 +- lib/Zend/Locale/Data/rw_RW.xml | 6 +- lib/Zend/Locale/Data/sa.xml | 40 +- lib/Zend/Locale/Data/sa_IN.xml | 6 +- lib/Zend/Locale/Data/se.xml | 107 +- lib/Zend/Locale/Data/se_FI.xml | 16 +- lib/Zend/Locale/Data/se_NO.xml | 6 +- lib/Zend/Locale/Data/sh.xml | 6 +- lib/Zend/Locale/Data/sh_BA.xml | 6 +- lib/Zend/Locale/Data/sh_CS.xml | 6 +- lib/Zend/Locale/Data/sh_YU.xml | 6 +- lib/Zend/Locale/Data/si.xml | 239 + lib/Zend/Locale/Data/si_LK.xml | 10 + lib/Zend/Locale/Data/sid.xml | 7 +- lib/Zend/Locale/Data/sid_ET.xml | 6 +- lib/Zend/Locale/Data/sk.xml | 305 +- lib/Zend/Locale/Data/sk_SK.xml | 6 +- lib/Zend/Locale/Data/sl.xml | 231 +- lib/Zend/Locale/Data/sl_SI.xml | 6 +- lib/Zend/Locale/Data/so.xml | 83 +- lib/Zend/Locale/Data/so_DJ.xml | 6 +- lib/Zend/Locale/Data/so_ET.xml | 6 +- lib/Zend/Locale/Data/so_KE.xml | 6 +- lib/Zend/Locale/Data/so_SO.xml | 6 +- lib/Zend/Locale/Data/sq.xml | 160 +- lib/Zend/Locale/Data/sq_AL.xml | 6 +- lib/Zend/Locale/Data/sr.xml | 578 ++- lib/Zend/Locale/Data/sr_BA.xml | 6 +- lib/Zend/Locale/Data/sr_CS.xml | 6 +- lib/Zend/Locale/Data/sr_Cyrl.xml | 7 +- lib/Zend/Locale/Data/sr_Cyrl_BA.xml | 32 +- lib/Zend/Locale/Data/sr_Cyrl_CS.xml | 6 +- lib/Zend/Locale/Data/sr_Cyrl_ME.xml | 6 +- lib/Zend/Locale/Data/sr_Cyrl_RS.xml | 6 +- lib/Zend/Locale/Data/sr_Cyrl_YU.xml | 6 +- lib/Zend/Locale/Data/sr_Latn.xml | 56 +- lib/Zend/Locale/Data/sr_Latn_BA.xml | 6 +- lib/Zend/Locale/Data/sr_Latn_CS.xml | 6 +- lib/Zend/Locale/Data/sr_Latn_ME.xml | 36 +- lib/Zend/Locale/Data/sr_Latn_RS.xml | 35 +- lib/Zend/Locale/Data/sr_Latn_YU.xml | 6 +- lib/Zend/Locale/Data/sr_ME.xml | 6 +- lib/Zend/Locale/Data/sr_RS.xml | 6 +- lib/Zend/Locale/Data/sr_YU.xml | 6 +- lib/Zend/Locale/Data/ss.xml | 38 +- lib/Zend/Locale/Data/ss_SZ.xml | 10 + lib/Zend/Locale/Data/ss_ZA.xml | 6 +- lib/Zend/Locale/Data/ssy.xml | 38 - lib/Zend/Locale/Data/st.xml | 42 +- lib/Zend/Locale/Data/st_LS.xml | 10 + lib/Zend/Locale/Data/st_ZA.xml | 6 +- lib/Zend/Locale/Data/supplementalData.xml | 1230 ++--- lib/Zend/Locale/Data/sv.xml | 1613 ++++++- lib/Zend/Locale/Data/sv_FI.xml | 123 +- lib/Zend/Locale/Data/sv_SE.xml | 6 +- lib/Zend/Locale/Data/sw.xml | 13 +- lib/Zend/Locale/Data/sw_KE.xml | 6 +- lib/Zend/Locale/Data/sw_TZ.xml | 6 +- lib/Zend/Locale/Data/syr.xml | 37 +- lib/Zend/Locale/Data/syr_SY.xml | 6 +- lib/Zend/Locale/Data/ta.xml | 92 +- lib/Zend/Locale/Data/ta_IN.xml | 6 +- lib/Zend/Locale/Data/te.xml | 11 +- lib/Zend/Locale/Data/te_IN.xml | 6 +- lib/Zend/Locale/Data/telephoneCodeData.xml | 747 ++++ lib/Zend/Locale/Data/tg.xml | 6 +- lib/Zend/Locale/Data/tg_Cyrl.xml | 10 + lib/Zend/Locale/Data/tg_Cyrl_TJ.xml | 11 + lib/Zend/Locale/Data/tg_TJ.xml | 7 +- lib/Zend/Locale/Data/th.xml | 522 ++- lib/Zend/Locale/Data/th_TH.xml | 6 +- lib/Zend/Locale/Data/ti.xml | 7 +- lib/Zend/Locale/Data/ti_ER.xml | 58 +- lib/Zend/Locale/Data/ti_ET.xml | 6 +- lib/Zend/Locale/Data/tig.xml | 7 +- lib/Zend/Locale/Data/tig_ER.xml | 6 +- lib/Zend/Locale/Data/tl.xml | 10 + lib/Zend/Locale/Data/tn.xml | 39 +- lib/Zend/Locale/Data/tn_ZA.xml | 6 +- lib/Zend/Locale/Data/to.xml | 246 +- lib/Zend/Locale/Data/to_TO.xml | 6 +- lib/Zend/Locale/Data/tr.xml | 877 ++-- lib/Zend/Locale/Data/tr_TR.xml | 6 +- lib/Zend/Locale/Data/ts.xml | 38 +- lib/Zend/Locale/Data/ts_ZA.xml | 6 +- lib/Zend/Locale/Data/tt.xml | 7 +- lib/Zend/Locale/Data/tt_RU.xml | 6 +- lib/Zend/Locale/Data/ug.xml | 9 +- lib/Zend/Locale/Data/ug_Arab.xml | 11 + lib/Zend/Locale/Data/ug_Arab_CN.xml | 11 + lib/Zend/Locale/Data/ug_CN.xml | 11 + lib/Zend/Locale/Data/uk.xml | 664 ++- lib/Zend/Locale/Data/uk_UA.xml | 6 +- lib/Zend/Locale/Data/und.xml | 9 - lib/Zend/Locale/Data/und_ZZ.xml | 10 - lib/Zend/Locale/Data/ur.xml | 307 +- lib/Zend/Locale/Data/ur_IN.xml | 30 +- lib/Zend/Locale/Data/ur_PK.xml | 6 +- lib/Zend/Locale/Data/uz.xml | 10 +- lib/Zend/Locale/Data/uz_AF.xml | 6 +- lib/Zend/Locale/Data/uz_Arab.xml | 11 +- lib/Zend/Locale/Data/uz_Arab_AF.xml | 6 +- lib/Zend/Locale/Data/uz_Cyrl.xml | 6 +- lib/Zend/Locale/Data/uz_Cyrl_UZ.xml | 6 +- lib/Zend/Locale/Data/uz_Latn.xml | 6 +- lib/Zend/Locale/Data/uz_Latn_UZ.xml | 6 +- lib/Zend/Locale/Data/uz_UZ.xml | 6 +- lib/Zend/Locale/Data/ve.xml | 38 +- lib/Zend/Locale/Data/ve_ZA.xml | 6 +- lib/Zend/Locale/Data/vi.xml | 352 +- lib/Zend/Locale/Data/vi_VN.xml | 6 +- lib/Zend/Locale/Data/wal.xml | 7 +- lib/Zend/Locale/Data/wal_ET.xml | 6 +- lib/Zend/Locale/Data/wo.xml | 7 +- lib/Zend/Locale/Data/wo_Arab.xml | 10 - lib/Zend/Locale/Data/wo_Arab_SN.xml | 11 - lib/Zend/Locale/Data/wo_Latn.xml | 6 +- lib/Zend/Locale/Data/wo_Latn_SN.xml | 6 +- lib/Zend/Locale/Data/wo_SN.xml | 6 +- lib/Zend/Locale/Data/xh.xml | 37 +- lib/Zend/Locale/Data/xh_ZA.xml | 6 +- lib/Zend/Locale/Data/yo.xml | 117 +- lib/Zend/Locale/Data/yo_NG.xml | 6 +- lib/Zend/Locale/Data/zh.xml | 979 ++-- lib/Zend/Locale/Data/zh_CN.xml | 6 +- lib/Zend/Locale/Data/zh_HK.xml | 6 +- lib/Zend/Locale/Data/zh_Hans.xml | 7 +- lib/Zend/Locale/Data/zh_Hans_CN.xml | 6 +- lib/Zend/Locale/Data/zh_Hans_HK.xml | 11 + lib/Zend/Locale/Data/zh_Hans_MO.xml | 11 + lib/Zend/Locale/Data/zh_Hans_SG.xml | 79 +- lib/Zend/Locale/Data/zh_Hant.xml | 806 ++-- lib/Zend/Locale/Data/zh_Hant_HK.xml | 139 +- lib/Zend/Locale/Data/zh_Hant_MO.xml | 71 +- lib/Zend/Locale/Data/zh_Hant_TW.xml | 6 +- lib/Zend/Locale/Data/zh_MO.xml | 6 +- lib/Zend/Locale/Data/zh_SG.xml | 6 +- lib/Zend/Locale/Data/zh_TW.xml | 6 +- lib/Zend/Locale/Data/zu.xml | 133 +- lib/Zend/Locale/Data/zu_ZA.xml | 6 +- lib/Zend/Locale/Format.php | 231 +- lib/Zend/Locale/Math/PhpMath.php | 148 +- lib/Zend/Log.php | 22 +- lib/Zend/Log/Formatter/Simple.php | 16 +- lib/Zend/Log/Formatter/Xml.php | 7 +- lib/Zend/Log/Writer/Abstract.php | 7 +- lib/Zend/Log/Writer/Firebug.php | 187 + lib/Zend/Mail.php | 41 +- lib/Zend/Mail/Message.php | 16 +- lib/Zend/Mail/Message/File.php | 14 +- lib/Zend/Mail/Message/Interface.php | 14 +- lib/Zend/Mail/Part.php | 23 +- lib/Zend/Mail/Part/File.php | 166 +- lib/Zend/Mail/Part/Interface.php | 14 +- lib/Zend/Mail/Protocol/Abstract.php | 6 +- lib/Zend/Mail/Protocol/Imap.php | 42 +- lib/Zend/Mail/Protocol/Pop3.php | 32 +- lib/Zend/Mail/Protocol/Smtp.php | 4 +- lib/Zend/Mail/Storage.php | 16 +- lib/Zend/Mail/Storage/Abstract.php | 16 +- lib/Zend/Mail/Storage/Folder.php | 16 +- lib/Zend/Mail/Storage/Folder/Interface.php | 16 +- lib/Zend/Mail/Storage/Folder/Maildir.php | 16 +- lib/Zend/Mail/Storage/Folder/Mbox.php | 16 +- lib/Zend/Mail/Storage/Imap.php | 46 +- lib/Zend/Mail/Storage/Maildir.php | 105 +- lib/Zend/Mail/Storage/Mbox.php | 30 +- lib/Zend/Mail/Storage/Pop3.php | 16 +- lib/Zend/Mail/Storage/Writable/Interface.php | 16 +- lib/Zend/Mail/Storage/Writable/Maildir.php | 551 ++- lib/Zend/Mail/Transport/Smtp.php | 4 +- lib/Zend/Measure/Abstract.php | 150 +- lib/Zend/Measure/Acceleration.php | 62 +- lib/Zend/Measure/Angle.php | 23 +- lib/Zend/Measure/Area.php | 275 +- lib/Zend/Measure/Binary.php | 96 +- lib/Zend/Measure/Capacitance.php | 71 +- lib/Zend/Measure/Cooking/Volume.php | 23 +- lib/Zend/Measure/Cooking/Weight.php | 23 +- lib/Zend/Measure/Current.php | 23 +- lib/Zend/Measure/Density.php | 171 +- lib/Zend/Measure/Energy.php | 223 +- lib/Zend/Measure/Exception.php | 22 +- lib/Zend/Measure/Flow/Mass.php | 23 +- lib/Zend/Measure/Flow/Mole.php | 23 +- lib/Zend/Measure/Flow/Volume.php | 361 +- lib/Zend/Measure/Force.php | 25 +- lib/Zend/Measure/Frequency.php | 23 +- lib/Zend/Measure/Illumination.php | 43 +- lib/Zend/Measure/Length.php | 645 +-- lib/Zend/Measure/Lightness.php | 53 +- lib/Zend/Measure/Number.php | 260 +- lib/Zend/Measure/Power.php | 159 +- lib/Zend/Measure/Pressure.php | 209 +- lib/Zend/Measure/Speed.php | 161 +- lib/Zend/Measure/Temperature.php | 23 +- lib/Zend/Measure/Time.php | 117 + lib/Zend/Measure/Torque.php | 23 +- lib/Zend/Measure/Viscosity/Dynamic.php | 87 +- lib/Zend/Measure/Viscosity/Kinematic.php | 77 +- lib/Zend/Measure/Volume.php | 26 +- lib/Zend/Measure/Weight.php | 451 +- lib/Zend/Memory.php | 5 +- lib/Zend/Memory/Container.php | 4 - lib/Zend/Memory/Container/Locked.php | 4 - lib/Zend/Memory/Container/Movable.php | 7 +- lib/Zend/Memory/Manager.php | 1 + lib/Zend/Mime.php | 2 +- lib/Zend/Mime/Decode.php | 17 +- lib/Zend/Mime/Message.php | 10 +- lib/Zend/Mime/Part.php | 18 +- lib/Zend/OpenId.php | 77 +- lib/Zend/OpenId/Consumer.php | 301 +- lib/Zend/OpenId/Consumer/Storage.php | 5 +- lib/Zend/OpenId/Consumer/Storage/File.php | 47 +- lib/Zend/OpenId/Provider.php | 63 +- lib/Zend/Paginator.php | 1005 +++++ lib/Zend/Paginator/Adapter/Array.php | 81 + lib/Zend/Paginator/Adapter/DbSelect.php | 203 + lib/Zend/Paginator/Adapter/DbTableSelect.php | 48 + lib/Zend/Paginator/Adapter/Interface.php | 47 + lib/Zend/Paginator/Adapter/Iterator.php | 95 + lib/Zend/Paginator/Adapter/Null.php | 73 + lib/Zend/Paginator/Exception.php | 35 + lib/Zend/Paginator/ScrollingStyle/All.php | 50 + lib/Zend/Paginator/ScrollingStyle/Elastic.php | 61 + .../Paginator/ScrollingStyle/Interface.php | 38 + lib/Zend/Paginator/ScrollingStyle/Jumping.php | 63 + lib/Zend/Paginator/ScrollingStyle/Sliding.php | 78 + lib/Zend/Pdf.php | 279 +- lib/Zend/Pdf/Cmap.php | 36 +- lib/Zend/Pdf/Cmap/ByteEncoding.php | 32 +- lib/Zend/Pdf/Cmap/SegmentToDelta.php | 84 +- lib/Zend/Pdf/Cmap/TrimmedTable.php | 44 +- lib/Zend/Pdf/Color/Cmyk.php | 5 - lib/Zend/Pdf/Color/GrayScale.php | 5 - lib/Zend/Pdf/Color/Html.php | 6 +- lib/Zend/Pdf/Color/Rgb.php | 5 - lib/Zend/Pdf/Const.php | 53 - lib/Zend/Pdf/Element.php | 43 + lib/Zend/Pdf/Element/Array.php | 16 + lib/Zend/Pdf/Element/Dictionary.php | 19 + lib/Zend/Pdf/Element/Object.php | 10 + lib/Zend/Pdf/Element/Reference.php | 14 + lib/Zend/Pdf/Element/String.php | 8 +- lib/Zend/Pdf/FileParser.php | 11 +- lib/Zend/Pdf/FileParser/Font.php | 2 +- lib/Zend/Pdf/FileParser/Font/OpenType.php | 64 +- lib/Zend/Pdf/FileParserDataSource.php | 7 +- lib/Zend/Pdf/Filter/Interface.php | 5 - lib/Zend/Pdf/Font.php | 110 +- lib/Zend/Pdf/Page.php | 555 ++- lib/Zend/Pdf/PhpArray.php | 22 +- lib/Zend/Pdf/Resource.php | 4 +- lib/Zend/Pdf/Resource/Font.php | 156 +- lib/Zend/Pdf/Resource/Font/CidFont.php | 886 ++-- .../Pdf/Resource/Font/CidFont/TrueType.php | 60 +- lib/Zend/Pdf/Resource/Font/Extracted.php | 444 +- lib/Zend/Pdf/Resource/Font/FontDescriptor.php | 98 +- lib/Zend/Pdf/Resource/Font/Simple.php | 454 +- lib/Zend/Pdf/Resource/Font/Simple/Parsed.php | 48 +- .../Resource/Font/Simple/Parsed/TrueType.php | 12 +- .../Pdf/Resource/Font/Simple/Standard.php | 8 +- .../Font/Simple/Standard/CourierBold.php | 4 +- .../Simple/Standard/CourierBoldOblique.php | 4 +- .../Font/Simple/Standard/CourierOblique.php | 4 +- .../Font/Simple/Standard/Helvetica.php | 4 +- .../Font/Simple/Standard/HelveticaBold.php | 4 +- .../Simple/Standard/HelveticaBoldOblique.php | 4 +- .../Font/Simple/Standard/HelveticaOblique.php | 4 +- .../Resource/Font/Simple/Standard/Symbol.php | 6 +- .../Font/Simple/Standard/TimesBold.php | 4 +- .../Font/Simple/Standard/TimesBoldItalic.php | 4 +- .../Font/Simple/Standard/TimesItalic.php | 4 +- .../Font/Simple/Standard/TimesRoman.php | 4 +- .../Font/Simple/Standard/ZapfDingbats.php | 6 +- lib/Zend/Pdf/Resource/Font/Type0.php | 428 +- lib/Zend/Pdf/Resource/Image/Jpeg.php | 8 +- lib/Zend/Pdf/Resource/Image/Png.php | 14 +- lib/Zend/Pdf/Resource/Image/Tiff.php | 23 +- lib/Zend/Pdf/Trailer/Generator.php | 3 - lib/Zend/ProgressBar.php | 205 + lib/Zend/ProgressBar/Adapter.php | 113 + lib/Zend/ProgressBar/Adapter/Console.php | 481 ++ lib/Zend/ProgressBar/Adapter/Exception.php | 38 + lib/Zend/ProgressBar/Adapter/JsPull.php | 117 + lib/Zend/ProgressBar/Adapter/JsPush.php | 148 + lib/Zend/ProgressBar/Exception.php | 38 + lib/Zend/Registry.php | 14 +- lib/Zend/Rest/Client.php | 15 +- lib/Zend/Rest/Client/Result.php | 23 + lib/Zend/Rest/Client/Result/Exception.php | 27 + lib/Zend/Rest/Server.php | 193 +- lib/Zend/Rest/Server/Exception.php | 14 +- lib/Zend/Search/Lucene.php | 287 +- lib/Zend/Search/Lucene/Analysis/Analyzer.php | 12 +- .../Lucene/Analysis/Analyzer/Common/Text.php | 4 +- .../Analysis/Analyzer/Common/TextNum.php | 4 +- .../Lucene/Analysis/Analyzer/Common/Utf8.php | 88 +- .../Analyzer/Common/Utf8/CaseInsensitive.php | 16 +- .../Analysis/Analyzer/Common/Utf8Num.php | 174 +- .../Common/Utf8Num/CaseInsensitive.php | 4 +- .../Analysis/TokenFilter/LowerCaseUtf8.php | 24 +- .../Lucene/Analysis/TokenFilter/StopWords.php | 6 +- lib/Zend/Search/Lucene/Document.php | 15 +- lib/Zend/Search/Lucene/Document/Docx.php | 122 + lib/Zend/Search/Lucene/Document/Html.php | 41 +- lib/Zend/Search/Lucene/Document/OpenXml.php | 131 + lib/Zend/Search/Lucene/Document/Pptx.php | 192 + lib/Zend/Search/Lucene/Document/Xlsx.php | 255 ++ lib/Zend/Search/Lucene/FSM.php | 19 +- lib/Zend/Search/Lucene/Field.php | 81 +- .../Search/Lucene/Index/DictionaryLoader.php | 19 +- lib/Zend/Search/Lucene/Index/DocsFilter.php | 58 + lib/Zend/Search/Lucene/Index/FieldInfo.php | 6 +- lib/Zend/Search/Lucene/Index/SegmentInfo.php | 742 +++- .../Lucene/Index/SegmentInfoPriorityQueue.php | 5 - .../Search/Lucene/Index/SegmentMerger.php | 7 +- .../Search/Lucene/Index/SegmentWriter.php | 32 +- .../Index/SegmentWriter/DocumentWriter.php | 7 +- .../Index/SegmentWriter/StreamWriter.php | 6 +- lib/Zend/Search/Lucene/Index/Term.php | 70 +- lib/Zend/Search/Lucene/Index/Writer.php | 641 +-- lib/Zend/Search/Lucene/Interface.php | 58 +- lib/Zend/Search/Lucene/LockManager.php | 291 +- lib/Zend/Search/Lucene/Proxy.php | 79 +- .../Search/BooleanExpressionRecognizer.php | 5 +- lib/Zend/Search/Lucene/Search/Query.php | 6 +- .../Search/Lucene/Search/Query/Boolean.php | 155 +- lib/Zend/Search/Lucene/Search/Query/Empty.php | 3 +- lib/Zend/Search/Lucene/Search/Query/Fuzzy.php | 341 +- .../Lucene/Search/Query/Insignificant.php | 3 +- .../Search/Lucene/Search/Query/MultiTerm.php | 199 +- .../Search/Lucene/Search/Query/Phrase.php | 89 +- lib/Zend/Search/Lucene/Search/Query/Range.php | 17 +- lib/Zend/Search/Lucene/Search/Query/Term.php | 7 +- .../Search/Lucene/Search/Query/Wildcard.php | 3 +- lib/Zend/Search/Lucene/Search/QueryEntry.php | 9 - .../Lucene/Search/QueryEntry/Phrase.php | 10 +- .../Lucene/Search/QueryEntry/Subquery.php | 9 +- .../Search/Lucene/Search/QueryEntry/Term.php | 50 +- lib/Zend/Search/Lucene/Search/QueryLexer.php | 17 +- lib/Zend/Search/Lucene/Search/QueryParser.php | 205 +- .../Lucene/Search/QueryParserContext.php | 17 +- lib/Zend/Search/Lucene/Search/QueryToken.php | 8 +- lib/Zend/Search/Lucene/Storage/Directory.php | 20 +- .../Lucene/Storage/Directory/Filesystem.php | 15 +- lib/Zend/Search/Lucene/Storage/File.php | 77 +- .../Search/Lucene/Storage/File/Filesystem.php | 9 +- .../Search/Lucene/Storage/File/Memory.php | 76 +- lib/Zend/Server/Abstract.php | 204 +- lib/Zend/Server/Cache.php | 147 + lib/Zend/Server/Definition.php | 267 ++ lib/Zend/Server/Method/Callback.php | 205 + lib/Zend/Server/Method/Definition.php | 293 ++ lib/Zend/Server/Method/Parameter.php | 214 + lib/Zend/Server/Method/Prototype.php | 208 + lib/Zend/Server/Reflection.php | 13 +- lib/Zend/Server/Reflection/Class.php | 11 +- lib/Zend/Server/Reflection/Exception.php | 4 +- lib/Zend/Server/Reflection/Function.php | 4 +- .../Server/Reflection/Function/Abstract.php | 19 +- lib/Zend/Server/Reflection/Method.php | 4 +- lib/Zend/Server/Reflection/Node.php | 4 +- lib/Zend/Server/Reflection/Parameter.php | 12 +- lib/Zend/Server/Reflection/Prototype.php | 11 +- lib/Zend/Server/Reflection/ReturnValue.php | 11 +- lib/Zend/Service/Amazon/Accessories.php | 12 +- lib/Zend/Service/Amazon/CustomerReview.php | 37 +- lib/Zend/Service/Amazon/EditorialReview.php | 12 +- lib/Zend/Service/Amazon/Item.php | 78 +- lib/Zend/Service/Amazon/ListmaniaList.php | 12 +- lib/Zend/Service/Amazon/Offer.php | 47 +- lib/Zend/Service/Amazon/OfferSet.php | 47 +- lib/Zend/Service/Amazon/SimilarProduct.php | 17 +- lib/Zend/Service/Audioscrobbler.php | 4 +- lib/Zend/Service/Delicious.php | 23 +- lib/Zend/Service/ReCaptcha.php | 506 +++ lib/Zend/Service/ReCaptcha/Exception.php | 36 + lib/Zend/Service/ReCaptcha/MailHide.php | 300 ++ .../Service/ReCaptcha/MailHide/Exception.php | 36 + lib/Zend/Service/ReCaptcha/Response.php | 159 + lib/Zend/Service/Simpy.php | 31 +- lib/Zend/Service/SlideShare.php | 26 +- lib/Zend/Service/SlideShare/Exception.php | 3 +- lib/Zend/Service/SlideShare/SlideShow.php | 4 +- lib/Zend/Service/Technorati.php | 2056 ++++----- lib/Zend/Service/Technorati/Author.php | 484 +- .../Service/Technorati/BlogInfoResult.php | 322 +- lib/Zend/Service/Technorati/CosmosResult.php | 304 +- .../Service/Technorati/CosmosResultSet.php | 352 +- lib/Zend/Service/Technorati/Exception.php | 78 +- lib/Zend/Service/Technorati/GetInfoResult.php | 206 +- lib/Zend/Service/Technorati/KeyInfoResult.php | 236 +- lib/Zend/Service/Technorati/Result.php | 242 +- lib/Zend/Service/Technorati/ResultSet.php | 580 +-- lib/Zend/Service/Technorati/TagsResult.php | 186 +- lib/Zend/Service/Technorati/Utils.php | 272 +- lib/Zend/Service/Technorati/Weblog.php | 972 ++-- lib/Zend/Service/Twitter.php | 762 ++++ lib/Zend/Service/Twitter/Exception.php | 32 + lib/Zend/Service/Twitter/Search.php | 173 + lib/Zend/Service/Yahoo.php | 11 +- lib/Zend/Service/Yahoo/InlinkDataResult.php | 3 +- .../Service/Yahoo/InlinkDataResultSet.php | 3 +- lib/Zend/Service/Yahoo/PageDataResult.php | 3 +- lib/Zend/Service/Yahoo/PageDataResultSet.php | 125 +- lib/Zend/Service/Yahoo/WebResult.php | 17 +- lib/Zend/Session.php | 90 +- lib/Zend/Session/Exception.php | 10 +- lib/Zend/Session/Namespace.php | 18 +- lib/Zend/Session/SaveHandler/DbTable.php | 589 +++ lib/Zend/Session/SaveHandler/Exception.php | 37 + lib/Zend/Session/SaveHandler/Interface.php | 10 +- lib/Zend/Session/Validator/Abstract.php | 20 +- lib/Zend/Session/Validator/HttpUserAgent.php | 19 +- lib/Zend/Session/Validator/Interface.php | 4 +- lib/Zend/Soap/AutoDiscover.php | 482 ++ lib/Zend/Soap/AutoDiscover/Exception.php | 23 + lib/Zend/Soap/Client.php | 948 ++++ lib/Zend/Soap/Client/Common.php | 73 + lib/Zend/Soap/Client/DotNet.php | 84 + lib/Zend/Soap/Client/Exception.php | 33 + lib/Zend/Soap/Client/Local.php | 90 + lib/Zend/Soap/Server.php | 863 ++++ lib/Zend/Soap/Server/Exception.php | 35 + lib/Zend/Soap/Wsdl.php | 578 +++ lib/Zend/Soap/Wsdl/CodeGenerator.php | 127 + lib/Zend/Soap/Wsdl/Exception.php | 25 + lib/Zend/Soap/Wsdl/Parser.php | 173 + lib/Zend/Soap/Wsdl/Parser/Result.php | 52 + lib/Zend/Soap/Wsdl/Strategy/Abstract.php | 47 + lib/Zend/Soap/Wsdl/Strategy/AnyType.php | 45 + .../Soap/Wsdl/Strategy/ArrayOfTypeComplex.php | 122 + .../Wsdl/Strategy/ArrayOfTypeSequence.php | 148 + .../Soap/Wsdl/Strategy/DefaultComplexType.php | 69 + lib/Zend/Soap/Wsdl/Strategy/Interface.php | 35 + lib/Zend/Test/PHPUnit/Constraint/DomQuery.php | 379 ++ .../Test/PHPUnit/Constraint/Exception.php | 16 + lib/Zend/Test/PHPUnit/Constraint/Redirect.php | 260 ++ .../PHPUnit/Constraint/ResponseHeader.php | 378 ++ lib/Zend/Test/PHPUnit/ControllerTestCase.php | 1107 +++++ lib/Zend/Text/Exception.php | 38 + lib/Zend/Text/Figlet.php | 1232 +++++ lib/Zend/Text/Figlet/Exception.php | 38 + lib/Zend/Text/Figlet/zend-framework.flf | 753 ++++ lib/Zend/Text/Table.php | 532 +++ lib/Zend/Text/Table/Column.php | 238 + lib/Zend/Text/Table/Decorator/Ascii.php | 147 + lib/Zend/Text/Table/Decorator/Interface.php | 108 + lib/Zend/Text/Table/Decorator/Unicode.php | 176 + lib/Zend/Text/Table/Exception.php | 38 + lib/Zend/Text/Table/Row.php | 215 + lib/Zend/TimeSync.php | 19 +- lib/Zend/TimeSync/Exception.php | 26 +- lib/Zend/TimeSync/Ntp.php | 217 +- lib/Zend/TimeSync/Protocol.php | 67 +- lib/Zend/TimeSync/Sntp.php | 59 +- lib/Zend/Translate.php | 102 +- lib/Zend/Translate/Adapter.php | 318 +- lib/Zend/Translate/Adapter/Array.php | 4 +- lib/Zend/Translate/Adapter/Csv.php | 50 +- lib/Zend/Translate/Adapter/Gettext.php | 25 +- lib/Zend/Translate/Adapter/Ini.php | 81 + lib/Zend/Translate/Adapter/Qt.php | 28 +- lib/Zend/Translate/Adapter/Tbx.php | 27 +- lib/Zend/Translate/Adapter/Tmx.php | 29 +- lib/Zend/Translate/Adapter/Xliff.php | 26 +- lib/Zend/Translate/Adapter/XmlTm.php | 19 +- lib/Zend/Uri.php | 95 +- lib/Zend/Uri/Exception.php | 25 +- lib/Zend/Uri/Http.php | 474 +- lib/Zend/Validate.php | 4 +- lib/Zend/Validate/Abstract.php | 42 +- lib/Zend/Validate/Barcode/Ean13.php | 14 +- lib/Zend/Validate/Date.php | 82 +- lib/Zend/Validate/EmailAddress.php | 36 +- lib/Zend/Validate/File/Count.php | 277 ++ lib/Zend/Validate/File/Crc32.php | 179 + lib/Zend/Validate/File/ExcludeExtension.php | 94 + lib/Zend/Validate/File/ExcludeMimeType.php | 91 + lib/Zend/Validate/File/Exists.php | 203 + lib/Zend/Validate/File/Extension.php | 234 + lib/Zend/Validate/File/FilesSize.php | 163 + lib/Zend/Validate/File/Hash.php | 195 + lib/Zend/Validate/File/ImageSize.php | 370 ++ lib/Zend/Validate/File/IsCompressed.php | 133 + lib/Zend/Validate/File/IsImage.php | 137 + lib/Zend/Validate/File/Md5.php | 183 + lib/Zend/Validate/File/MimeType.php | 283 ++ lib/Zend/Validate/File/NotExists.php | 84 + lib/Zend/Validate/File/Sha1.php | 181 + lib/Zend/Validate/File/Size.php | 404 ++ lib/Zend/Validate/File/Upload.php | 234 + lib/Zend/Validate/Float.php | 53 +- lib/Zend/Validate/Hostname.php | 7 +- lib/Zend/Validate/Int.php | 59 +- lib/Zend/Validate/Ip.php | 17 +- lib/Zend/Validate/NotEmpty.php | 20 +- lib/Zend/Validate/StringLength.php | 59 +- lib/Zend/Version.php | 6 +- lib/Zend/View.php | 64 +- lib/Zend/View/Abstract.php | 279 +- lib/Zend/View/Helper/Abstract.php | 64 + lib/Zend/View/Helper/Action.php | 28 +- lib/Zend/View/Helper/DeclareVars.php | 33 +- lib/Zend/View/Helper/Doctype.php | 56 +- lib/Zend/View/Helper/Fieldset.php | 54 +- lib/Zend/View/Helper/Form.php | 43 +- lib/Zend/View/Helper/FormCheckbox.php | 96 +- lib/Zend/View/Helper/FormElement.php | 64 +- lib/Zend/View/Helper/FormErrors.php | 26 +- lib/Zend/View/Helper/FormFile.php | 9 +- lib/Zend/View/Helper/FormLabel.php | 3 +- lib/Zend/View/Helper/FormPassword.php | 14 +- lib/Zend/View/Helper/FormRadio.php | 8 +- lib/Zend/View/Helper/FormReset.php | 19 +- lib/Zend/View/Helper/FormSelect.php | 8 +- lib/Zend/View/Helper/FormSubmit.php | 2 +- lib/Zend/View/Helper/HeadLink.php | 127 +- lib/Zend/View/Helper/HeadMeta.php | 95 +- lib/Zend/View/Helper/HeadScript.php | 121 +- lib/Zend/View/Helper/HeadStyle.php | 101 +- lib/Zend/View/Helper/HeadTitle.php | 131 +- lib/Zend/View/Helper/HtmlElement.php | 141 + lib/Zend/View/Helper/HtmlFlash.php | 60 + lib/Zend/View/Helper/HtmlList.php | 15 +- lib/Zend/View/Helper/HtmlObject.php | 80 + lib/Zend/View/Helper/HtmlPage.php | 75 + lib/Zend/View/Helper/HtmlQuicktime.php | 82 + lib/Zend/View/Helper/InlineScript.php | 16 +- lib/Zend/View/Helper/Interface.php | 46 + lib/Zend/View/Helper/Json.php | 21 +- lib/Zend/View/Helper/Layout.php | 21 +- lib/Zend/View/Helper/PaginationControl.php | 141 + lib/Zend/View/Helper/Partial.php | 30 +- lib/Zend/View/Helper/PartialLoop.php | 40 +- lib/Zend/View/Helper/Placeholder.php | 42 +- .../View/Helper/Placeholder/Container.php | 16 +- .../Helper/Placeholder/Container/Abstract.php | 16 +- .../Placeholder/Container/Standalone.php | 46 +- lib/Zend/View/Helper/Placeholder/Registry.php | 16 +- lib/Zend/View/Helper/RenderToPlaceholder.php | 44 + lib/Zend/View/Helper/Translate.php | 72 +- lib/Zend/View/Helper/Url.php | 67 +- lib/Zend/View/Stream.php | 182 + lib/Zend/Wildfire/Channel/HttpHeaders.php | 292 ++ lib/Zend/Wildfire/Channel/Interface.php | 37 + lib/Zend/Wildfire/Exception.php | 35 + lib/Zend/Wildfire/Plugin/FirePhp.php | 616 +++ lib/Zend/Wildfire/Plugin/FirePhp/Message.php | 195 + .../Wildfire/Plugin/FirePhp/TableMessage.php | 98 + lib/Zend/Wildfire/Plugin/Interface.php | 47 + lib/Zend/Wildfire/Protocol/JsonStream.php | 234 + lib/Zend/XmlRpc/Client.php | 152 +- .../XmlRpc/Client/ServerIntrospection.php | 8 +- lib/Zend/XmlRpc/Fault.php | 26 +- lib/Zend/XmlRpc/Request.php | 9 +- lib/Zend/XmlRpc/Response/Http.php | 4 +- lib/Zend/XmlRpc/Server.php | 621 +-- lib/Zend/XmlRpc/Server/Cache.php | 140 +- lib/Zend/XmlRpc/Server/Exception.php | 16 +- lib/Zend/XmlRpc/Server/Fault.php | 16 +- lib/Zend/XmlRpc/Server/System.php | 154 + lib/Zend/XmlRpc/Value.php | 37 +- lib/Zend/XmlRpc/Value/Array.php | 1 + lib/Zend/XmlRpc/Value/Base64.php | 1 + lib/Zend/XmlRpc/Value/Boolean.php | 1 + lib/Zend/XmlRpc/Value/Collection.php | 1 + lib/Zend/XmlRpc/Value/DateTime.php | 1 + lib/Zend/XmlRpc/Value/Double.php | 1 + lib/Zend/XmlRpc/Value/Exception.php | 1 + lib/Zend/XmlRpc/Value/Integer.php | 1 + lib/Zend/XmlRpc/Value/Nil.php | 1 + lib/Zend/XmlRpc/Value/Scalar.php | 1 + lib/Zend/XmlRpc/Value/String.php | 16 +- lib/Zend/XmlRpc/Value/Struct.php | 1 + lib/Zend/replace_recursive.php | 85 +- lib/flex/uploader.zip | Bin 23105 -> 0 bytes lib/flex/uploader/uploader.mxml | 74 + lib/flex/uploader/uploaderSingle.mxml | 89 + lib/flex/varien.zip | Bin 27772 -> 0 bytes lib/flex/varien/varien/upload/Uploader.as | 627 +++ .../varien/varien/upload/UploaderEvent.as | 82 + .../varien/varien/upload/UploaderSingle.as | 90 + skin/adminhtml/default/default/boxes.css | 132 +- skin/adminhtml/default/default/iestyles.css | 5 +- .../default/default/media/uploader.swf | Bin 158650 -> 180912 bytes .../default/default/media/uploaderSingle.swf | Bin 0 -> 181368 bytes skin/adminhtml/default/default/menu.css | 1 + skin/frontend/default/blue/css/boxes.css | 4 +- skin/frontend/default/blue/js/bundle.js | 12 +- skin/frontend/default/default/css/boxes.css | 8 +- skin/frontend/default/default/css/clears.css | 3 +- skin/frontend/default/default/js/bundle.js | 25 +- 2304 files changed, 180579 insertions(+), 46020 deletions(-) delete mode 100644 app/code/core/Mage/Admin/etc/admin.xml create mode 100644 app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Grid.php create mode 100644 app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php create mode 100644 app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Form.php delete mode 100644 app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Store.php delete mode 100644 app/code/core/Mage/Adminhtml/Block/Urlrewrite/Add.php delete mode 100644 app/code/core/Mage/Adminhtml/Block/Urlrewrite/Add/Form.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Urlrewrite/Link.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php create mode 100644 app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Type.php create mode 100644 app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/Search/Type.php create mode 100644 app/code/core/Mage/Bundle/controllers/Product/EditController.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.53-0.7.54.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.54-0.7.55.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.55-0.7.56.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.56-0.7.57.php create mode 100644 app/code/core/Mage/CatalogIndex/Model/Aggregation.php create mode 100644 app/code/core/Mage/CatalogIndex/Model/Mysql4/Aggregation.php create mode 100644 app/code/core/Mage/CatalogIndex/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.7-0.7.8.php create mode 100644 app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.8-0.7.9.php create mode 100644 app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.9-0.7.10.php create mode 100644 app/code/core/Mage/CatalogSearch/Block/Layer.php create mode 100644 app/code/core/Mage/CatalogSearch/Model/Fulltext.php create mode 100644 app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php create mode 100644 app/code/core/Mage/CatalogSearch/Model/Layer.php create mode 100644 app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php create mode 100644 app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Collection.php create mode 100644 app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.4-0.7.5.php create mode 100644 app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.5-0.7.6.php create mode 100644 app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.8-0.8.9.php create mode 100644 app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php create mode 100644 app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php create mode 100644 app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php create mode 100644 app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php create mode 100644 app/code/core/Mage/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php create mode 100644 app/code/core/Mage/Downloadable/Block/Catalog/Product/Links.php create mode 100644 app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php create mode 100644 app/code/core/Mage/Downloadable/Block/Catalog/Product/View/Type.php create mode 100644 app/code/core/Mage/Downloadable/Block/Checkout/Cart/Item/Renderer.php create mode 100644 app/code/core/Mage/Downloadable/Block/Checkout/Success.php create mode 100644 app/code/core/Mage/Downloadable/Block/Customer/Products/List.php create mode 100644 app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php create mode 100644 app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php create mode 100644 app/code/core/Mage/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php create mode 100644 app/code/core/Mage/Downloadable/Helper/Data.php create mode 100644 app/code/core/Mage/Downloadable/Helper/Download.php create mode 100644 app/code/core/Mage/Downloadable/Helper/File.php create mode 100644 app/code/core/Mage/Downloadable/Model/CatalogIndex/Data/Downloadable.php create mode 100644 app/code/core/Mage/Downloadable/Model/Link.php create mode 100644 app/code/core/Mage/Downloadable/Model/Link/Purchased.php create mode 100644 app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php create mode 100644 app/code/core/Mage/Downloadable/Model/Mysql4/Link.php create mode 100644 app/code/core/Mage/Downloadable/Model/Mysql4/Link/Collection.php create mode 100644 app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased.php create mode 100644 app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Collection.php create mode 100644 app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item.php create mode 100644 app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item/Collection.php create mode 100644 app/code/core/Mage/Downloadable/Model/Mysql4/Sample.php create mode 100644 app/code/core/Mage/Downloadable/Model/Mysql4/Sample/Collection.php create mode 100644 app/code/core/Mage/Downloadable/Model/Observer.php create mode 100644 app/code/core/Mage/Downloadable/Model/Product/Price.php create mode 100644 app/code/core/Mage/Downloadable/Model/Product/Type.php create mode 100644 app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php create mode 100644 app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php create mode 100644 app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php create mode 100644 app/code/core/Mage/Downloadable/Model/Sample.php create mode 100644 app/code/core/Mage/Downloadable/Model/System/Config/Source/Contentdisposition.php create mode 100644 app/code/core/Mage/Downloadable/controllers/CustomerController.php create mode 100644 app/code/core/Mage/Downloadable/controllers/DownloadController.php create mode 100644 app/code/core/Mage/Downloadable/controllers/FileController.php create mode 100644 app/code/core/Mage/Downloadable/controllers/Product/EditController.php create mode 100644 app/code/core/Mage/Downloadable/etc/config.xml create mode 100644 app/code/core/Mage/Downloadable/etc/system.xml create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-0.1.0.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.0-0.1.1.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.1-0.1.2.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.10-0.1.11.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.11-0.1.12.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.2-0.1.3.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.3-0.1.4.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.4-0.1.5.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.5-0.1.6.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.6-0.1.7.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.7-0.1.8.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.8-0.1.9.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.9-0.1.10.php create mode 100644 app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.10-0.7.11.php create mode 100644 app/code/core/Mage/GoogleBase/Block/Adminhtml/Captcha.php create mode 100644 app/code/core/Mage/GoogleCheckout/sql/googlecheckout_setup/mysql4-upgrade-0.7.0-0.7.1.php create mode 100644 app/code/core/Mage/Reports/Model/Mysql4/Product/Downloads/Collection.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.26-0.9.27.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.27-0.9.28.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.28-0.9.29.php create mode 100644 app/code/core/Mage/Sendfriend/sql/sendfriend_setup/mysql4-upgrade-0.7.1-0.7.2.php create mode 100644 app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.7-0.7.8.php create mode 100644 app/code/core/Mage/Weee/Block/Element/Weee/Tax.php create mode 100644 app/code/core/Mage/Weee/Block/Renderer/Weee/Tax.php create mode 100644 app/code/core/Mage/Weee/Helper/Data.php create mode 100644 app/code/core/Mage/Weee/Model/Attribute/Backend/Weee/Tax.php create mode 100644 app/code/core/Mage/Weee/Model/Config/Source/Display.php create mode 100644 app/code/core/Mage/Weee/Model/Mysql4/Attribute/Backend/Weee/Tax.php create mode 100644 app/code/core/Mage/Weee/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Weee/Model/Mysql4/Tax.php create mode 100644 app/code/core/Mage/Weee/Model/Observer.php create mode 100644 app/code/core/Mage/Weee/Model/Tax.php create mode 100644 app/code/core/Mage/Weee/Model/Total/Creditmemo/Weee.php create mode 100644 app/code/core/Mage/Weee/Model/Total/Invoice/Weee.php create mode 100644 app/code/core/Mage/Weee/Model/Total/Quote/Weee.php create mode 100644 app/code/core/Mage/Weee/etc/config.xml create mode 100644 app/code/core/Mage/Weee/etc/system.xml create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-install-0.1.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.1-0.2.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.10-0.11.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.11-0.12.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.2-0.3.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.3-0.4.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.4-0.5.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.5-0.6.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.6-0.7.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.7-0.8.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.8-0.9.php create mode 100644 app/code/core/Mage/Weee/sql/weee_setup/mysql4-upgrade-0.9-0.10.php create mode 100644 app/design/adminhtml/default/default/layout/downloadable.xml create mode 100644 app/design/adminhtml/default/default/template/downloadable/product/edit/downloadable.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/product/edit/downloadable/links.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/product/edit/downloadable/samples.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/sales/items/column/downloadable/creditmemo/name.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/sales/items/column/downloadable/invoice/name.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/sales/items/column/downloadable/name.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/sales/order/creditmemo/create/items/renderer/downloadable.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/sales/order/creditmemo/view/items/renderer/downloadable.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/sales/order/invoice/create/items/renderer/downloadable.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/sales/order/invoice/view/items/renderer/downloadable.phtml create mode 100644 app/design/adminhtml/default/default/template/downloadable/sales/order/view/items/renderer/downloadable.phtml create mode 100644 app/design/adminhtml/default/default/template/formkey.phtml create mode 100644 app/design/adminhtml/default/default/template/googlebase/captcha.phtml create mode 100644 app/design/adminhtml/default/default/template/urlrewrite/categories.phtml rename app/design/adminhtml/default/default/template/urlrewrite/{form.phtml => edit.phtml} (60%) delete mode 100644 app/design/adminhtml/default/default/template/urlrewrite/product/categories.phtml rename app/design/adminhtml/default/default/template/{system/store/delete_group.phtml => urlrewrite/selector.phtml} (53%) create mode 100644 app/design/adminhtml/default/default/template/weee/renderer/tax.phtml create mode 100644 app/design/frontend/default/default/layout/downloadable.xml create mode 100644 app/design/frontend/default/default/layout/weee.xml create mode 100644 app/design/frontend/default/default/template/core/formkey.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/catalog/product/links.phtml rename app/design/{adminhtml/default/default/template/system/store/delete_website.phtml => frontend/default/default/template/downloadable/catalog/product/samples.phtml} (52%) rename app/design/{adminhtml/default/default/template/system/store/delete_store.phtml => frontend/default/default/template/downloadable/catalog/product/type.phtml} (52%) create mode 100644 app/design/frontend/default/default/template/downloadable/checkout/cart/item/default.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/checkout/multishipping/item/downloadable.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/checkout/onepage/review/item.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/checkout/success.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/customer/products/list.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/email/order/items/creditmemo/downloadable.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/email/order/items/invoice/downloadable.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/email/order/items/order/downloadable.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/sales/order/invoice/items/renderer/downloadable.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/sales/order/items/renderer.phtml create mode 100644 app/design/frontend/default/default/template/downloadable/sales/order/items/renderer/downloadable.phtml create mode 100644 app/etc/local.xml.additional create mode 100644 app/etc/modules/Mage_Downloadable.xml create mode 100644 app/etc/modules/Mage_Weee.xml create mode 100644 app/locale/en_US/Mage_Api.csv create mode 100644 app/locale/en_US/Mage_Downloadable.csv create mode 100644 app/locale/en_US/Mage_Strikeiron.csv create mode 100644 app/locale/en_US/Mage_Weee.csv create mode 100644 js/varien/weee.js create mode 100644 lib/Zend/Amf/Constants.php create mode 100644 lib/Zend/Amf/Exception.php create mode 100644 lib/Zend/Amf/Parse/Amf0/Deserializer.php create mode 100644 lib/Zend/Amf/Parse/Amf0/Serializer.php create mode 100644 lib/Zend/Amf/Parse/Amf3/Deserializer.php create mode 100644 lib/Zend/Amf/Parse/Amf3/Serializer.php create mode 100644 lib/Zend/Amf/Parse/Deserializer.php create mode 100644 lib/Zend/Amf/Parse/InputStream.php create mode 100644 lib/Zend/Amf/Parse/OutputStream.php create mode 100644 lib/Zend/Amf/Parse/Serializer.php create mode 100644 lib/Zend/Amf/Parse/TypeLoader.php create mode 100644 lib/Zend/Amf/Request.php create mode 100644 lib/Zend/Amf/Request/Http.php create mode 100644 lib/Zend/Amf/Response.php create mode 100644 lib/Zend/Amf/Response/Http.php create mode 100644 lib/Zend/Amf/Server.php create mode 100644 lib/Zend/Amf/Server/Exception.php create mode 100644 lib/Zend/Amf/Util/BinaryStream.php create mode 100644 lib/Zend/Amf/Value/ByteArray.php create mode 100644 lib/Zend/Amf/Value/MessageBody.php create mode 100644 lib/Zend/Amf/Value/MessageHeader.php create mode 100644 lib/Zend/Amf/Value/Messaging/AbstractMessage.php create mode 100644 lib/Zend/Amf/Value/Messaging/AcknowledgeMessage.php create mode 100644 lib/Zend/Amf/Value/Messaging/AsyncMessage.php create mode 100644 lib/Zend/Amf/Value/Messaging/CommandMessage.php create mode 100644 lib/Zend/Amf/Value/Messaging/ErrorMessage.php create mode 100644 lib/Zend/Amf/Value/Messaging/RemotingMessage.php create mode 100644 lib/Zend/Amf/Value/TraitsInfo.php create mode 100644 lib/Zend/Cache/Backend/ExtendedInterface.php create mode 100644 lib/Zend/Cache/Backend/TwoLevels.php create mode 100644 lib/Zend/Cache/Backend/Xcache.php create mode 100644 lib/Zend/Captcha/Adapter.php create mode 100644 lib/Zend/Captcha/Base.php create mode 100644 lib/Zend/Captcha/Dumb.php create mode 100644 lib/Zend/Captcha/Exception.php create mode 100644 lib/Zend/Captcha/Figlet.php create mode 100644 lib/Zend/Captcha/Image.php create mode 100644 lib/Zend/Captcha/ReCaptcha.php create mode 100644 lib/Zend/Captcha/Word.php create mode 100644 lib/Zend/Config/Writer.php create mode 100644 lib/Zend/Config/Writer/Array.php create mode 100644 lib/Zend/Config/Writer/Ini.php create mode 100644 lib/Zend/Config/Writer/Xml.php create mode 100644 lib/Zend/Controller/Action/HelperBroker/PriorityStack.php create mode 100644 lib/Zend/Controller/Request/HttpTestCase.php create mode 100644 lib/Zend/Controller/Response/HttpTestCase.php create mode 100644 lib/Zend/Controller/Router/Route/Abstract.php create mode 100644 lib/Zend/Controller/Router/Route/Chain.php create mode 100644 lib/Zend/Controller/Router/Route/Hostname.php create mode 100644 lib/Zend/Db/Profiler/Firebug.php create mode 100644 lib/Zend/Dojo.php create mode 100644 lib/Zend/Dojo/Data.php create mode 100644 lib/Zend/Dojo/Exception.php create mode 100644 lib/Zend/Dojo/Form.php create mode 100644 lib/Zend/Dojo/Form/Decorator/AccordionContainer.php create mode 100644 lib/Zend/Dojo/Form/Decorator/AccordionPane.php create mode 100644 lib/Zend/Dojo/Form/Decorator/BorderContainer.php create mode 100644 lib/Zend/Dojo/Form/Decorator/ContentPane.php create mode 100644 lib/Zend/Dojo/Form/Decorator/DijitContainer.php create mode 100644 lib/Zend/Dojo/Form/Decorator/DijitElement.php create mode 100644 lib/Zend/Dojo/Form/Decorator/DijitForm.php create mode 100644 lib/Zend/Dojo/Form/Decorator/SplitContainer.php create mode 100644 lib/Zend/Dojo/Form/Decorator/StackContainer.php create mode 100644 lib/Zend/Dojo/Form/Decorator/TabContainer.php create mode 100644 lib/Zend/Dojo/Form/DisplayGroup.php create mode 100644 lib/Zend/Dojo/Form/Element/Button.php create mode 100644 lib/Zend/Dojo/Form/Element/CheckBox.php create mode 100644 lib/Zend/Dojo/Form/Element/ComboBox.php create mode 100644 lib/Zend/Dojo/Form/Element/CurrencyTextBox.php create mode 100644 lib/Zend/Dojo/Form/Element/DateTextBox.php create mode 100644 lib/Zend/Dojo/Form/Element/Dijit.php create mode 100644 lib/Zend/Dojo/Form/Element/DijitMulti.php create mode 100644 lib/Zend/Dojo/Form/Element/Editor.php create mode 100644 lib/Zend/Dojo/Form/Element/FilteringSelect.php create mode 100644 lib/Zend/Dojo/Form/Element/HorizontalSlider.php create mode 100644 lib/Zend/Dojo/Form/Element/NumberSpinner.php create mode 100644 lib/Zend/Dojo/Form/Element/NumberTextBox.php create mode 100644 lib/Zend/Dojo/Form/Element/PasswordTextBox.php create mode 100644 lib/Zend/Dojo/Form/Element/RadioButton.php create mode 100644 lib/Zend/Dojo/Form/Element/SimpleTextarea.php create mode 100644 lib/Zend/Dojo/Form/Element/Slider.php create mode 100644 lib/Zend/Dojo/Form/Element/SubmitButton.php create mode 100644 lib/Zend/Dojo/Form/Element/TextBox.php create mode 100644 lib/Zend/Dojo/Form/Element/Textarea.php create mode 100644 lib/Zend/Dojo/Form/Element/TimeTextBox.php create mode 100644 lib/Zend/Dojo/Form/Element/ValidationTextBox.php create mode 100644 lib/Zend/Dojo/Form/Element/VerticalSlider.php create mode 100644 lib/Zend/Dojo/Form/SubForm.php create mode 100644 lib/Zend/Dojo/View/Exception.php create mode 100644 lib/Zend/Dojo/View/Helper/AccordionContainer.php create mode 100644 lib/Zend/Dojo/View/Helper/AccordionPane.php create mode 100644 lib/Zend/Dojo/View/Helper/BorderContainer.php create mode 100644 lib/Zend/Dojo/View/Helper/Button.php create mode 100644 lib/Zend/Dojo/View/Helper/CheckBox.php create mode 100644 lib/Zend/Dojo/View/Helper/ComboBox.php create mode 100644 lib/Zend/Dojo/View/Helper/ContentPane.php create mode 100644 lib/Zend/Dojo/View/Helper/CurrencyTextBox.php create mode 100644 lib/Zend/Dojo/View/Helper/DateTextBox.php create mode 100644 lib/Zend/Dojo/View/Helper/Dijit.php create mode 100644 lib/Zend/Dojo/View/Helper/DijitContainer.php create mode 100644 lib/Zend/Dojo/View/Helper/Dojo.php create mode 100644 lib/Zend/Dojo/View/Helper/Dojo/Container.php create mode 100644 lib/Zend/Dojo/View/Helper/Editor.php create mode 100644 lib/Zend/Dojo/View/Helper/FilteringSelect.php create mode 100644 lib/Zend/Dojo/View/Helper/Form.php create mode 100644 lib/Zend/Dojo/View/Helper/HorizontalSlider.php create mode 100644 lib/Zend/Dojo/View/Helper/NumberSpinner.php create mode 100644 lib/Zend/Dojo/View/Helper/NumberTextBox.php create mode 100644 lib/Zend/Dojo/View/Helper/PasswordTextBox.php create mode 100644 lib/Zend/Dojo/View/Helper/RadioButton.php create mode 100644 lib/Zend/Dojo/View/Helper/SimpleTextarea.php create mode 100644 lib/Zend/Dojo/View/Helper/Slider.php create mode 100644 lib/Zend/Dojo/View/Helper/SplitContainer.php create mode 100644 lib/Zend/Dojo/View/Helper/StackContainer.php create mode 100644 lib/Zend/Dojo/View/Helper/SubmitButton.php create mode 100644 lib/Zend/Dojo/View/Helper/TabContainer.php create mode 100644 lib/Zend/Dojo/View/Helper/TextBox.php create mode 100644 lib/Zend/Dojo/View/Helper/Textarea.php create mode 100644 lib/Zend/Dojo/View/Helper/TimeTextBox.php create mode 100644 lib/Zend/Dojo/View/Helper/ValidationTextBox.php create mode 100644 lib/Zend/Dojo/View/Helper/VerticalSlider.php create mode 100644 lib/Zend/Dom/Exception.php create mode 100644 lib/Zend/Dom/Query.php create mode 100644 lib/Zend/Dom/Query/Css2Xpath.php create mode 100644 lib/Zend/Dom/Query/Result.php create mode 100644 lib/Zend/File/Transfer.php create mode 100644 lib/Zend/File/Transfer/Adapter/Abstract.php create mode 100644 lib/Zend/File/Transfer/Adapter/Http.php create mode 100644 lib/Zend/File/Transfer/Exception.php create mode 100644 lib/Zend/Filter/File/LowerCase.php create mode 100644 lib/Zend/Filter/File/Rename.php create mode 100644 lib/Zend/Filter/File/UpperCase.php create mode 100644 lib/Zend/Filter/StripNewlines.php create mode 100644 lib/Zend/Form/Decorator/Captcha.php create mode 100644 lib/Zend/Form/Decorator/Captcha/Word.php create mode 100644 lib/Zend/Form/Decorator/File.php create mode 100644 lib/Zend/Form/Decorator/FormErrors.php create mode 100644 lib/Zend/Form/Decorator/PrepareElements.php create mode 100644 lib/Zend/Form/Element/Captcha.php create mode 100644 lib/Zend/Form/Element/File.php create mode 100644 lib/Zend/Gdata/App/VersionException.php create mode 100644 lib/Zend/Gdata/Books.php create mode 100644 lib/Zend/Gdata/Books/CollectionEntry.php create mode 100644 lib/Zend/Gdata/Books/CollectionFeed.php create mode 100644 lib/Zend/Gdata/Books/Extension/AnnotationLink.php create mode 100644 lib/Zend/Gdata/Books/Extension/BooksCategory.php create mode 100644 lib/Zend/Gdata/Books/Extension/BooksLink.php create mode 100644 lib/Zend/Gdata/Books/Extension/Embeddability.php create mode 100644 lib/Zend/Gdata/Books/Extension/InfoLink.php create mode 100644 lib/Zend/Gdata/Books/Extension/PreviewLink.php create mode 100644 lib/Zend/Gdata/Books/Extension/Review.php create mode 100644 lib/Zend/Gdata/Books/Extension/ThumbnailLink.php create mode 100644 lib/Zend/Gdata/Books/Extension/Viewability.php create mode 100644 lib/Zend/Gdata/Books/VolumeEntry.php create mode 100644 lib/Zend/Gdata/Books/VolumeFeed.php create mode 100644 lib/Zend/Gdata/Books/VolumeQuery.php create mode 100644 lib/Zend/Gdata/DublinCore.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Creator.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Date.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Description.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Format.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Identifier.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Language.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Publisher.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Rights.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Subject.php create mode 100644 lib/Zend/Gdata/DublinCore/Extension/Title.php create mode 100644 lib/Zend/Gdata/Health.php create mode 100644 lib/Zend/Gdata/Health/Extension/Ccr.php create mode 100644 lib/Zend/Gdata/Health/ProfileEntry.php create mode 100644 lib/Zend/Gdata/Health/ProfileFeed.php create mode 100644 lib/Zend/Gdata/Health/ProfileListEntry.php create mode 100644 lib/Zend/Gdata/Health/ProfileListFeed.php create mode 100644 lib/Zend/Gdata/Health/Query.php create mode 100644 lib/Zend/Gdata/HttpClient.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/AboutMe.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/CountHint.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/FirstName.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/LastName.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/MediaCredit.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/MediaRating.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/PlaylistId.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/PlaylistTitle.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/Private.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/QueryString.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/Recorded.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/Uploaded.php create mode 100644 lib/Zend/Gdata/YouTube/Extension/VideoId.php create mode 100644 lib/Zend/Json/Server.php create mode 100644 lib/Zend/Json/Server/Cache.php create mode 100644 lib/Zend/Json/Server/Error.php create mode 100644 lib/Zend/Json/Server/Exception.php create mode 100644 lib/Zend/Json/Server/Request.php create mode 100644 lib/Zend/Json/Server/Request/Http.php create mode 100644 lib/Zend/Json/Server/Response.php create mode 100644 lib/Zend/Json/Server/Response/Http.php create mode 100644 lib/Zend/Json/Server/Smd.php create mode 100644 lib/Zend/Json/Server/Smd/Service.php delete mode 100644 lib/Zend/Locale/Data/aa_ER_SAAHO.xml delete mode 100644 lib/Zend/Locale/Data/bo.xml delete mode 100644 lib/Zend/Locale/Data/bo_CN.xml delete mode 100644 lib/Zend/Locale/Data/bo_IN.xml create mode 100644 lib/Zend/Locale/Data/characters.xml delete mode 100644 lib/Zend/Locale/Data/cop_Arab.xml delete mode 100644 lib/Zend/Locale/Data/cop_Arab_EG.xml delete mode 100644 lib/Zend/Locale/Data/cop_Arab_US.xml delete mode 100644 lib/Zend/Locale/Data/cop_EG.xml delete mode 100644 lib/Zend/Locale/Data/cop_US.xml delete mode 100644 lib/Zend/Locale/Data/el_POLYTONI.xml create mode 100644 lib/Zend/Locale/Data/en_Shaw.xml create mode 100644 lib/Zend/Locale/Data/fil_PH.xml create mode 100644 lib/Zend/Locale/Data/fr_SN.xml create mode 100644 lib/Zend/Locale/Data/ha_Arab_SD.xml create mode 100644 lib/Zend/Locale/Data/ha_SD.xml create mode 100644 lib/Zend/Locale/Data/in.xml create mode 100644 lib/Zend/Locale/Data/iw.xml create mode 100644 lib/Zend/Locale/Data/kfo_CI.xml delete mode 100644 lib/Zend/Locale/Data/kfo_NG.xml create mode 100644 lib/Zend/Locale/Data/kk_Cyrl.xml create mode 100644 lib/Zend/Locale/Data/kk_Cyrl_KZ.xml delete mode 100644 lib/Zend/Locale/Data/ku_IQ.xml delete mode 100644 lib/Zend/Locale/Data/ku_IR.xml delete mode 100644 lib/Zend/Locale/Data/ku_Latn_IQ.xml delete mode 100644 lib/Zend/Locale/Data/ku_Latn_IR.xml delete mode 100644 lib/Zend/Locale/Data/ku_Latn_SY.xml delete mode 100644 lib/Zend/Locale/Data/ku_SY.xml create mode 100644 lib/Zend/Locale/Data/mn_CN.xml create mode 100644 lib/Zend/Locale/Data/mn_Cyrl.xml create mode 100644 lib/Zend/Locale/Data/mn_Cyrl_MN.xml create mode 100644 lib/Zend/Locale/Data/mn_Mong.xml create mode 100644 lib/Zend/Locale/Data/mn_Mong_CN.xml create mode 100644 lib/Zend/Locale/Data/mo.xml create mode 100644 lib/Zend/Locale/Data/ne_IN.xml create mode 100644 lib/Zend/Locale/Data/no.xml create mode 100644 lib/Zend/Locale/Data/plurals.xml create mode 100644 lib/Zend/Locale/Data/ro_MD.xml create mode 100644 lib/Zend/Locale/Data/si.xml create mode 100644 lib/Zend/Locale/Data/si_LK.xml create mode 100644 lib/Zend/Locale/Data/ss_SZ.xml delete mode 100644 lib/Zend/Locale/Data/ssy.xml create mode 100644 lib/Zend/Locale/Data/st_LS.xml create mode 100644 lib/Zend/Locale/Data/telephoneCodeData.xml create mode 100644 lib/Zend/Locale/Data/tg_Cyrl.xml create mode 100644 lib/Zend/Locale/Data/tg_Cyrl_TJ.xml create mode 100644 lib/Zend/Locale/Data/tl.xml create mode 100644 lib/Zend/Locale/Data/ug_Arab.xml create mode 100644 lib/Zend/Locale/Data/ug_Arab_CN.xml create mode 100644 lib/Zend/Locale/Data/ug_CN.xml delete mode 100644 lib/Zend/Locale/Data/und.xml delete mode 100644 lib/Zend/Locale/Data/und_ZZ.xml delete mode 100644 lib/Zend/Locale/Data/wo_Arab.xml delete mode 100644 lib/Zend/Locale/Data/wo_Arab_SN.xml create mode 100644 lib/Zend/Locale/Data/zh_Hans_HK.xml create mode 100644 lib/Zend/Locale/Data/zh_Hans_MO.xml create mode 100644 lib/Zend/Log/Writer/Firebug.php create mode 100644 lib/Zend/Measure/Time.php create mode 100644 lib/Zend/Paginator.php create mode 100644 lib/Zend/Paginator/Adapter/Array.php create mode 100644 lib/Zend/Paginator/Adapter/DbSelect.php create mode 100644 lib/Zend/Paginator/Adapter/DbTableSelect.php create mode 100644 lib/Zend/Paginator/Adapter/Interface.php create mode 100644 lib/Zend/Paginator/Adapter/Iterator.php create mode 100644 lib/Zend/Paginator/Adapter/Null.php create mode 100644 lib/Zend/Paginator/Exception.php create mode 100644 lib/Zend/Paginator/ScrollingStyle/All.php create mode 100644 lib/Zend/Paginator/ScrollingStyle/Elastic.php create mode 100644 lib/Zend/Paginator/ScrollingStyle/Interface.php create mode 100644 lib/Zend/Paginator/ScrollingStyle/Jumping.php create mode 100644 lib/Zend/Paginator/ScrollingStyle/Sliding.php delete mode 100644 lib/Zend/Pdf/Const.php create mode 100644 lib/Zend/ProgressBar.php create mode 100644 lib/Zend/ProgressBar/Adapter.php create mode 100644 lib/Zend/ProgressBar/Adapter/Console.php create mode 100644 lib/Zend/ProgressBar/Adapter/Exception.php create mode 100644 lib/Zend/ProgressBar/Adapter/JsPull.php create mode 100644 lib/Zend/ProgressBar/Adapter/JsPush.php create mode 100644 lib/Zend/ProgressBar/Exception.php create mode 100644 lib/Zend/Rest/Client/Result/Exception.php create mode 100644 lib/Zend/Search/Lucene/Document/Docx.php create mode 100644 lib/Zend/Search/Lucene/Document/OpenXml.php create mode 100644 lib/Zend/Search/Lucene/Document/Pptx.php create mode 100644 lib/Zend/Search/Lucene/Document/Xlsx.php create mode 100644 lib/Zend/Search/Lucene/Index/DocsFilter.php create mode 100644 lib/Zend/Server/Cache.php create mode 100644 lib/Zend/Server/Definition.php create mode 100644 lib/Zend/Server/Method/Callback.php create mode 100644 lib/Zend/Server/Method/Definition.php create mode 100644 lib/Zend/Server/Method/Parameter.php create mode 100644 lib/Zend/Server/Method/Prototype.php create mode 100644 lib/Zend/Service/ReCaptcha.php create mode 100644 lib/Zend/Service/ReCaptcha/Exception.php create mode 100644 lib/Zend/Service/ReCaptcha/MailHide.php create mode 100644 lib/Zend/Service/ReCaptcha/MailHide/Exception.php create mode 100644 lib/Zend/Service/ReCaptcha/Response.php create mode 100644 lib/Zend/Service/Twitter.php create mode 100644 lib/Zend/Service/Twitter/Exception.php create mode 100644 lib/Zend/Service/Twitter/Search.php create mode 100644 lib/Zend/Session/SaveHandler/DbTable.php create mode 100644 lib/Zend/Session/SaveHandler/Exception.php create mode 100644 lib/Zend/Soap/AutoDiscover.php create mode 100644 lib/Zend/Soap/AutoDiscover/Exception.php create mode 100644 lib/Zend/Soap/Client.php create mode 100644 lib/Zend/Soap/Client/Common.php create mode 100644 lib/Zend/Soap/Client/DotNet.php create mode 100644 lib/Zend/Soap/Client/Exception.php create mode 100644 lib/Zend/Soap/Client/Local.php create mode 100644 lib/Zend/Soap/Server.php create mode 100644 lib/Zend/Soap/Server/Exception.php create mode 100644 lib/Zend/Soap/Wsdl.php create mode 100644 lib/Zend/Soap/Wsdl/CodeGenerator.php create mode 100644 lib/Zend/Soap/Wsdl/Exception.php create mode 100644 lib/Zend/Soap/Wsdl/Parser.php create mode 100644 lib/Zend/Soap/Wsdl/Parser/Result.php create mode 100644 lib/Zend/Soap/Wsdl/Strategy/Abstract.php create mode 100644 lib/Zend/Soap/Wsdl/Strategy/AnyType.php create mode 100644 lib/Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php create mode 100644 lib/Zend/Soap/Wsdl/Strategy/ArrayOfTypeSequence.php create mode 100644 lib/Zend/Soap/Wsdl/Strategy/DefaultComplexType.php create mode 100644 lib/Zend/Soap/Wsdl/Strategy/Interface.php create mode 100644 lib/Zend/Test/PHPUnit/Constraint/DomQuery.php create mode 100644 lib/Zend/Test/PHPUnit/Constraint/Exception.php create mode 100644 lib/Zend/Test/PHPUnit/Constraint/Redirect.php create mode 100644 lib/Zend/Test/PHPUnit/Constraint/ResponseHeader.php create mode 100644 lib/Zend/Test/PHPUnit/ControllerTestCase.php create mode 100644 lib/Zend/Text/Exception.php create mode 100644 lib/Zend/Text/Figlet.php create mode 100644 lib/Zend/Text/Figlet/Exception.php create mode 100644 lib/Zend/Text/Figlet/zend-framework.flf create mode 100644 lib/Zend/Text/Table.php create mode 100644 lib/Zend/Text/Table/Column.php create mode 100644 lib/Zend/Text/Table/Decorator/Ascii.php create mode 100644 lib/Zend/Text/Table/Decorator/Interface.php create mode 100644 lib/Zend/Text/Table/Decorator/Unicode.php create mode 100644 lib/Zend/Text/Table/Exception.php create mode 100644 lib/Zend/Text/Table/Row.php create mode 100644 lib/Zend/Translate/Adapter/Ini.php create mode 100644 lib/Zend/Validate/File/Count.php create mode 100644 lib/Zend/Validate/File/Crc32.php create mode 100644 lib/Zend/Validate/File/ExcludeExtension.php create mode 100644 lib/Zend/Validate/File/ExcludeMimeType.php create mode 100644 lib/Zend/Validate/File/Exists.php create mode 100644 lib/Zend/Validate/File/Extension.php create mode 100644 lib/Zend/Validate/File/FilesSize.php create mode 100644 lib/Zend/Validate/File/Hash.php create mode 100644 lib/Zend/Validate/File/ImageSize.php create mode 100644 lib/Zend/Validate/File/IsCompressed.php create mode 100644 lib/Zend/Validate/File/IsImage.php create mode 100644 lib/Zend/Validate/File/Md5.php create mode 100644 lib/Zend/Validate/File/MimeType.php create mode 100644 lib/Zend/Validate/File/NotExists.php create mode 100644 lib/Zend/Validate/File/Sha1.php create mode 100644 lib/Zend/Validate/File/Size.php create mode 100644 lib/Zend/Validate/File/Upload.php create mode 100644 lib/Zend/View/Helper/Abstract.php create mode 100644 lib/Zend/View/Helper/HtmlElement.php create mode 100644 lib/Zend/View/Helper/HtmlFlash.php create mode 100644 lib/Zend/View/Helper/HtmlObject.php create mode 100644 lib/Zend/View/Helper/HtmlPage.php create mode 100644 lib/Zend/View/Helper/HtmlQuicktime.php create mode 100644 lib/Zend/View/Helper/Interface.php create mode 100644 lib/Zend/View/Helper/PaginationControl.php create mode 100644 lib/Zend/View/Helper/RenderToPlaceholder.php create mode 100644 lib/Zend/View/Stream.php create mode 100644 lib/Zend/Wildfire/Channel/HttpHeaders.php create mode 100644 lib/Zend/Wildfire/Channel/Interface.php create mode 100644 lib/Zend/Wildfire/Exception.php create mode 100644 lib/Zend/Wildfire/Plugin/FirePhp.php create mode 100644 lib/Zend/Wildfire/Plugin/FirePhp/Message.php create mode 100644 lib/Zend/Wildfire/Plugin/FirePhp/TableMessage.php create mode 100644 lib/Zend/Wildfire/Plugin/Interface.php create mode 100644 lib/Zend/Wildfire/Protocol/JsonStream.php create mode 100644 lib/Zend/XmlRpc/Server/System.php delete mode 100644 lib/flex/uploader.zip create mode 100644 lib/flex/uploader/uploader.mxml create mode 100644 lib/flex/uploader/uploaderSingle.mxml delete mode 100644 lib/flex/varien.zip create mode 100644 lib/flex/varien/varien/upload/Uploader.as create mode 100644 lib/flex/varien/varien/upload/UploaderEvent.as create mode 100644 lib/flex/varien/varien/upload/UploaderSingle.as create mode 100644 skin/adminhtml/default/default/media/uploaderSingle.swf diff --git a/STATUS.txt b/STATUS.txt index ac41677749..da8753d8a6 100644 --- a/STATUS.txt +++ b/STATUS.txt @@ -1,19 +1,233 @@ -This file tracks the status of Magento in the 1.1.x branch. +This file tracks the status of Magento in the 1.2.x branch. FIXED BUGS: + #6341: Duble subject line in e-mail + #7162: Wrong div class used in 'mini compared products box + #7400: In order view (admin panel) statuses history is different in tabs 'Information' and 'Comments History' + #7423: Cart Rules - Condition Limit Error + #7472: Invoices Report + #7612: Products are displayed in categories they are not included in + #7636: Catalog Product Attribute -> Catalog Input Type -> Dropdown + #8020: Custom catalog attributes created as "price" not displaying correctly + #8159: One page checkout :: doesn't work when inline translation was enabled + #8366: Not possible to translate tax identifier for two store views + #8411: (assign users to role) + #8413: Mass Delete through product update screen does not work + #8439: The checkout-process-page has no pagetitle + #8452: Layout Update Problem (Mage_Core_Model_Config) + #8492: Custom Options percentage Price Type: price rounded off unwantedly + #8503: Bundle products and decimal places in options quantity + #8523: Analytics does not show revenue with configurable products + #8573: lifetime sale incorrect when refunding order with discount code applied + #8595: Many numeric-only searches in Admin/Autocomplete + #8657: Spelling mistake in error msg - "Selected currency code () is not compatabile with PayPal" + #8674: User doesn't subscribed to newsletter. + #8726: Mage_Core_Model_Resource_Setup::getAllAttributeSetIds() belongs in another class + #8762: Filter settings on Sales - Orders not saved + #8770: [MAC, Safari] Unable to create new order in the admin with new customer creating & #8771: [MAC, Safari] Unable to create new order in the admin + #8784: Send product to a friend not under store configuration + #8803: Remove "Yes, No, Any" dropdown filter on Google Base Items + #8893: Trace error after clicking button "Search" + #8896: Applying unable coupons in the empty shopping cart + #8898: Free Shipping: 'For matching items only' cart rule doesn't work with UPS XML type method + #8903: SQL error when sorting Online Customers by Type attribute + #8925: Locale settings not applied after installation + #8928: Unable to create rule for Not logged in customer. + #8943: Import is not working in Safari + #8966: Google Base API - Mass Insert / Update -> CAPTCHA challenge issued + #8968: Category save process is very slow for big catalog + #8974: Content type validation + #8977: Google Analytics reports wrong URL when URL has no query string OR store resides in subfolder... + #8980: Shopping cart discount error + #8992: Mage_Sitemap / Varien_Io_File Bug - Destination not writeable error + #8993: 'No Data Found' for Web Site + #8995: Search does not return correct URL key for additional store view (e.g. 2nd language) + #9109: Sales Report disregards currency rates + #9135: Advanced search by price doesn't work at all + #9139: Admin: menu items not readable when images are disabled + #9166: Unable to add image to all types of product + #9167: AJAX will freeze during 'quick simple product creation' + #9171: Product's table doesn't hide after select products for adding SKU + #9172: Free Shipping: 'For matching items only' cart rule doesn't work with DHL type method + #9173: Calendar's button doesn't work in rules + #9195: [admin - reports - sales - tax] - no data + #9207: Field country is not marked as required + #9208: Unable to add bundle items to bundle product + #9228: cart error after product delete + #9248: On admin page, search function does not work + #9250: Import doesn't work + #9278: Peruvian Nuevo Sol Shown as PES (Peruvian Sol) + #9279: Catalog price rules do not apply when attribute selected has Catalog Input Type for Store Owner ='Multiple Select' + #9296: Customer DOB saved not correctly + #9324: Bad counting products + #9326: Verification in "Contact Us" + #9348: Sales Tax Reports Give False Results (No Results) + #9354: Date Format + #9358: Unable add products to Google Base after filtering + #9359: Google Analytics Revenue Not Working + #9375: Fatal error: Call to a member function getItemsCollection() in Address.php + #9389: SQL-error while creating custom option forproduct + #9390: In "Advanced Search" all text is not displayed + #9392: The field is too broad insert text + #9440: Error subscription to newsletter + #9452: Email Reply Address + #9468: The same group name in an attribute set can be created but it can NOT be saved + #9470: Gift message is not moved over on an order edit + #9479: Reorder / shipping method price doesn't displayed in the "Order Totals" area + #9481: Broken design of the Expiration Date field for CC payment method + #9492: Dataflow export doesn't recognize absolute path + #9493: Buggy Sorting in Manage Tax Rates - Mantis + #9505: Missing echo statement in blank/default/template/shipping/tracking/popup.phtml + #9517: Impossible to set custom admin theme in configuration + #9536: User permissions - Manage Attributes setup + #9540: Google Base Adding SID to urls in multi domain environmnet + #9544: Zero tax total folding/unfolding + #9556: Fatal error during Store View creating + #9566: table rate shipping uploading csv broken + #9596: Store-specific payment method name not in order email + #9611: Not correct message, when you remove the product. + #9619: On front-end Serch is not working + #9622: Unable to add Configurable product to the shopping cart + #9639: Design crushing and SQL-error in admin Dashboard + #9649: Fatal error after reordering orders that contains gift message + #9651: Total revenu always 0 on Google Analytics + #9657: Email to a friend -> User can send more than 5 emails in an hour + #9659: Email to a Friend -> "Add Recipient" button doesn't work + #9660: newsletter subscribers: "Select All" working as select visible + #9665: Export action on Manage Customers and Newsletter Subscribers exports only visible page content + #9683: Orders: Function "Move to shopping cart" does not work. + #9684: Orders: Action "Hold" leads to fatal error. + #9685: No tax data in Reports - Sales - Tax + #9688: Incorrect update qty of the bundle product in the shopping cart + #9695: Manage Attribute Sets: Does not create new group + #9696: Unable to assign existing products to any web sites + #9697: Enable/Disable status works incorrect + #9699: Blank theme :: Pay Pal's Review page :: button doesn't work + products names doesn't shows + #9700: Search synonym does not work + #9707: Customers->Manage Customers->*user* - orders with DP doesn't displayed + #9708: Manage Attribute Sets: Error when creating and deleting groups + #9711: Google checkout are returning Comments History with HTML tags + #9712: Parameter "Maximum Package Weight ", leads to error 404. + #9716: Creating of Bundle Product -> SQLSTATE error + #9717: "Shipment email not sent" status does not change when you send a letter. + #9738: Downloadable product + Tax Rules = error 404 + #9742: Notice on products sitemap + #9743: Wrong count of related products, upsells and crosssells in admin + #9760: Free Shipping : 'For matching items only' incorrect works with USPS + FedEx method + Fixed Bundle with custom options final price calculation + Fixed CatalogSearch events + Fixed EAV attribute save bug + Fixed EAV use joinAttribute method in conditions addAttributeToFilter method + Fixed MySQL 4.1 bug with NO_AUTO_VALUE_ON_ZERO mode and ALTER TABLE command + Fixed Online customers + Fixed REQUEST_URI for GA + Fixed Varieb_Db_Select::resetJoinLeft (find tables in conditions) + Fixed Varien_Data_Collection_Db::getSelectCountSql + Fixed _joinAttributeToSelect for abstract catalog collection (using attribute in select result and filter condition) + Fixed adding product to shopping cart + Fixed admin notification window block ACL + Fixed autobinding unescaped SQL variables + Fixed bug with categories tree interface after switching store + Fixed catalog price rule validation (case if rule is wrong: need to remove existing generated price changes) + Fixed cleanup call in catalog index + Fixed command line installation with index.php + Fixed customer and product grid performance in admin + Fixed cybersource payment for virtual order + Fixed generate xml string for config cache (0 value was ignored) + Fixed getting table names during installation + Fixed refreshing catalog rewrites after save catalog configuration and url resource model for getting static attributes value + Fixed reindex prices after saving catalog configuration section + Fixed reorder of grouped products + Fixed tax data joining (join tax classes just for special cases) + Fixed tierprice rendering for different product types + Fixed translations in permissions titles + Fixed PayPalUk Redirect url wrong type + Fixed create unique index in install + Fixed catalog product index + Fixed session validate and re-validate sent cookie + Added customer group id for price condition in advanced search, replaced 'or' on 'in' for price layered navigation condition + Fixed Google Checkout displaying of button when it is disabled + Fixed PayPal css/html + Fixed USPS Express Mail free shipping + Fixed applying catalog price rule with empty from date + Fixed catalog search in multistore setup + Fixed checkout crosssell block: when there are no products in cart, the filter was working incorrect + Fixed displaying of shipping name in orders history (if there are only downloadable or virtual products in orders) + Fixed displaying of uploaded files; changed redirecting after log in action while trying to download is not shearable link + Fixed downloadable products renderers for multishipping checkout + Fixed fixed amount product taxes + Fixed foreign key upgrade in core DB upgrade 0.8.10-0.8.11 + Fixed getting massaction_key from POST + Fixed issues with applying coupon codes + Fixed js error in manage rules interface + Fixed downlodable products admin interface in IE + Updated Flex-Javascript bridge, fixed IE/Safari issues + Added applying frontend translation when sending emails from admin + Fixed recreating new instances of Flex-Ajax bridges on hide/display flash objects + Fixed category selection in URL-rewrites management form + Fixed fatal error in downloader + Fixed command line installer + Fixed fixed amount product taxes for products without discounts + Fixed hiding of flex uploader after removing row of downloadbale sample|link + Fixed FPT editing for bundle products + Fixed generatting filenames for create custom extensions interface in Windows + Fixed calling final step of dataflow import + Fixed bundle js for calculating children with FPT + Fixed grid to select products SKU in price rules in IE6/7 + Fixed duplicate diplaying prices in bundle product price ranges + Fixed displaying category image in blank theme + Fixed cross sells issues on frontend + Fixed serialized data checking when reading FPT data from order item + Fixed checking order status for downloadable products to become available + Fixed #9757: Paypal Payment Pro Direct not visible -RESOLVED BUGS: +CHANGES: - -IMPORTANT CHANGES: - - - -KNOWN ISSUES: - + Upgraded ZF library to version 1.7.2 (r13445 from http://framework.zend.com/svn/framework/standard/trunk/library/Zend) + Added downlodable product type + Implented fulltext search + Added layred navigation to search results + Added option to disable google checkout for selected products + Added fixed amount product taxes + Moved information about product visibility to catalog_product_category_index + Changed Mage::app()->isInstalled to Mage::isInstalled to prevent db upgrades + Removed session ID encryption + Changed catalogindex price to store prices per website + Changed modules dependencies: Mage_Shipment and Mage_Payment now depend on Mage_Catalog, Mage_GoogleCheckout depends on Mage_Payment, Mage_CatalogInventory doesn't depend on Mage_Sales + Added "Add Field with URL" option for product export + Added configuration field to include some additional output on the HTML page before head closing tag + Added Spanish - Costa Rica locale + Extended Mage_Adminhtml_Controller_Action->_prepareDownloadResponse() to avoid copy-pasting in admin controllers + Removed adding ?ft parameter in admin to prevent the issues it caused + Made category URL suffix to be .html by default + Added setting body class on tag for admin pages (similar to frontend - full action name separated by dashes) + Added local.xml.additional file to list/explain possible additional configuration nodes/values for local.xml + Added currency rates into order info box in backend + Added ability to display form buttons on bottom in admin container widget, fixed button levels + Added ability to use memcached to store sessions and to be used as cache backend + Added additional permissions to WS api, fixed bugs with custom permissions + Added option "Disable Guest Checkout if cart contains downloadable items" + Removed store view name from page titles on catalog pages + Commented out required_once in lib/Zend + Added permanent redirect option for URL Rewrites + Added ability to display custom child blocks on success page + Added collecting results of non-asynchronous event handlers in adminhtml/events.js + Added confirmation dialog before switching from 'Images' and 'Downloadable Information' tabs in product edit form to prevent losing selected files + Added firing 'tabChangeBefore' event before switching tab in adminhtml/tabs.js (event handler can return 'cannotchange' to prevent switching) + Rewritten URL Rewrite Management interface + Added checking of file size before uploading + Added downloadable order items pdf renderers + Added downloadable products templates to blank, iphone, modern theme + Added flex uploader source code + Added support of allowed tags into Mage_Core_Helper_Abstract->htmlEscape() method + Added unquoting autobinded quoted values in SQL adapter + Added validation for selected, but not uploaded files + Updated downloader version to 1.2.0 + Changed app/etc/local.xml* license to AFL + Added autoguessing mime type of a file if mimemagic extension is not installed NOTES: diff --git a/app/Mage.php b/app/Mage.php index 9753d8b692..01da359fee 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -82,7 +82,7 @@ final class Mage { public static function getVersion() { - return '1.1.8'; + return '1.2.0'; } /** @@ -149,6 +149,9 @@ public static function registry($key) */ public static function setRoot($appRoot='') { + if (self::registry('appRoot')) { + return ; + } if (''===$appRoot) { // automagically find application root by dirname of Mage.php $appRoot = dirname(__FILE__); @@ -455,11 +458,18 @@ public static function run($code = '', $type = 'store', $options=array()) } catch (Mage_Core_Model_Store_Exception $e) { $baseUrl = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/'); - header('Location: ' . $baseUrl.'/404/'); + if (!headers_sent()) { + header('Location: ' . $baseUrl.'/404/'); + } + else { + print ''; + } die(); } catch (Exception $e) { - if (self::app()->isInstalled() || self::$_isDownloader) { + if (self::isInstalled() || self::$_isDownloader) { self::printException($e); exit(); } @@ -478,6 +488,43 @@ public static function run($code = '', $type = 'store', $options=array()) } } + /** + * Retrieve application installation flag + * + * @param string|array $options + * @return bool + */ + public static function isInstalled($options = array()) + { + $isInstalled = self::registry('_is_installed'); + if ($isInstalled === null) { + self::setRoot(); + + if (is_string($options)) { + $options = array( + 'etc_dir' => $options + ); + } + $etcDir = 'etc'; + if (!empty($options['etc_dir'])) { + $etcDir = $options['etc_dir']; + } + $localConfigFile = self::getRoot() . DS . $etcDir . DS . 'local.xml'; + + $isInstalled = false; + + if (is_readable($localConfigFile)) { + $localConfig = simplexml_load_file($localConfigFile); + date_default_timezone_set('UTC'); + if (($date = $localConfig->global->install->date) && strtotime($date)) { + $isInstalled = true; + } + } + self::register('_is_installed', $isInstalled); + } + return $isInstalled; + } + /** * log facility (??) * diff --git a/app/code/core/Mage/Admin/Model/Roles.php b/app/code/core/Mage/Admin/Model/Roles.php index 35f1839b8c..736f2d45fa 100644 --- a/app/code/core/Mage/Admin/Model/Roles.php +++ b/app/code/core/Mage/Admin/Model/Roles.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_Permissions + * @package Mage_Admin * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -62,7 +62,7 @@ public function getRoleUsers() return $this->getResource()->getRoleUsers($this); } - protected function _buildResourcesArray(Varien_Simplexml_Element $resource=null, $parentName=null, $level=0, $represent2Darray=null, $rawNodes = false) + protected function _buildResourcesArray(Varien_Simplexml_Element $resource=null, $parentName=null, $level=0, $represent2Darray=null, $rawNodes = false, $module = 'adminhtml') { static $result; if (is_null($resource)) { @@ -73,15 +73,25 @@ protected function _buildResourcesArray(Varien_Simplexml_Element $resource=null, $resourceName = $parentName; if ($resource->getName()!='title' && $resource->getName()!='sort_order' && $resource->getName() != 'children') { $resourceName = (is_null($parentName) ? '' : $parentName.'/').$resource->getName(); + + //assigning module for its' children nodes + if ($resource->getAttribute('module')) { + $module = (string)$resource->getAttribute('module'); + } + if ($rawNodes) { $resource->addAttribute("aclpath", $resourceName); + $resource->addAttribute("module_c", $module); } - if (!(string)$resource->title) { - return array(); - } + + //if (!(string)$resource->title) { + // return array(); + //} + + $resource->title = Mage::helper($module)->__((string)$resource->title); if ( is_null($represent2Darray) ) { - $result[$resourceName]['name'] = Mage::helper('adminhtml')->__((string)$resource->title); + $result[$resourceName]['name'] = (string)$resource->title; $result[$resourceName]['level'] = $level; } else { $result[] = $resourceName; @@ -98,7 +108,7 @@ protected function _buildResourcesArray(Varien_Simplexml_Element $resource=null, } } foreach ($children as $child) { - $this->_buildResourcesArray($child, $resourceName, $level+1, $represent2Darray, $rawNodes); + $this->_buildResourcesArray($child, $resourceName, $level+1, $represent2Darray, $rawNodes, $module); } if ($rawNodes) { return $resource; diff --git a/app/code/core/Mage/Admin/Model/Session.php b/app/code/core/Mage/Admin/Model/Session.php index 145fe76888..5e80ac643c 100644 --- a/app/code/core/Mage/Admin/Model/Session.php +++ b/app/code/core/Mage/Admin/Model/Session.php @@ -1,147 +1,182 @@ - - */ -class Mage_Admin_Model_Session extends Mage_Core_Model_Session_Abstract -{ - public function __construct() - { - $this->init('admin'); - } - - public function login($username, $password, $request=null) - { - if (empty($username) || empty($password)) { - return; - } - - $user = Mage::getModel('admin/user')->login($username, $password); - if ( $user->getId() && $user->getIsActive() != '1' ) { - if ($request && !$request->getParam('messageSent')) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Your Account has been deactivated.')); - $request->setParam('messageSent', true); - } - } elseif (!Mage::getModel('admin/user')->hasAssigned2Role($user->getId())) { - if ($request && !$request->getParam('messageSent')) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Access Denied.')); - $request->setParam('messageSent', true); - } - } else { - if ($user->getId()) { - $session = Mage::getSingleton('admin/session'); - $session->setIsFirstVisit(true); - $session->setUser($user); - $session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl()); - if ($request) { - /** - * Added hack as $_GET['ft'] param for redirecting to dashboard - * if _prepareDownloadResponse used when user is not logged in - */ - $requestUriInfo = parse_url($request->getRequestUri()); - if (isset($requestUriInfo['query']) && $requestUriInfo['query'] != '') { - $requestUriPostfix = '&ft'; - } else { - $requestUriPostfix = '?ft'; - } - - header('Location: '.$request->getRequestUri() . $requestUriPostfix); - exit; - } - } else { - if ($request && !$request->getParam('messageSent')) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Invalid Username or Password.')); - $request->setParam('messageSent', true); - } - } - } - return $user; - } - - public function refreshAcl($user=null) - { - if (is_null($user)) { - $user = $this->getUser(); - } - if (!$user) { - return $this; - } - if (!$this->getAcl() || $user->getReloadAclFlag()) { - $this->setAcl(Mage::getResourceModel('admin/acl')->loadAcl()); - } - if ($user->getReloadAclFlag()) { - $user->unsetData('password'); - $user->setReloadAclFlag('0')->save(); - } - return $this; - } - - /** - * Check current user permission on resource and privilege - * - * Mage::getSingleton('admin/session')->isAllowed('admin/catalog') - * Mage::getSingleton('admin/session')->isAllowed('catalog') - * - * @param string $resource - * @param string $privilege - * @return bool - */ - public function isAllowed($resource, $privilege=null) - { - $user = $this->getUser(); - $acl = $this->getAcl(); - - if ($user && $acl) { - if (!preg_match('/^admin/', $resource)) { - $resource = 'admin/'.$resource; - } - - try { - if ($acl->isAllowed($user->getAclRole(), 'all', null)){ - return true; - } - } catch (Exception $e) {} - - try { - return $acl->isAllowed($user->getAclRole(), $resource, $privilege); - } catch (Exception $e) { - return false; - } - } - return false; - } - - public function isLoggedIn() - { - return $this->getUser() && $this->getUser()->getId(); - } + + */ +class Mage_Admin_Model_Session extends Mage_Core_Model_Session_Abstract +{ + + /** + * Whether it is the first page after successfull login + * + * @var boolean + */ + protected $_isFirstPageAfterLogin; + + /** + * Class constructor + * + */ + public function __construct() + { + $this->init('admin'); + } + + /** + * Try to login user in admin + * + * @param string $username + * @param string $password + * @param Mage_Core_Controller_Request_Http $request + * @return Mage_Admin_Model_User|null + */ + public function login($username, $password, $request=null) + { + if (empty($username) || empty($password)) { + return; + } + + $user = Mage::getModel('admin/user')->login($username, $password); + if ( $user->getId() && $user->getIsActive() != '1' ) { + if ($request && !$request->getParam('messageSent')) { + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Your Account has been deactivated.')); + $request->setParam('messageSent', true); + } + } elseif (!Mage::getModel('admin/user')->hasAssigned2Role($user->getId())) { + if ($request && !$request->getParam('messageSent')) { + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Access Denied.')); + $request->setParam('messageSent', true); + } + } else { + if ($user->getId()) { + $session = Mage::getSingleton('admin/session'); + $session->setIsFirstVisit(true); + $session->setUser($user); + $session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl()); + if ($request) { + header('Location: ' . $request->getRequestUri()); + exit; + } + + } else { + if ($request && !$request->getParam('messageSent')) { + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Invalid Username or Password.')); + $request->setParam('messageSent', true); + } + } + } + return $user; + } + + /** + * Refresh ACL resources stored in session + * + * @param Mage_Admin_Model_User $user + * @return Mage_Admin_Model_Session + */ + public function refreshAcl($user=null) + { + if (is_null($user)) { + $user = $this->getUser(); + } + if (!$user) { + return $this; + } + if (!$this->getAcl() || $user->getReloadAclFlag()) { + $this->setAcl(Mage::getResourceModel('admin/acl')->loadAcl()); + } + if ($user->getReloadAclFlag()) { + $user->unsetData('password'); + $user->setReloadAclFlag('0')->save(); + } + return $this; + } + + /** + * Check current user permission on resource and privilege + * + * Mage::getSingleton('admin/session')->isAllowed('admin/catalog') + * Mage::getSingleton('admin/session')->isAllowed('catalog') + * + * @param string $resource + * @param string $privilege + * @return boolean + */ + public function isAllowed($resource, $privilege=null) + { + $user = $this->getUser(); + $acl = $this->getAcl(); + + if ($user && $acl) { + if (!preg_match('/^admin/', $resource)) { + $resource = 'admin/'.$resource; + } + + try { + if ($acl->isAllowed($user->getAclRole(), 'all', null)){ + return true; + } + } catch (Exception $e) {} + + try { + return $acl->isAllowed($user->getAclRole(), $resource, $privilege); + } catch (Exception $e) { + return false; + } + } + return false; + } + + /** + * Check if user is logged in + * + * @return boolean + */ + public function isLoggedIn() + { + return $this->getUser() && $this->getUser()->getId(); + } + + /** + * Check if it is the first page after successfull login + * + * @return boolean + */ + public function isFirstPageAfterLogin() + { + if (is_null($this->_isFirstPageAfterLogin)) { + $this->_isFirstPageAfterLogin = $this->getData('is_first_visit', true); + } + return $this->_isFirstPageAfterLogin; + } + } \ No newline at end of file diff --git a/app/code/core/Mage/Admin/Model/User.php b/app/code/core/Mage/Admin/Model/User.php index f648a091b6..b80af6f995 100644 --- a/app/code/core/Mage/Admin/Model/User.php +++ b/app/code/core/Mage/Admin/Model/User.php @@ -1,256 +1,307 @@ -_init('admin/user'); - } - - public function save() { - - $data = array( - 'firstname' => $this->getFirstname(), - 'lastname' => $this->getLastname(), - 'email' => $this->getEmail(), - 'modified' => now(), - 'extra' => serialize($this->getExtra()) - ); - - if($this->getId() > 0) { - $data['user_id'] = $this->getId(); - } - - if( $this->getUsername() ) { - $data['username'] = $this->getUsername(); - } - - if ($this->getPassword()) { - $data['password'] = $this->_getEncodedPassword($this->getPassword()); - } - - if ($this->getNewPassword()) { - $data['password'] = $this->_getEncodedPassword($this->getNewPassword()); - } - - if ( !is_null($this->getIsActive()) ) { - $data['is_active'] = intval($this->getIsActive()); - } - - $this->setData($data); - $this->_getResource()->save($this); - return $this; - } - - public function delete() - { - $this->_getResource()->delete($this); - return $this; - } - - public function saveRelations() - { - $this->_getResource()->_saveRelations($this); - return $this; - } - - public function getRoles() - { - return $this->_getResource()->_getRoles($this); - } - - public function deleteFromRole() - { - $this->_getResource()->deleteFromRole($this); - return $this; - } - - public function roleUserExists() - { - $result = $this->_getResource()->roleUserExists($this); - return ( is_array($result) && count($result) > 0 ) ? true : false; - } - - public function add() - { - $this->_getResource()->add($this); - return $this; - } - - public function userExists() - { - $result = $this->_getResource()->userExists($this); - return ( is_array($result) && count($result) > 0 ) ? true : false; - } - - public function getCollection() { - return Mage::getResourceModel('admin/user_collection'); - } - - /** - * Send email with new user password - * - * @return Mage_Admin_Model_User - */ - public function sendNewPasswordEmail() - { - $translate = Mage::getSingleton('core/translate'); - /* @var $translate Mage_Core_Model_Translate */ - $translate->setTranslateInline(false); - - Mage::getModel('core/email_template') - ->setDesignConfig(array('area'=>'adminhtml', 'store'=>$this->getStoreId())) - ->sendTransactional( - Mage::getStoreConfig(self::XML_PATH_FORGOT_EMAIL_TEMPLATE), - Mage::getStoreConfig(self::XML_PATH_FORGOT_EMAIL_IDENTITY), - $this->getEmail(), - $this->getName(), - array('user'=>$this, 'password'=>$this->getPlainPassword())); - - $translate->setTranslateInline(true); - - return $this; - } - - public function getName($separator=' ') - { - return $this->getFirstname().$separator.$this->getLastname(); - } - - public function getId() - { - return $this->getUserId(); - } - - /** - * Get user ACL role - * - * @return string - */ - public function getAclRole() - { - return 'U'.$this->getUserId(); - } - - /** - * Authenticate user name and password and save loaded record - * - * @param string $username - * @param string $password - * @return boolean - */ - public function authenticate($username, $password) - { - $this->loadByUsername($username); - if (!$this->getId()) { - return false; - } - $auth = Mage::helper('core')->validateHash($password, $this->getPassword()); - if ($auth) { - return true; - } else { - $this->unsetData(); - return false; - } - } - - /** - * Login user - * - * @param string $login - * @param string $password - * @return Mage_Admin_Model_User - */ - public function login($username, $password) - { - if ($this->authenticate($username, $password)) { - $this->getResource()->recordLogin($this); - } - - return $this; - } - - public function reload() - { - $id = $this->getId(); - $this->setId(null); - $this->load($id); - return $this; - } - - public function loadByUsername($username) - { - $this->setData($this->getResource()->loadByUsername($username)); - return $this; - } - - public function hasAssigned2Role($user) - { - return $this->getResource()->hasAssigned2Role($user); - } - - protected function _getEncodedPassword($pwd) - { - return Mage::helper('core')->getHash($pwd, 2); - } - - public function findFirstAvailableMenu($parent=null, $path='', $level=0) - { - if ($parent == null) { - $parent = Mage::getConfig()->getNode('adminhtml/menu'); - } - foreach ($parent->children() as $childName=>$child) { - $aclResource = 'admin/'.$path.$childName; - if (Mage::getSingleton('admin/session')->isAllowed($aclResource)) { - if (!$child->children) { - return (string)$child->action; - } else if ($child->children) { - $action = $this->findFirstAvailableMenu($child->children, $path.$childName.'/', $level+1); - return $action?$action:(string)$child->action; - } - } - } - } - - public function getStatrupPageUrl() - { - $startupPage = Mage::getStoreConfig(self::XML_PATH_STARTUP_PAGE); - $aclResource = 'admin/'.$startupPage; - if (Mage::getSingleton('admin/session')->isAllowed($aclResource)) { - $nodePath = 'adminhtml/menu/' . join('/children/', split('/', $startupPage)) . '/action'; - if ($url = Mage::getConfig()->getNode($nodePath)) { - return $url; - } - } - - return $this->findFirstAvailableMenu(); - } -} \ No newline at end of file + + */ +class Mage_Admin_Model_User extends Mage_Core_Model_Abstract +{ + + const XML_PATH_FORGOT_EMAIL_TEMPLATE = 'admin/emails/forgot_email_template'; + const XML_PATH_FORGOT_EMAIL_IDENTITY = 'admin/emails/forgot_email_identity'; + const XML_PATH_STARTUP_PAGE = 'admin/startup/page'; + + /** + * Varien constructor + */ + protected function _construct() + { + $this->_init('admin/user'); + } + + /** + * Save user + * + * @return Mage_Admin_Model_User + */ + public function save() + { + $data = array( + 'firstname' => $this->getFirstname(), + 'lastname' => $this->getLastname(), + 'email' => $this->getEmail(), + 'modified' => now(), + 'extra' => serialize($this->getExtra()) + ); + + if($this->getId() > 0) { + $data['user_id'] = $this->getId(); + } + + if( $this->getUsername() ) { + $data['username'] = $this->getUsername(); + } + + if ($this->getPassword()) { + $data['password'] = $this->_getEncodedPassword($this->getPassword()); + } + + if ($this->getNewPassword()) { + $data['password'] = $this->_getEncodedPassword($this->getNewPassword()); + } + + if ( !is_null($this->getIsActive()) ) { + $data['is_active'] = intval($this->getIsActive()); + } + + $this->setData($data); + $this->_getResource()->save($this); + return $this; + } + + /** + * Delete user + * + * @return Mage_Admin_Model_User + */ + public function delete() + { + $this->_getResource()->delete($this); + return $this; + } + + /** + * Save user roles + * + * @return Mage_Admin_Model_User + */ + public function saveRelations() + { + $this->_getResource()->_saveRelations($this); + return $this; + } + + public function getRoles() + { + return $this->_getResource()->_getRoles($this); + } + + public function deleteFromRole() + { + $this->_getResource()->deleteFromRole($this); + return $this; + } + + public function roleUserExists() + { + $result = $this->_getResource()->roleUserExists($this); + return ( is_array($result) && count($result) > 0 ) ? true : false; + } + + public function add() + { + $this->_getResource()->add($this); + return $this; + } + + public function userExists() + { + $result = $this->_getResource()->userExists($this); + return ( is_array($result) && count($result) > 0 ) ? true : false; + } + + public function getCollection() { + return Mage::getResourceModel('admin/user_collection'); + } + + /** + * Send email with new user password + * + * @return Mage_Admin_Model_User + */ + public function sendNewPasswordEmail() + { + $translate = Mage::getSingleton('core/translate'); + /* @var $translate Mage_Core_Model_Translate */ + $translate->setTranslateInline(false); + + Mage::getModel('core/email_template') + ->setDesignConfig(array('area' => 'adminhtml', 'store' => $this->getStoreId())) + ->sendTransactional( + Mage::getStoreConfig(self::XML_PATH_FORGOT_EMAIL_TEMPLATE), + Mage::getStoreConfig(self::XML_PATH_FORGOT_EMAIL_IDENTITY), + $this->getEmail(), + $this->getName(), + array('user' => $this, 'password' => $this->getPlainPassword())); + + $translate->setTranslateInline(true); + + return $this; + } + + public function getName($separator=' ') + { + return $this->getFirstname() . $separator . $this->getLastname(); + } + + public function getId() + { + return $this->getUserId(); + } + + /** + * Get user ACL role + * + * @return string + */ + public function getAclRole() + { + return 'U' . $this->getUserId(); + } + + /** + * Authenticate user name and password and save loaded record + * + * @param string $username + * @param string $password + * @return boolean + */ + public function authenticate($username, $password) + { + $this->loadByUsername($username); + if (!$this->getId()) { + return false; + } + $auth = Mage::helper('core')->validateHash($password, $this->getPassword()); + if ($auth) { + return true; + } else { + $this->unsetData(); + return false; + } + } + + /** + * Login user + * + * @param string $login + * @param string $password + * @return Mage_Admin_Model_User + */ + public function login($username, $password) + { + if ($this->authenticate($username, $password)) { + $this->getResource()->recordLogin($this); + } + + return $this; + } + + public function reload() + { + $id = $this->getId(); + $this->setId(null); + $this->load($id); + return $this; + } + + public function loadByUsername($username) + { + $this->setData($this->getResource()->loadByUsername($username)); + return $this; + } + + public function hasAssigned2Role($user) + { + return $this->getResource()->hasAssigned2Role($user); + } + + protected function _getEncodedPassword($pwd) + { + return Mage::helper('core')->getHash($pwd, 2); + } + + /** + * Find first menu item that user is able to access + * + * @param Mage_Core_Model_Config_Element $parent + * @param string $path + * @param integer $level + * @return string + */ + public function findFirstAvailableMenu($parent=null, $path='', $level=0) + { + if ($parent == null) { + $parent = Mage::getConfig()->getNode('adminhtml/menu'); + } + foreach ($parent->children() as $childName=>$child) { + $aclResource = 'admin/' . $path . $childName; + if (Mage::getSingleton('admin/session')->isAllowed($aclResource)) { + if (!$child->children) { + return (string)$child->action; + } else if ($child->children) { + $action = $this->findFirstAvailableMenu($child->children, $path . $childName . '/', $level+1); + return $action ? $action : (string)$child->action; + } + } + } + } + + /** + * Find admin start page url + * + * @deprecated Please use getStartupPageUrl() method instead + * @see getStartupPageUrl() + * @return string + */ + public function getStatrupPageUrl() + { + return $this->getStartupPageUrl(); + } + + /** + * Find admin start page url + * + * @return string + */ + public function getStartupPageUrl() + { + $startupPage = Mage::getStoreConfig(self::XML_PATH_STARTUP_PAGE); + $aclResource = 'admin/' . $startupPage; + if (Mage::getSingleton('admin/session')->isAllowed($aclResource)) { + $nodePath = 'adminhtml/menu/' . join('/children/', split('/', $startupPage)) . '/action'; + if ($url = Mage::getConfig()->getNode($nodePath)) { + return $url; + } + } + return $this->findFirstAvailableMenu(); + } + +} diff --git a/app/code/core/Mage/Admin/etc/admin.xml b/app/code/core/Mage/Admin/etc/admin.xml deleted file mode 100644 index a89ac2a023..0000000000 --- a/app/code/core/Mage/Admin/etc/admin.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - Mage_Admin_Model_Acl_Assert_Ip - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /checkout/onepage - /checkout/multishipping - + + /checkout/onepage + /checkout/multishipping + @@ -164,7 +164,7 @@ - + 100 Terms and conditions adminhtml/checkout_agreement/ @@ -179,12 +179,24 @@ - + Terms and Conditions 50 + + + + + + Checkout Section + 70 + + + + + diff --git a/app/code/core/Mage/Cms/Controller/Router.php b/app/code/core/Mage/Cms/Controller/Router.php index 70c2b03058..647006d66e 100644 --- a/app/code/core/Mage/Cms/Controller/Router.php +++ b/app/code/core/Mage/Cms/Controller/Router.php @@ -36,7 +36,7 @@ public function initControllerRouters($observer) public function match(Zend_Controller_Request_Http $request) { - if (!Mage::app()->isInstalled()) { + if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse() ->setRedirect(Mage::getUrl('install')) ->sendResponse(); diff --git a/app/code/core/Mage/Cms/etc/config.xml b/app/code/core/Mage/Cms/etc/config.xml index 9fecabe471..b0fd78d062 100644 --- a/app/code/core/Mage/Cms/etc/config.xml +++ b/app/code/core/Mage/Cms/etc/config.xml @@ -103,19 +103,19 @@ - + CMS 70 - + Static Blocks 0 - + Manage Pages 10 - + Poll Manager 20 diff --git a/app/code/core/Mage/Contacts/controllers/IndexController.php b/app/code/core/Mage/Contacts/controllers/IndexController.php index 82d131a28b..ad5866ed6e 100644 --- a/app/code/core/Mage/Contacts/controllers/IndexController.php +++ b/app/code/core/Mage/Contacts/controllers/IndexController.php @@ -70,9 +70,26 @@ public function postAction() $postObject = new Varien_Object(); $postObject->setData($post); + $error = false; + + if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) { + $error = true; + } + + if (!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) { + $error = true; + } + + if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) { + $error = true; + } + if ($error) { + throw new Exception(); + } $mailTemplate = Mage::getModel('core/email_template'); /* @var $mailTemplate Mage_Core_Model_Email_Template */ $mailTemplate->setDesignConfig(array('area' => 'frontend')) + ->setReplyTo($post['email']) ->sendTransactional( Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE), Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER), diff --git a/app/code/core/Mage/Contacts/etc/config.xml b/app/code/core/Mage/Contacts/etc/config.xml index 05e03c84c4..4a6c5e3381 100644 --- a/app/code/core/Mage/Contacts/etc/config.xml +++ b/app/code/core/Mage/Contacts/etc/config.xml @@ -98,7 +98,7 @@ - + Contacts Section diff --git a/app/code/core/Mage/Core/Block/Abstract.php b/app/code/core/Mage/Core/Block/Abstract.php index 30c34a56a0..e9636e8ff6 100644 --- a/app/code/core/Mage/Core/Block/Abstract.php +++ b/app/code/core/Mage/Core/Block/Abstract.php @@ -141,7 +141,7 @@ protected function _construct() /** * Retrieve request object * - * @return Zend_Controller_Request_Http + * @return Mage_Core_Controller_Request_Http */ public function getRequest() { @@ -923,11 +923,12 @@ protected function _saveCache($data) * Escape html entities * * @param mixed $data + * @param array $allowedTags * @return mixed */ - public function htmlEscape($data) + public function htmlEscape($data, $allowedTags = null) { - return $this->helper('core')->htmlEscape($data); + return $this->helper('core')->htmlEscape($data, $allowedTags); } /** diff --git a/app/code/core/Mage/Core/Controller/Front/Action.php b/app/code/core/Mage/Core/Controller/Front/Action.php index 251f4ab4a9..3f93015164 100644 --- a/app/code/core/Mage/Core/Controller/Front/Action.php +++ b/app/code/core/Mage/Core/Controller/Front/Action.php @@ -33,7 +33,6 @@ */ class Mage_Core_Controller_Front_Action extends Mage_Core_Controller_Varien_Action { - /** * Predispatch: shoud set layout area * @@ -71,5 +70,4 @@ public function __() array_unshift($args, $expr); return Mage::app()->getTranslator()->translate($args); } - } diff --git a/app/code/core/Mage/Core/Controller/Request/Http.php b/app/code/core/Mage/Core/Controller/Request/Http.php index a053c91a20..3a3f4d353e 100644 --- a/app/code/core/Mage/Core/Controller/Request/Http.php +++ b/app/code/core/Mage/Core/Controller/Request/Http.php @@ -63,7 +63,7 @@ public function getStoreCodeFromPath() { if (!$this->_storeCode) { // get store view code - if (Mage::app()->isInstalled() && Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL)) { + if (Mage::isInstalled() && Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL)) { $p = explode('/', trim($this->getPathInfo(), '/')); $storeCode = $p[0]; @@ -115,7 +115,7 @@ public function setPathInfo($pathInfo = null) $pathInfo = $requestUri; } - if (Mage::app()->isInstalled() && Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL)) { + if (Mage::isInstalled() && Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL)) { $p = explode('/', ltrim($pathInfo, '/'), 2); $storeCode = $p[0]; $stores = Mage::app()->getStores(true, true); diff --git a/app/code/core/Mage/Core/Controller/Varien/Action.php b/app/code/core/Mage/Core/Controller/Varien/Action.php index 2ca1ed190c..a8da5c1a46 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Action.php +++ b/app/code/core/Mage/Core/Controller/Varien/Action.php @@ -36,7 +36,6 @@ */ abstract class Mage_Core_Controller_Varien_Action { - const FLAG_NO_CHECK_INSTALLATION = 'no-install-check'; const FLAG_NO_DISPATCH = 'no-dispatch'; const FLAG_NO_PRE_DISPATCH = 'no-preDispatch'; @@ -110,7 +109,7 @@ public function hasAction($action) /** * Retrieve request object * - * @return Zend_Controller_Request_Abstract + * @return Mage_Core_Controller_Request_Http */ public function getRequest() { @@ -120,7 +119,7 @@ public function getRequest() /** * Retrieve response object * - * @return Zend_Controller_Response_Abstract + * @return Mage_Core_Controller_Response_Http */ public function getResponse() { @@ -365,7 +364,7 @@ public function getActionMethodName($action) public function preDispatch() { if (!$this->getFlag('', self::FLAG_NO_CHECK_INSTALLATION)) { - if (!Mage::app()->isInstalled()) { + if (!Mage::isInstalled()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); $this->_redirect('install'); return; @@ -661,4 +660,18 @@ protected function _rewrite() return true; } + + /** + * Validate Form Key + * + * @return bool + */ + protected function _validateFormKey() + { + if (!($formKey = $this->getRequest()->getParam('form_key', null)) + || $formKey != Mage::getSingleton('core/session')->getFormKey()) { + return false; + } + return true; + } } diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php b/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php index 5c924d9906..70523ed633 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php @@ -72,7 +72,7 @@ public function match(Zend_Controller_Request_Http $request) $request->setRouteName($this->getRouteByFrontName($module)); - if (!Mage::app()->isInstalled()) { + if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse() ->setRedirect(Mage::getUrl('install')) ->sendResponse(); diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php index 01b6d1ed4d..56845be250 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php @@ -238,7 +238,7 @@ public function rewrite(array $p) protected function _checkShouldBeSecure($request, $path='') { - if (!Mage::app()->isInstalled() || $request->getPost()) { + if (!Mage::isInstalled() || $request->getPost()) { return; } diff --git a/app/code/core/Mage/Core/Helper/Abstract.php b/app/code/core/Mage/Core/Helper/Abstract.php index b9ab66c89f..5b4bb95fc9 100644 --- a/app/code/core/Mage/Core/Helper/Abstract.php +++ b/app/code/core/Mage/Core/Helper/Abstract.php @@ -142,19 +142,31 @@ public function __() } /** - * Escape data + * Escape html entities * * @param mixed $data + * @param array $allowedTags * @return mixed */ - public function htmlEscape($data) + public function htmlEscape($data, $allowedTags = null) { if (is_array($data)) { + $result = array(); foreach ($data as $item) { - return $this->htmlEscape($item); + $result[] = $this->htmlEscape($item); + } + } else { + // process single item + if (is_array($allowedTags) and !empty($allowedTags)) { + $allowed = implode('|', $allowedTags); + $result = preg_replace('/<([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)>/si', '##$1$2$3##', $data); + $result = htmlspecialchars($result); + $result = preg_replace('/##([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)##/si', '<$1$2$3>', $result); + } else { + $result = htmlspecialchars($data); } } - return htmlspecialchars($data); + return $result; } /** @@ -167,9 +179,11 @@ public function htmlEscape($data) public function jsQuoteEscape($data, $quote='\'') { if (is_array($data)) { + $result = array(); foreach ($data as $item) { - return $this->jsEscape($item, $quote); + $result[] = str_replace($quote, '\\'.$quote, $item); } + return $result; } return str_replace($quote, '\\'.$quote, $data); } diff --git a/app/code/core/Mage/Core/Helper/Data.php b/app/code/core/Mage/Core/Helper/Data.php index 8f4fd98565..9bd2f7d54b 100644 --- a/app/code/core/Mage/Core/Helper/Data.php +++ b/app/code/core/Mage/Core/Helper/Data.php @@ -157,7 +157,7 @@ public function formatTime($time=null, $format='short', $showDate=false) */ public function encrypt($data) { - if (!Mage::app()->isInstalled()) { + if (!Mage::isInstalled()) { return $data; } $result = base64_encode($this->_getCrypt()->encrypt((string)$data)); @@ -172,7 +172,7 @@ public function encrypt($data) */ public function decrypt($data) { - if (!Mage::app()->isInstalled()) { + if (!Mage::isInstalled()) { return $data; } $result = trim($this->_getCrypt()->decrypt(base64_decode((string)$data))); @@ -299,6 +299,11 @@ public function isDevAllowed($storeId=null) return $allow; } + /** + * Get information about available cache types + * + * @return array + */ public function getCacheTypes() { $types = array(); @@ -309,6 +314,21 @@ public function getCacheTypes() return $types; } + /** + * Get information about available cache beta types + * + * @return array + */ + public function getCacheBetaTypes() + { + $types = array(); + $config = Mage::getConfig()->getNode('global/cache/betatypes'); + foreach ($config->children() as $type=>$node) { + $types[$type] = (string)$node->label; + } + return $types; + } + /** * Copy data from object|array to object|array containing fields * from fieldset matching an aspect. diff --git a/app/code/core/Mage/Core/Helper/String.php b/app/code/core/Mage/Core/Helper/String.php index 6fa253db86..ba872a7c55 100644 --- a/app/code/core/Mage/Core/Helper/String.php +++ b/app/code/core/Mage/Core/Helper/String.php @@ -227,4 +227,31 @@ public function str_split($str, $length = 1, $keepWords = false, $trim = false, } return $result; } + + /** + * Split words + * + * @param string $str The source string + * @param bool $uniqueOnly Unique words only + * @param int $maxWordLenght Limit words count + * @param string $wordSeparatorRegexp + * @return array + */ + function splitWords($str, $uniqueOnly = false, $maxWordLenght = 0, $wordSeparatorRegexp = '\s') + { + $result = array(); + $split = preg_split('#' . $wordSeparatorRegexp . '#si', $str, null, PREG_SPLIT_NO_EMPTY); + foreach ($split as $key => $word) { + if ($uniqueOnly) { + $result[$word] = $word; + } + else { + $result[] = $word; + } + } + if ($maxWordLenght && count($result) > $maxWordLenght) { + $result = array_slice($result, 0, $maxWordLenght); + } + return $result; + } } diff --git a/app/code/core/Mage/Core/Model/App.php b/app/code/core/Mage/Core/Model/App.php index 0b8b7da4b9..e0dceb4305 100644 --- a/app/code/core/Mage/Core/Model/App.php +++ b/app/code/core/Mage/Core/Model/App.php @@ -18,24 +18,24 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Mage - * @package Mage_Core - * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @category Mage + * @package Mage_Core + * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Application model * * Application should have: areas, store, locale, translator, design package * - * @category Mage - * @package Mage_Core + * @category Mage + * @package Mage_Core * @author Magento Core Team */ class Mage_Core_Model_App { + const XML_PATH_INSTALL_DATE = 'global/install/date'; const DEFAULT_ERROR_HANDLER = 'mageCoreErrorHandler'; @@ -148,21 +148,21 @@ class Mage_Core_Model_App * * @var array */ - protected $_websites; + protected $_websites = array(); /** * Groups cache * * @var array */ - protected $_groups; + protected $_groups = array(); /** * Stores cache * * @var array */ - protected $_stores; + protected $_stores = array(); /** * is a single store mode @@ -214,8 +214,6 @@ class Mage_Core_Model_App */ protected $_useSessionVar = false; - static protected $_isInstalled = NULL; - /** * Constructor * @@ -242,7 +240,7 @@ public function init($code, $type=null, $options=array()) $this->_config = Mage::getConfig(); $this->_config->init($options); - if ($this->isInstalled()) { + if (Mage::isInstalled($options)) { $this->_initStores(); if (empty($code) && !is_null($this->_website)) { @@ -440,7 +438,7 @@ protected function _initStores() */ public function isSingleStoreMode() { - if (!$this->isInstalled()) { + if (!Mage::isInstalled()) { return false; } return $this->_isSingleStore; @@ -563,7 +561,7 @@ public function getArea($code) */ public function getStore($id=null) { - if (!$this->isInstalled() || $this->getUpdateMode()) { + if (!Mage::isInstalled() || $this->getUpdateMode()) { return $this->_getDefaultStore(); } @@ -852,18 +850,12 @@ public function getFrontController() /** * Retrieve application installation flag * + * @deprecated since 1.2 * @return bool */ public function isInstalled() { - if (self::$_isInstalled === null) { - $installDate = Mage::getConfig()->getNode(self::XML_PATH_INSTALL_DATE); - $installDate = (string)$installDate; - if ($installDate && strtotime($installDate)) { - self::$_isInstalled = true; - } - } - return self::$_isInstalled; + return Mage::isInstalled(); } /** @@ -908,15 +900,33 @@ public function getCache() if (extension_loaded('apc') && ini_get('apc.enabled') && $backend=='apc') { $backend = 'Apc'; $backendAttributes = array( - 'cache_prefix' => (string)Mage::getConfig()->getNode('global/cache/prefix') + 'cache_prefix' => (string)Mage::getConfig()->getNode('global/cache/prefix') ); + } elseif ('memcached' == $backend && extension_loaded('memcache')) { + $backend = 'Memcached'; + $memcachedConfig = Mage::getConfig()->getNode('global/cache/memcached'); + $backendAttributes = array( + 'compression' => (bool)$memcachedConfig->compression, + 'cache_dir' => (string)$memcachedConfig->cache_dir, + 'hashed_directory_level' => (string)$memcachedConfig->hashed_directory_level, + 'hashed_directory_umask' => (string)$memcachedConfig->hashed_directory_umask, + 'file_name_prefix' => (string)$memcachedConfig->file_name_prefix, + 'servers' => array(), + ); + foreach ($memcachedConfig->servers->children() as $serverConfig) { + $backendAttributes['servers'][] = array( + 'host' => (string)$serverConfig->host, + 'port' => (string)$serverConfig->port, + 'persistent' => (string)$serverConfig->persistent, + ); + } } else { $backend = 'File'; $backendAttributes = array( - 'cache_dir'=>Mage::getBaseDir('cache'), - 'hashed_directory_level'=>1, - 'hashed_directory_umask'=>0777, - 'file_name_prefix'=>'mage', + 'cache_dir' => Mage::getBaseDir('cache'), + 'hashed_directory_level' => 1, + 'hashed_directory_umask' => 0777, + 'file_name_prefix' => 'mage', ); } $lifetime = Mage::getConfig()->getNode('global/cache/lifetime'); @@ -928,9 +938,9 @@ public function getCache() } $this->_cache = Zend_Cache::factory('Core', $backend, array( - 'caching'=>true, - 'lifetime'=>$lifetime, - 'automatic_cleaning_factor'=>0, + 'caching' => true, + 'lifetime' => $lifetime, + 'automatic_cleaning_factor' => 0, ), $backendAttributes ); @@ -991,11 +1001,10 @@ public function cleanCache($tags=array()) $tags = $this->_getCacheTags($tags); $this->getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, $tags); } else { - /*$cacheDir = Mage::getConfig()->getOptions()->getCacheDir(); - mageDelTree($cacheDir); - mkdir($cacheDir, 0777);*/ $this->getCache()->clean(Zend_Cache::CLEANING_MODE_ALL); } + + Mage::dispatchEvent('application_clean_cache', array('tags' => $tags)); return $this; } @@ -1190,4 +1199,5 @@ public function getUseSessionVar() { return $this->_useSessionVar; } + } diff --git a/app/code/core/Mage/Core/Model/Config.php b/app/code/core/Mage/Core/Model/Config.php index 76b38a4c35..c03be3d8cd 100644 --- a/app/code/core/Mage/Core/Model/Config.php +++ b/app/code/core/Mage/Core/Model/Config.php @@ -143,7 +143,7 @@ public function init($options=array()) ); } - if (Mage::app()->isInstalled()) { + if (Mage::isInstalled()) { if (Mage::app()->useCache('config')) { Varien_Profiler::start('config/load-cache'); $loaded = $this->loadCache(); @@ -239,13 +239,54 @@ public function saveCache($tags=array()) return $this; } - protected function _loadDeclaredModules($mergeConfig) + /** + * Retrive Declared Module file list + * + * @return array + */ + protected function _getDeclaredModuleFiles() { $etcDir = $this->getOptions()->getEtcDir(); - $moduleFiles = glob($etcDir.DS.'modules'.DS.'*.xml'); + $moduleFiles = glob($etcDir . DS . 'modules' . DS . '*.xml'); + + if (!$moduleFiles) { + return false; + } + + $collectModuleFiles = array( + 'base' => array(), + 'mage' => array(), + 'custom' => array() + ); + + foreach ($moduleFiles as $v) { + $name = explode(DIRECTORY_SEPARATOR, $v); + $name = substr($name[count($name) - 1], 0, -4); + + if ($name == 'Mage_All') { + $collectModuleFiles['base'][] = $v; + } + elseif (substr($name, 0, 5) == 'Mage_') { + $collectModuleFiles['mage'][] = $v; + } + else { + $collectModuleFiles['custom'][] = $v; + } + } + return array_merge( + $collectModuleFiles['base'], + $collectModuleFiles['mage'], + $collectModuleFiles['custom'] + ); + } + + protected function _loadDeclaredModules($mergeConfig) + { + $moduleFiles = $this->_getDeclaredModuleFiles(); if (!$moduleFiles) { - return; + return ; } + Varien_Profiler::start('config/load-modules-declaration'); $unsortedConfig = new Mage_Core_Model_Config_Base(); @@ -258,58 +299,86 @@ protected function _loadDeclaredModules($mergeConfig) $unsortedConfig->extend($fileConfig); } - $unsortedModules = array(); - $sortedModules = array(); - - // prepare unsorted modules with links - foreach ($unsortedConfig->getNode('modules')->children() as $moduleName=>$moduleConfig) { - if (!isset($unsortedModules[$moduleName])) { - $unsortedModules[$moduleName] = array(); - } - if ($moduleConfig->depends) { - foreach ($moduleConfig->depends->children() as $dependName=>$depend) { - $unsortedModules[$moduleName]['parents'][$dependName] = true; - if (!isset($unsortedModules[$dependName])) { - $unsortedModules[$dependName] = array(); - } - $unsortedModules[$dependName]['children'][$moduleName] = true; + $moduleDepends = array(); + foreach ($unsortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) { + $depends = array(); + if ($moduleNode->depends) { + foreach ($moduleNode->depends->children() as $depend) { + $depends[$depend->getName()] = true; } } + $moduleDepends[$moduleName] = array( + 'module' => $moduleName, + 'depends' => $depends + ); } - // sort modules by dependencies - while (!empty($unsortedModules)) { - foreach ($unsortedModules as $moduleName=>$module) { - if (empty($module['parents'])) { - $sortedModules[$moduleName] = $unsortedConfig->getNode('modules/'.$moduleName); - unset($unsortedModules[$moduleName]); - if (!empty($module['children'])) { - foreach ($module['children'] as $childName=>$dummy) { - unset($unsortedModules[$childName]['parents'][$moduleName]); - } - } - break; - } - } - } + // check and sort module dependens + $moduleDepends = $this->_sortModuleDepends($moduleDepends); - // add sorted modules to configuration xml + // create sorted config $sortedConfig = new Mage_Core_Model_Config_Base(); $sortedConfig->loadString(''); - foreach ($unsortedConfig->getNode()->children() as $nodeName=>$node) { - if ($nodeName!=='modules') { + + foreach ($unsortedConfig->getNode()->children() as $nodeName => $node) { + if ($nodeName != 'modules') { $sortedConfig->getNode()->appendChild($node); } } - $modulesConfig = $sortedConfig->getNode('modules'); - foreach ($sortedModules as $moduleName=>$moduleConfig) { - $modulesConfig->appendChild($moduleConfig); + + foreach ($moduleDepends as $moduleProp) { + $node = $unsortedConfig->getNode('modules/'.$moduleProp['module']); + $sortedConfig->getNode('modules')->appendChild($node); } + $this->extend($sortedConfig); Varien_Profiler::stop('config/load-modules-declaration'); } + /** + * Sort modules and check depends + * + * @param array $modules + * @return array + */ + protected function _sortModuleDepends($modules) + { + foreach ($modules as $moduleName => $moduleProps) { + $depends = $moduleProps['depends']; + foreach ($moduleProps['depends'] as $depend => $true) { + $depends = array_merge($depends, $modules[$depend]['depends']); + } + $modules[$moduleName]['depends'] = $depends; + } + $modules = array_values($modules); + + $size = count($modules) - 1; + for ($i = $size; $i >= 0; $i--) { + for ($j = $size; $i < $j; $j--) { + if (isset($modules[$i]['depends'][$modules[$j]['module']])) { + $value = $modules[$i]; + $modules[$i] = $modules[$j]; + $modules[$j] = $value; + } + } + } + + $definedModules = array(); + foreach ($modules as $moduleProp) { + foreach ($moduleProp['depends'] as $dependModule => $true) { + if (!isset($definedModules[$dependModule])) { + Mage::throwException( + Mage::helper('core')->__('Module "%1$s" can not be depended from "%2$s"', $moduleProp['module'], $dependModule) + ); + } + } + $definedModules[$moduleProp['module']] = true; + } + + return $modules; + } + /** * Reinitialize configuration * diff --git a/app/code/core/Mage/Core/Model/Config/Data.php b/app/code/core/Mage/Core/Model/Config/Data.php index f2dd317b99..b1f899c636 100644 --- a/app/code/core/Mage/Core/Model/Config/Data.php +++ b/app/code/core/Mage/Core/Model/Config/Data.php @@ -35,8 +35,7 @@ class Mage_Core_Model_Config_Data extends Mage_Core_Model_Abstract { /** - * Enter description here... - * + * Varien model constructor */ protected function _construct() { @@ -44,12 +43,32 @@ protected function _construct() } /** - * Enter description here... - * + * Add availability call after load as public */ public function afterLoad() { $this->_afterLoad(); } + /** + * Check if config data value was changed + * + * @return bool + */ + public function isValueChanged() + { + $storeCode = $this->getStoreCode(); + $websiteCode = $this->getWebsiteCode(); + $path = $this->getPath(); + + $newValue = $this->getValue(); + if ($websiteCode) { + $oldValue = Mage::app()->getWebsite($websiteCode)->getConfig($path); + } elseif ($storeCode) { + $oldValue = Mage::app()->getStore($storeCode)->getConfig($path); + } else { + $oldValue = (string) Mage::getConfig()->getNode('default/'.$path); + } + return $newValue != $oldValue; + } } diff --git a/app/code/core/Mage/Core/Model/Design/Source/Design.php b/app/code/core/Mage/Core/Model/Design/Source/Design.php index cfbc90ecfd..954e47911b 100644 --- a/app/code/core/Mage/Core/Model/Design/Source/Design.php +++ b/app/code/core/Mage/Core/Model/Design/Source/Design.php @@ -36,7 +36,7 @@ public function getAllOptions($withEmpty = true) $packageOption = array('label'=>$package); $themeOptions = array(); foreach ($themes as $theme) { - $themeOptions[] = array('label'=>$theme, 'value'=>$package . '/' . $theme); + $themeOptions[] = array('label'=>$theme, 'value'=>$package . '/' . $theme); } $packageOption['value'] = $themeOptions; diff --git a/app/code/core/Mage/Core/Model/Email/Template.php b/app/code/core/Mage/Core/Model/Email/Template.php index 236e7865e1..7a85f16dc5 100644 --- a/app/code/core/Mage/Core/Model/Email/Template.php +++ b/app/code/core/Mage/Core/Model/Email/Template.php @@ -278,7 +278,13 @@ public function getProcessedTemplate(array $variables = array()) ->setVariables($variables); $this->_applyDesignConfig(); - $processedResult = $processor->filter($this->getTemplateText()); + try{ + $processedResult = $processor->filter($this->getTemplateText()); + } + catch ( Exception $e) { + $this->_cancelDesignConfig(); + throw $e; + } $this->_cancelDesignConfig(); return $processedResult; } @@ -342,6 +348,8 @@ public function send($email, $name=null, array $variables = array()) $mail->setBodyHTML($text); } + + $mail->setSubject('=?utf-8?B?'.base64_encode($this->getProcessedTemplateSubject($variables)).'?='); $mail->setFrom($this->getSenderEmail(), $this->getSenderName()); @@ -424,7 +432,13 @@ public function getProcessedTemplateSubject(array $variables) $processor->setVariables($variables); $this->_applyDesignConfig(); - $processedResult = $processor->filter($this->getTemplateSubject()); + try{ + $processedResult = $processor->filter($this->getTemplateSubject()); + } + catch ( Exception $e) { + $this->_cancelDesignConfig(); + throw $e; + } $this->_cancelDesignConfig(); return $processedResult; } @@ -528,4 +542,16 @@ public function setReturnPath($email) $this->getMail()->setReturnPath($email); return $this; } + + /** + * Add Reply-To header + * + * @param string $email + * @return Mage_Core_Model_Email_Template + */ + public function setReplyTo($email) + { + $this->getMail()->addHeader('Reply-To', $email); + return $this; + } } \ No newline at end of file diff --git a/app/code/core/Mage/Core/Model/Locale.php b/app/code/core/Mage/Core/Model/Locale.php index 48e9de4c04..d3163bac83 100644 --- a/app/code/core/Mage/Core/Model/Locale.php +++ b/app/code/core/Mage/Core/Model/Locale.php @@ -180,8 +180,8 @@ public function getOptionLocales() { $options = array(); $locales = $this->getLocale()->getLocaleList(); - $languages = $this->getLocale()->getLanguageTranslationList(); - $countries = $this->getLocale()->getCountryTranslationList(); + $languages = $this->getLocale()->getLanguageTranslationList($this->getLocale()); + $countries = $this->getCountryTranslationList(); $allowed = $this->getAllowLocales(); foreach ($locales as $code=>$active) { @@ -210,7 +210,7 @@ public function getOptionLocales() public function getOptionTimezones() { $options= array(); - $zones = $this->getLocale()->getTranslationList('windowstotimezone'); + $zones = $this->getTranslationList('windowstotimezone'); ksort($zones); foreach ($zones as $code=>$name) { $name = trim($name); @@ -230,7 +230,7 @@ public function getOptionTimezones() public function getOptionWeekdays() { $options= array(); - $days = $this->getLocale()->getTranslationList('days'); + $days = $this->getTranslationList('days'); foreach (array_values($days['format']['wide']) as $code => $name) { $options[] = array( 'label' => $name, @@ -248,7 +248,7 @@ public function getOptionWeekdays() public function getOptionCountries() { $options = array(); - $countries = $this->getLocale()->getCountryTranslationList(); + $countries = $this->getCountryTranslationList(); foreach ($countries as $code=>$name) { $options[] = array( @@ -266,7 +266,7 @@ public function getOptionCountries() */ public function getOptionCurrencies() { - $currencies = $this->getLocale()->getTranslationList('currencytoname'); + $currencies = $this->getTranslationList('currencytoname'); $options = array(); $allowed = $this->getAllowCurrencies(); @@ -290,7 +290,7 @@ public function getOptionCurrencies() */ public function getOptionAllCurrencies() { - $currencies = $this->getLocale()->getTranslationList('currencytoname'); + $currencies = $this->getTranslationList('currencytoname'); $options = array(); foreach ($currencies as $name=>$code) { $options[] = array( @@ -340,7 +340,7 @@ public function getAllowLocales() public function getAllowCurrencies() { $data = array(); - if (Mage::app()->isInstalled()) { + if (Mage::isInstalled()) { $data = Mage::app()->getStore()->getConfig(self::XML_PATH_ALLOW_CURRENCIES_INSTALLED); return explode(',', $data); } @@ -361,7 +361,7 @@ public function getAllowCurrencies() */ public function getDateFormat($type=null) { - return $this->getLocale()->getTranslation($type, 'date'); + return $this->getTranslation($type, 'date'); } /** @@ -372,7 +372,7 @@ public function getDateFormat($type=null) */ public function getTimeFormat($type=null) { - return $this->getLocale()->getTranslation($type, 'time'); + return $this->getTranslation($type, 'time'); } /** @@ -457,10 +457,10 @@ public function storeDate($store=null, $date=null, $includeTime=false) } /** - * Create Zend_Currency object for current locale + * Create Mage_Core_Model_Locale_Currency object for current locale * * @param string $currency - * @return Zend_Currency + * @return Mage_Core_Model_Locale_Currency */ public function currency($currency) { @@ -596,6 +596,7 @@ public function emulate($storeId) if ($storeId) { $this->_emulatedLocales[] = clone $this->getLocale(); $this->_locale = new Zend_Locale(Mage::getStoreConfig(self::XML_PATH_DEFAULT_LOCALE, $storeId)); + Mage::getSingleton('core/translate')->setLocale($this->_locale)->init('frontend', true); } else { $this->_emulatedLocales[] = false; @@ -610,6 +611,55 @@ public function revert() { if ($locale = array_pop($this->_emulatedLocales)) { $this->_locale = $locale; + Mage::getSingleton('core/translate')->setLocale($this->_locale)->init('adminhtml', true); } } + + /** + * Returns localized informations as array, supported are several + * types of informations. + * For detailed information about the types look into the documentation + * + * @param string $path (Optional) Type of information to return + * @param string $value (Optional) Value for detail list + * @return array Array with the wished information in the given language + */ + public function getTranslationList($path = null, $value = null) + { + return $this->getLocale()->getTranslationList($path, $this->getLocale(), $value); + } + + /** + * Returns a localized information string, supported are several types of informations. + * For detailed information about the types look into the documentation + * + * @param string $value Name to get detailed information about + * @param string $path (Optional) Type of information to return + * @return string|false The wished information in the given language + */ + public function getTranslation($value = null, $path = null) + { + return $this->getLocale()->getTranslation($value, $path, $this->getLocale()); + } + +/** + * Returns the localized country name + * + * @param string $value Name to get detailed information about + * @return array + */ + public function getCountryTranslation($value) + { + return $this->getLocale()->getCountryTranslation($value, $this->getLocale()); + } + + /** + * Returns an array with the name of all countries translated to the given language + * + * @return array + */ + public function getCountryTranslationList() + { + return $this->getLocale()->getCountryTranslationList($this->getLocale()); + } } diff --git a/app/code/core/Mage/Core/Model/Locale/Currency.php b/app/code/core/Mage/Core/Model/Locale/Currency.php index d0fa2781a4..3126c1e0e3 100644 --- a/app/code/core/Mage/Core/Model/Locale/Currency.php +++ b/app/code/core/Mage/Core/Model/Locale/Currency.php @@ -35,110 +35,82 @@ class Mage_Core_Model_Locale_Currency extends Zend_Currency const US_LOCALE = 'en_US'; protected $_locale; - public function setLocale($locale = null) + /** + * Creates a currency instance. Every supressed parameter is used from the actual or the given locale. + * + * @param string $currency OPTIONAL currency short name + * @param string|Zend_Locale $locale OPTIONAL locale name + * @throws Zend_Currency_Exception When currency is invalid + */ + public function __construct($currency = null, $locale = null) { - $this->_locale = $locale; - parent::setLocale($locale); - return $this; + parent::__construct($currency, $locale); + $this->_options['symbol_choice'] = self::getSymbolChoice($currency, $this->_locale); } /** - * Returns a localized currency string + * Returns the actual or details of available currency symbol choice, * - * @param int|float $value Currency value - * @param array $options OPTIONAL options to set temporary + * @param string $currency (Optional) Currency name + * @param string|Zend_Locale $locale (Optional) Locale to display informations * @return string */ - public function toCurrency($value, array $options = array()) + public function getSymbolChoice($currency = null, $locale = null) { - //return parent::toCurrency($value, $options); - //validate the passed number - if (!isset($value) || !is_numeric($value)) { - #require_once 'Zend/Currency/Exception.php'; - throw new Zend_Currency_Exception("Value '$value' has to be numeric"); + if (($currency === null) and ($locale === null)) { + return $this->_options['symbol_choice']; } - $options = array_merge($this->_options, $this->checkOptions($options)); + $params = self::_checkParams($currency, $locale); - //format the number - if (empty($options['format'])) { - $options['format'] = $this->_locale; + //Get the symbol choice + $symbolChoice = Zend_Locale_Data::getContent($params['locale'], 'currencysymbolchoice', $params['currency']); + if (empty($symbolChoice) === true) { + $symbolChoice = Zend_Locale_Data::getContent($params['locale'], 'currencysymbolchoice', $params['name']); } - - // select currency symbol if needed - if ($options['symbol_choice']) { - $symbols = explode('|', $options['symbol']); - if (is_array($symbols)) { - foreach ($symbols as $symbol) { - $type = $position = null; - if (($tmp = iconv_strpos($symbol, '≤')) !== false) { - $type = 1; - $position = $tmp; - } - if (($tmp = iconv_strpos($symbol, '<')) !== false) { - $type = 2; - $position = $tmp; - } - - if (!is_null($position)) { - $number = iconv_substr($symbol, 0, $position); - $sign = iconv_substr($symbol, $position+1); - - if (($type == 1 && $number <= $value) || ($type == 2 && $number < $value)) { - $options['symbol'] = $sign; - } - } - } - } + if (empty($symbolChoice) === true) { + return null; } + return $symbolChoice; + } - $value = Zend_Locale_Format::toNumber($value, array('locale' => $options['format'], 'precision' => $options['precision'])); + public function setLocale($locale = null) + { + $this->_locale = $locale; + parent::setLocale($locale); + return $this; + } - //localize the number digits - if (!empty ($options['script'])) { - $value = Zend_Locale_Format::convertNumerals($value, 'Latn', $options['script']); + /** + * Place the sign next to the number + * + * @param string $value + * @param string $sign + * @param array $options + * @return string + */ + protected function _concatSign($value, $sign, $options) + { + $trimSign = $this->getStore()->getConfig(self::XML_PATH_TRIM_CURRENCY_SIGN); + if (is_null($trimSign) && $this->_locale && $this->_locale == self::US_LOCALE) { + $trimSign = true; } - - //get the sign to be placed next to the number - if (!is_numeric($options['display'])) { - $sign = " " . $options['display'] . " "; - } else { - switch($options['display']) { - case self::USE_SYMBOL: - $sign = " " . $options['symbol'] . " "; - break; - case self::USE_SHORTNAME: - $sign = " " . $options['currency'] . " "; - break; - case self::USE_NAME: - $sign = " " . $options['name'] . " "; - break; - default: - $sign = ""; - break; - } + if ($trimSign) { + $sign = trim($sign); } - $trimSettings = $this->getStore()->getConfig(self::XML_PATH_TRIM_CURRENCY_SIGN); - if (is_null($trimSettings) && $this->_locale && $this->_locale->toString() == self::US_LOCALE) { - $trimSettings = true; - } - if ($trimSettings) { - $sign = trim($sign); - } - // place the sign next to the number - if ($options['position'] == self::RIGHT) { - $value = $value . $sign; - } else if ($options['position'] == self::LEFT) { - // do not place sign before minus. And do not allow space between minus and sign + // Place the sign next to the number + if ($options['position'] === self::RIGHT) { + $result = $value . $sign; + } else if ($options['position'] === self::LEFT) { + // Do not place sign before minus. And do not allow space between minus and sign if (0 === strpos($value, '-', 0)) { - $value = '-' . ltrim($sign) . substr($value, 1); - } - else { - $value = $sign . $value; + $result = '-' . ltrim($sign) . substr($value, 1); + } else { + $result = $sign . $value; } } - return trim($value); + return $result; } /** @@ -222,4 +194,4 @@ private function checkOptions(array $options = array()) } return $options; } -} \ No newline at end of file +} diff --git a/app/code/core/Mage/Core/Model/Mysql4/Config.php b/app/code/core/Mage/Core/Model/Mysql4/Config.php index cabc44b05c..5f2780dfa2 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Config.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Config.php @@ -131,15 +131,15 @@ public function loadToXml(Mage_Core_Model_Config $xmlConfig, $cond=null) } // extend website config values to all associated stores - foreach ($websites as $wId=>$website) { + foreach ($websites as $website) { $extendSource = $xmlConfig->getNode('websites/'.$website['code']); if (isset($website['stores'])) { - foreach ($website['stores'] as $sId=>$sCode) { + foreach ($website['stores'] as $sCode) { $storeNode = $xmlConfig->getNode('stores/'.$sCode); /** - * $extendSource need overwrite source + * $extendSource DO NOT need overwrite source */ - $storeNode->extend($extendSource, true); + $storeNode->extend($extendSource, false); } } } @@ -173,7 +173,6 @@ public function loadToXml(Mage_Core_Model_Config $xmlConfig, $cond=null) )); } -#echo "".$xmlConfig->getNode()->asNiceXml().""; exit; return $this; } diff --git a/app/code/core/Mage/Core/Model/Mysql4/Translate.php b/app/code/core/Mage/Core/Model/Mysql4/Translate.php index b54a0bae97..14da5e51f1 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Translate.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Translate.php @@ -40,7 +40,7 @@ protected function _construct() public function getTranslationArray($storeId=null) { - if(!Mage::app()->isInstalled()) { + if(!Mage::isInstalled()) { return array(); } @@ -80,7 +80,7 @@ public function getTranslationArray($storeId=null) public function getTranslationArrayByStrings(array $strings, $storeId=null) { - if(!Mage::app()->isInstalled()) { + if(!Mage::isInstalled()) { return array(); } diff --git a/app/code/core/Mage/Core/Model/Resource.php b/app/code/core/Mage/Core/Model/Resource.php index b020016ea2..52a59104bb 100644 --- a/app/code/core/Mage/Core/Model/Resource.php +++ b/app/code/core/Mage/Core/Model/Resource.php @@ -123,8 +123,7 @@ public function getEntity($model, $entity) /** * Get resource table name * - * @param string $model - * @param string $entity + * @param string $modelEntity * @return string */ public function getTableName($modelEntity) @@ -190,3 +189,4 @@ public function setAutoUpdate($value) } } + diff --git a/app/code/core/Mage/Core/Model/Resource/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Abstract.php index 0c94f35838..3d8aae0474 100644 --- a/app/code/core/Mage/Core/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Abstract.php @@ -118,4 +118,9 @@ public function formatDate($date, $includeTime=true) return date('Y-m-d', $date); } } + + public function mktime($str) + { + return strtotime($str); + } } diff --git a/app/code/core/Mage/Core/Model/Resource/Setup.php b/app/code/core/Mage/Core/Model/Resource/Setup.php index 0329d93f68..42059e20de 100644 --- a/app/code/core/Mage/Core/Model/Resource/Setup.php +++ b/app/code/core/Mage/Core/Model/Resource/Setup.php @@ -78,14 +78,15 @@ public function setTable($tableName, $realTableName) return $this; } + /** + * Get table name + * + * @param string $tableName + * @return string + */ public function getTable($tableName) { if (!isset($this->_tables[$tableName])) { - $tablePrefix = (string)Mage::getConfig()->getNode('global/resources/db/table_prefix'); - if (Mage::registry('resource')) { - $this->_tables[$tableName] = $tablePrefix . Mage::getSingleton('core/resource')->getTableName($tableName); - } else { - $this->_tables[$tableName] = $tablePrefix . str_replace('/', '_', $tableName); - } + $this->_tables[$tableName] = Mage::getSingleton('core/resource')->getTableName($tableName); } return $this->_tables[$tableName]; } @@ -512,10 +513,4 @@ public function endSetup() "); return $this; } - - public function getAllAttributeSetIds() - { - $sql = "SELECT `attribute_set_id` FROM `{$this->getTable('eav/attribute_set')}`"; - return $this->_conn->fetchCol($sql); - } -} +} \ No newline at end of file diff --git a/app/code/core/Mage/Core/Model/Session.php b/app/code/core/Mage/Core/Model/Session.php index 3fb19ce47c..3a0d9b0738 100644 --- a/app/code/core/Mage/Core/Model/Session.php +++ b/app/code/core/Mage/Core/Model/Session.php @@ -38,4 +38,17 @@ public function __construct($data=array()) $name = isset($data['name']) ? $data['name'] : null; $this->init('core', $name); } -} \ No newline at end of file + + /** + * Retrieve Session Form Key + * + * @return string A 16 bit unique key for forms + */ + public function getFormKey() + { + if (!$this->getData('_form_key')) { + $this->setData('_form_key', Mage::helper('core')->getRandomString(16)); + } + return $this->getData('_form_key'); + } +} diff --git a/app/code/core/Mage/Core/Model/Session/Abstract.php b/app/code/core/Mage/Core/Model/Session/Abstract.php index 5a72c965fe..1cab53bd56 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract.php @@ -31,6 +31,7 @@ class Mage_Core_Model_Session_Abstract extends Mage_Core_Model_Session_Abstract_ const XML_PATH_COOKIE_PATH = 'web/cookie/cookie_path'; const XML_PATH_COOKIE_LIFETIME = 'web/cookie/cookie_lifetime'; const XML_NODE_SESSION_SAVE = 'global/session_save'; + const XML_NODE_SESSION_SAVE_PATH = 'global/session_save_path'; const XML_PATH_USE_REMOTE_ADDR = 'web/session/use_remote_addr'; const XML_PATH_USE_HTTP_VIA = 'web/session/use_http_via'; @@ -250,28 +251,46 @@ public function addMessages($messages) return $this; } + /** + * Specify session identifier + * + * @param string|null $id + * @return Mage_Core_Model_Session_Abstract + */ public function setSessionId($id=null) { if (is_null($id)) { if (isset($_GET[self::SESSION_ID_QUERY_PARAM])) { - if ($tryId = Mage::helper('core')->decrypt($_GET[self::SESSION_ID_QUERY_PARAM])) { - $id = $tryId; - } + $id = $_GET[self::SESSION_ID_QUERY_PARAM]; + /** + * No reason use crypt key for session + */ +// if ($tryId = Mage::helper('core')->decrypt($_GET[self::SESSION_ID_QUERY_PARAM])) { +// $id = $tryId; +// } } } $this->addHost(true); - parent::setSessionId($id); + return parent::setSessionId($id); } + /** + * Get ecrypted session identifuer + * No reason use crypt key for session id encryption + * we can use session identifier as is + * + * @return string + */ public function getEncryptedSessionId() { if (!self::$_encryptedSessionId) { - $helper = Mage::helper('core'); - if (!$helper) { - return $this; - } - self::$_encryptedSessionId = $helper->encrypt($this->getSessionId()); +// $helper = Mage::helper('core'); +// if (!$helper) { +// return $this; +// } +// self::$_encryptedSessionId = $helper->encrypt($this->getSessionId()); + self::$_encryptedSessionId = $this->getSessionId(); } return self::$_encryptedSessionId; } @@ -375,9 +394,23 @@ public function getSessionHosts() */ public function getSessionSaveMethod() { - if (Mage::app()->isInstalled() && $sessionSave = Mage::getConfig()->getNode(self::XML_NODE_SESSION_SAVE)) { + if (Mage::isInstalled() && $sessionSave = Mage::getConfig()->getNode(self::XML_NODE_SESSION_SAVE)) { return $sessionSave; } return parent::getSessionSaveMethod(); } -} \ No newline at end of file + + /** + * Get sesssion save path + * + * @return string + */ + public function getSessionSavePath() + { + if (Mage::isInstalled() && $sessionSavePath = Mage::getConfig()->getNode(self::XML_NODE_SESSION_SAVE_PATH)) { + return $sessionSavePath; + } + return parent::getSessionSavePath(); + } + +} diff --git a/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php b/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php index 36d90c51f0..596212495c 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php @@ -41,18 +41,24 @@ public function start($sessionName=null) Varien_Profiler::start(__METHOD__.'/setOptions'); if (is_writable(Mage::getBaseDir('session'))) { - session_save_path(Mage::getBaseDir('session')); + session_save_path($this->getSessionSavePath()); } Varien_Profiler::stop(__METHOD__.'/setOptions'); - if ($this->getSessionSaveMethod() == 'files') { - session_module_name('files'); - } - else { - ini_set('session.save_handler', 'user'); - $sessionResource = Mage::getResourceSingleton('core/session'); - /* @var $sessionResource Mage_Core_Model_Mysql4_Session */ - $sessionResource->setSaveHandler(); + switch($this->getSessionSaveMethod()) { + case 'db': + ini_set('session.save_handler', 'user'); + $sessionResource = Mage::getResourceSingleton('core/session'); + /* @var $sessionResource Mage_Core_Model_Mysql4_Session */ + $sessionResource->setSaveHandler(); + break; + case 'memcache': + ini_set('session.save_handler', 'memcache'); + session_save_path($this->getSessionSavePath()); + break; + default: + session_module_name('files'); + break; } if (intval($this->getCookieLifetime()) > 0) { @@ -101,16 +107,18 @@ public function revalidateCookie() } else { if ($this->_data['_cookie_revalidate'] < time()) { - setcookie( - session_name(), - session_id(), - time() + ini_get('session.gc_maxlifetime'), - ini_get('session.cookie_path'), - ini_get('session.cookie_domain') - ); - - $time = time() + round(ini_get('session.gc_maxlifetime') / 4); - $this->_data['_cookie_revalidate'] = $time; + if (!headers_sent()) { + setcookie( + session_name(), + session_id(), + time() + ini_get('session.gc_maxlifetime'), + ini_get('session.cookie_path'), + ini_get('session.cookie_domain') + ); + + $time = time() + round(ini_get('session.gc_maxlifetime') / 4); + $this->_data['_cookie_revalidate'] = $time; + } } } } @@ -176,6 +184,16 @@ public function getSessionSaveMethod() return 'files'; } + /** + * Get sesssion save path + * + * @return string + */ + public function getSessionSavePath() + { + return Mage::getBaseDir('session'); + } + /** * Use REMOTE_ADDR in validator key * @@ -239,14 +257,16 @@ public function validate() } else { if (!$this->_validate()) { - // remove session cookie - setcookie( - session_name(), - null, - null, - ini_get('session.cookie_path'), - ini_get('session.cookie_domain') - ); + if (!headers_sent()) { + // remove session cookie + setcookie( + session_name(), + null, + null, + ini_get('session.cookie_path'), + ini_get('session.cookie_domain') + ); + } // throw core session exception throw new Mage_Core_Model_Session_Exception(''); } @@ -315,4 +335,4 @@ public function getValidatorData() return $parts; } -} \ No newline at end of file +} diff --git a/app/code/core/Mage/Core/Model/Store.php b/app/code/core/Mage/Core/Model/Store.php index 5cad0b12de..a6ca93aac2 100644 --- a/app/code/core/Mage/Core/Model/Store.php +++ b/app/code/core/Mage/Core/Model/Store.php @@ -369,14 +369,14 @@ protected function _updatePathUseRewrites($url) { if ($this->isAdmin() || !$this->getConfig(self::XML_PATH_USE_REWRITES) - || !Mage::app()->isInstalled()) { + || !Mage::isInstalled()) { $url .= basename($_SERVER['SCRIPT_FILENAME']).'/'; } return $url; } protected function _updatePathUseStoreView($url) { - if (Mage::app()->isInstalled() && + if (Mage::isInstalled() && // !$this->isAdmin() && $this->getConfig(self::XML_PATH_STORE_IN_URL)) { $url .= $this->getCode().'/'; @@ -395,7 +395,7 @@ public function isCurrentlySecure() return true; } - if (Mage::app()->isInstalled()) { + if (Mage::isInstalled()) { $secureBaseUrl = Mage::getStoreConfig('web/secure/base_route_url'); if (!$secureBaseUrl) { return false; @@ -577,6 +577,8 @@ public function getCurrentCurrencyRate() * Convert price from default currency to current currency * * @param double $price + * @param boolean $format Format price to currency format + * @param boolean $includeContainer Enclose into * @return double */ public function convertPrice($price, $format=false, $includeContainer = true) @@ -595,7 +597,7 @@ public function convertPrice($price, $format=false, $includeContainer = true) } /** - * round price + * Round price * * @param mixed $price * @return double diff --git a/app/code/core/Mage/Core/Model/Translate.php b/app/code/core/Mage/Core/Model/Translate.php index e50f7c953a..52e22138f6 100644 --- a/app/code/core/Mage/Core/Model/Translate.php +++ b/app/code/core/Mage/Core/Model/Translate.php @@ -75,7 +75,7 @@ class Mage_Core_Model_Translate * * @var array */ - protected $_data; + protected $_data = array(); /** * Translation data for data scope (per module) @@ -108,14 +108,14 @@ public function __construct() * @param string $area * @return Mage_Core_Model_Translate */ - public function init($area) + public function init($area, $forceReload = false) { $this->setConfig(array(self::CONFIG_KEY_AREA=>$area)); $this->_translateInline = Mage::getSingleton('core/translate_inline') ->isAllowed($area=='adminhtml' ? 'admin' : null); - if ($this->_data = $this->_loadCache()) { + if (!$forceReload && ($this->_data = $this->_loadCache())) { if ($this->_canUseCache()) { return $this; } @@ -126,13 +126,13 @@ public function init($area) foreach ($this->getModulesConfig() as $moduleName=>$info) { $info = $info->asArray(); - $this->_loadModuleTranslation($moduleName, $info['files']); + $this->_loadModuleTranslation($moduleName, $info['files'], $forceReload); } - $this->_loadThemeTranslation(); - $this->_loadDbTranslation(); + $this->_loadThemeTranslation($forceReload); + $this->_loadDbTranslation($forceReload); - if ($this->_canUseCache()) { + if (!$forceReload && $this->_canUseCache()) { $this->_saveCache(); } @@ -202,11 +202,11 @@ public function getConfig($key) * @param string $files * @return Mage_Core_Model_Translate */ - protected function _loadModuleTranslation($moduleName, $files) + protected function _loadModuleTranslation($moduleName, $files, $forceReload=false) { foreach ($files as $file) { $file = $this->_getModuleFilePath($moduleName, $file); - $this->_addData($this->_getFileData($file), $moduleName); + $this->_addData($this->_getFileData($file), $moduleName, $forceReload); } return $this; } @@ -218,12 +218,12 @@ protected function _loadModuleTranslation($moduleName, $files) * @param string $scope * @return Mage_Core_Model_Translate */ - protected function _addData($data, $scope) + protected function _addData($data, $scope, $forceReload=false) { foreach ($data as $key => $value) { $key = $this->_prepareDataString($key); $value = $this->_prepareDataString($value); - if ($scope && isset($this->_dataScope[$key])) { + if ($scope && isset($this->_dataScope[$key]) && !$forceReload ) { /** * Checking previos value */ @@ -255,10 +255,10 @@ protected function _prepareDataString($string) * * @return Mage_Core_Model_Translate */ - protected function _loadThemeTranslation() + protected function _loadThemeTranslation($forceReload = false) { $file = Mage::getDesign()->getLocaleFileName('translate.csv'); - $this->_addData($this->_getFileData($file), false); + $this->_addData($this->_getFileData($file), false, $forceReload); return $this; } @@ -267,10 +267,10 @@ protected function _loadThemeTranslation() * * @return Mage_Core_Model_Translate */ - protected function _loadDbTranslation() + protected function _loadDbTranslation($forceReload = false) { $arr = $this->getResource()->getTranslationArray(); - $this->_addData($arr, $this->getConfig(self::CONFIG_KEY_STORE)); + $this->_addData($arr, $this->getConfig(self::CONFIG_KEY_STORE), $forceReload); return $this; } @@ -332,6 +332,12 @@ public function getLocale() return $this->_locale; } + public function setLocale( $locale ) + { + $this->_locale = $locale; + return $this; + } + /** * Retrieve DB resource model * diff --git a/app/code/core/Mage/Core/Model/Translate/Inline.php b/app/code/core/Mage/Core/Model/Translate/Inline.php index c3e2663bc4..ccaeef7033 100644 --- a/app/code/core/Mage/Core/Model/Translate/Inline.php +++ b/app/code/core/Mage/Core/Model/Translate/Inline.php @@ -38,6 +38,7 @@ class Mage_Core_Model_Translate_Inline protected $_content; protected $_isAllowed; protected $_isScriptInserted = false; + protected $_isAjaxRequest = null; public function isAllowed($storeId=null) { @@ -157,6 +158,15 @@ protected function _escape($string) protected function _tagAttributes() { #echo __METHOD__; + + if ($this->getIsAjaxRequest()) { + $quoteHtml = '\"'; + $quotePatern = '\\\\"'; + } else { + $quoteHtml = '"'; + $quotePatern = '"'; + } + $nextTag = 0; $i=0; while (preg_match('#<([a-z]+)\s*?[^>]+?(('.$this->_tokenRegex.')[^/>]*?)+(/?(>))#i', $this->_content, $tagMatch, PREG_OFFSET_CAPTURE, $nextTag)) { @@ -178,7 +188,7 @@ protected function _tagAttributes() $next = $m[0][1]; } - if (preg_match('# translate="\[(.+?)\]"#i', $tagMatch[0][0], $m, PREG_OFFSET_CAPTURE)) { + if (preg_match('# translate='.$quotePatern.'\[(.+?)\]'.$quotePatern.'#i', $tagMatch[0][0], $m, PREG_OFFSET_CAPTURE)) { foreach ($trArr as $i=>$tr) { if (strpos($m[1][0], $tr)!==false) { unset($trArr[$i]); @@ -206,6 +216,14 @@ protected function _specialTags() { #echo __METHOD__; + if ($this->getIsAjaxRequest()) { + $quoteHtml = '\"'; + $quotePatern = '\\\\"'; + } else { + $quoteHtml = '"'; + $quotePatern = '"'; + } + $nextTag = 0; $location = array( @@ -248,14 +266,14 @@ protected function _specialTags() switch ($tag) { case 'script': case 'title': $tagHtml .= ''.strtoupper($tag).''; + .'" translate='.$quoteHtml.'['.join(',',$trArr).']'.$quoteHtml.'>'.strtoupper($tag).''; break; } $this->_content = substr_replace($this->_content, $tagHtml, $tagMatch[0][1], $tagLength); switch ($tag) { case 'select': case 'button': case 'a': - if (preg_match('# translate="\[(.+?)\]"#i', $tagMatch[0][0], $m, PREG_OFFSET_CAPTURE)) { + if (preg_match('# translate='.$quotePatern.'\[(.+?)\]'.$quotePatern.'#i', $tagMatch[0][0], $m, PREG_OFFSET_CAPTURE)) { foreach ($trArr as $i=>$tr) { if (strpos($m[1][0], $tr)!==false) { unset($trArr[$i]); @@ -268,8 +286,9 @@ protected function _specialTags() $start = $tagMatch[3][1]; $len = 0; } + $this->_content = substr_replace($this->_content, - ' translate="['.join(',',$trArr).']"', $start, $len); + ' translate='.$quoteHtml.'['.join(',',$trArr).']'.$quoteHtml, $start, $len); break; } } @@ -285,6 +304,13 @@ protected function _otherText() #echo __METHOD__; #echo "".$this->_content."
"; #exit; + + if ($this->getIsAjaxRequest()) { + $quoteHtml = '\"'; + } else { + $quoteHtml = '"'; + } + $next = 0; while (preg_match('#('.$this->_tokenRegex.')#', $this->_content, $m, PREG_OFFSET_CAPTURE, $next)) { @@ -295,11 +321,26 @@ protected function _otherText() .'original:\''.$this->_escape($m[4][0]).'\',' .'location:\'Text\',' .'scope:\''.$this->_escape($m[5][0]).'\'}'; - $spanHtml = ''.$m[2][0].''; + + $spanHtml = ''.$m[2][0].''; $this->_content = substr_replace($this->_content, $spanHtml, $m[0][1], strlen($m[0][0])); $next = $m[0][1]; } } + + public function getIsAjaxRequest() + { + if (!is_null($this->_isAjaxRequest)) { + return $this->_isAjaxRequest; + } else { + return Mage::app()->getRequest()->getQuery('isAjax'); + } + } + + public function setIsAjaxRequest($status) + { + $this->_isAjaxRequest = $status; + } } diff --git a/app/code/core/Mage/Core/Model/Url.php b/app/code/core/Mage/Core/Model/Url.php index 8150a80954..4ad451dcd2 100644 --- a/app/code/core/Mage/Core/Model/Url.php +++ b/app/code/core/Mage/Core/Model/Url.php @@ -93,7 +93,7 @@ class Mage_Core_Model_Url extends Varien_Object /** * Reserved Route parametr keys * - * @var unknown_type + * @var array */ protected $_reservedRouteParams = array( '_store', '_type', '_secure', '_forced_secure', '_use_rewrite', @@ -107,6 +107,13 @@ class Mage_Core_Model_Url extends Varien_Object */ protected $_request; + /** + * Use Session ID for generate URL + * + * @var bool + */ + protected $_useSession = true; + protected function _construct() { $this->setStore(null); @@ -155,12 +162,34 @@ public function setUseUrlCache($flag) return $this; } + /** + * Set use session rule + * + * @param bool $useSession + * @return Mage_Core_Model_Url + */ + public function setUseSession($useSession) + { + $this->_useSession = (bool)$useSession; + return $this; + } + public function setRouteFrontName($name) { $this->setData('route_front_name', $name); return $this; } + /** + * Retrieve use session rule + * + * @return bool + */ + public function getUseSession() + { + return $this->_useSession; + } + /** * Retrieve default action name * @@ -579,7 +608,7 @@ public function checkCookieDomains() if (!$helper) { return $this; } - self::$_encryptedSessionId = $helper->encrypt($session->getSessionId()); + self::$_encryptedSessionId = $session->getEncryptedSessionId(); } $this->setQueryParam( Mage_Core_Model_Session_Abstract::SESSION_ID_QUERY_PARAM, @@ -599,7 +628,7 @@ public function addSessionParam() if (!$helper) { return $this; } - self::$_encryptedSessionId = $helper->encrypt($session->getSessionId()); + self::$_encryptedSessionId = $session->getEncryptedSessionId(); } $this->setQueryParam( Mage_Core_Model_Session_Abstract::SESSION_ID_QUERY_PARAM, @@ -771,6 +800,9 @@ public function getUrl($routePath=null, $routeParams=null) */ protected function _prepareSessionUrl($url) { + if (!$this->getUseSession()) { + return $this; + } $session = Mage::getSingleton('core/session'); /* @var $session Mage_Core_Model_Session */ if (Mage::app()->getUseSessionVar()) { diff --git a/app/code/core/Mage/Core/Model/Url/Rewrite.php b/app/code/core/Mage/Core/Model/Url/Rewrite.php index 9afae6d863..1e0d437b4a 100644 --- a/app/code/core/Mage/Core/Model/Url/Rewrite.php +++ b/app/code/core/Mage/Core/Model/Url/Rewrite.php @@ -161,7 +161,7 @@ public function removeTag($tags) */ public function rewrite(Zend_Controller_Request_Http $request=null, Zend_Controller_Response_Http $response=null) { - if (!Mage::app()->isInstalled()) { + if (!Mage::isInstalled()) { return false; } if (is_null($request)) { @@ -216,17 +216,25 @@ public function rewrite(Zend_Controller_Request_Http $request=null, Zend_Control $request->setAlias(self::REWRITE_REQUEST_PATH_ALIAS, $this->getRequestPath()); $external = substr($this->getTargetPath(), 0, 6); - if ($external==='http:/' || $external==='https:') { + $isPermanentRedirectOption = $this->hasOption('RP'); + if ($external === 'http:/' || $external === 'https:') { + if ($isPermanentRedirectOption) { + header('HTTP/1.1 301 Moved Permanently'); + } header("Location: ".$this->getTargetPath()); exit; } else { $targetUrl = $request->getBaseUrl(). '/' . $this->getTargetPath(); } - if ($this->hasOption('R')) { + $isRedirectOption = $this->hasOption('R'); + if ($isRedirectOption || $isPermanentRedirectOption) { if (Mage::getStoreConfig('web/url/use_store') && $storeCode = Mage::app()->getStore()->getCode()) { $targetUrl = $request->getBaseUrl(). '/' . $storeCode . '/' .$this->getTargetPath(); } - header("Location: ".$targetUrl); + if ($isPermanentRedirectOption) { + header('HTTP/1.1 301 Moved Permanently'); + } + header('Location: '.$targetUrl); exit; } diff --git a/app/code/core/Mage/Core/Model/Website.php b/app/code/core/Mage/Core/Model/Website.php index 79ab538490..0483674425 100644 --- a/app/code/core/Mage/Core/Model/Website.php +++ b/app/code/core/Mage/Core/Model/Website.php @@ -457,4 +457,33 @@ protected function _afterDelete() Mage::getConfig()->removeCache(); return $this; } + + /** + * Retrieve website base currency code + * + * @return string + */ + public function getBaseCurrencyCode() + { + if ($this->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE) == Mage_Core_Model_Store::PRICE_SCOPE_GLOBAL) { + return Mage::app()->getBaseCurrencyCode(); + } else { + return $this->getConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE); + } + } + + /** + * Retrieve website base currency + * + * @return Mage_Directory_Model_Currency + */ + public function getBaseCurrency() + { + $currency = $this->getData('base_currency'); + if (is_null($currency)) { + $currency = Mage::getModel('directory/currency')->load($this->getBaseCurrencyCode()); + $this->setData('base_currency', $currency); + } + return $currency; + } } diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.10-0.8.11.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.10-0.8.11.php index aa058a67dc..4b0b80e3b8 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.10-0.8.11.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.10-0.8.11.php @@ -30,6 +30,16 @@ $installer->startSetup(); $installer->getConnection()->dropForeignKey($installer->getTable('design_change'), 'FK_DESIGN_CHANGE_STORE'); + +$storeIds = $installer->getConnection()->fetchCol( + "SELECT store_id FROM {$installer->getTable('core_store')}" +); + +if (!empty($storeIds)) { + $storeIds = implode(',', $storeIds); + $installer->run("DELETE FROM {$installer->getTable('design_change')} WHERE store_id NOT IN ($storeIds)"); +} + $installer->getConnection()->addConstraint( 'FK_DESIGN_CHANGE_STORE', $installer->getTable('design_change'), 'store_id', diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.11-0.8.12.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.11-0.8.12.php index 0f98d3bf63..253d6c9f3b 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.11-0.8.12.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.11-0.8.12.php @@ -31,10 +31,11 @@ $installer->startSetup(); $installer->getConnection()->changeColumn( - $this->getTable('core_store'), 'name', 'name', 'varchar(255) not null' + $installer->getTable('core_store'), 'name', 'name', 'varchar(255) not null', true ); + $installer->getConnection()->changeColumn( - $this->getTable('core_store_group'), 'name', 'name', 'varchar(255) not null' + $installer->getTable('core_store_group'), 'name', 'name', 'varchar(255) not null', true ); $installer->endSetup(); \ No newline at end of file diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.8-0.8.9.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.8-0.8.9.php index c4f360f4a4..745e5a4afc 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.8-0.8.9.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.8-0.8.9.php @@ -29,8 +29,8 @@ $installer->startSetup(); -$installer->run(" -ALTER TABLE `{$this->getTable('core_session')}` MODIFY `session_data` MEDIUMBLOB NOT NULL; -"); +$installer->getConnection()->changeColumn( + $this->getTable('core_session'), 'session_data', 'session_data', 'MEDIUMBLOB NOT NULL' +); $installer->endSetup(); diff --git a/app/code/core/Mage/Cron/etc/system.xml b/app/code/core/Mage/Cron/etc/system.xml index 2e34f8eea6..23aeadde81 100644 --- a/app/code/core/Mage/Cron/etc/system.xml +++ b/app/code/core/Mage/Cron/etc/system.xml @@ -20,7 +20,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_Core + * @package Mage_Cron * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ @@ -29,7 +29,7 @@ - + text 15 diff --git a/app/code/core/Mage/Customer/Block/Widget/Dob.php b/app/code/core/Mage/Customer/Block/Widget/Dob.php index 45e17dcdb9..5c4fe0eb0e 100644 --- a/app/code/core/Mage/Customer/Block/Widget/Dob.php +++ b/app/code/core/Mage/Customer/Block/Widget/Dob.php @@ -65,4 +65,14 @@ public function getYear() { return $this->getTime() ? date('Y', $this->getTime()) : ''; } + + /** + * Returns format which will be applied for DOB in javascript + * + * @return string + */ + public function getDateFormat() + { + return Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); + } } \ No newline at end of file diff --git a/app/code/core/Mage/Customer/Model/Entity/Customer/Collection.php b/app/code/core/Mage/Customer/Model/Entity/Customer/Collection.php index 443be8e809..1335a9f962 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Customer/Collection.php +++ b/app/code/core/Mage/Customer/Model/Entity/Customer/Collection.php @@ -68,4 +68,44 @@ public function addNameToSelect() $this->addExpressionAttributeToSelect('name', $expr, $fields); return $this; } + + /** + * Get SQL for get record count + * + * @return Varien_Db_Select + */ + public function getSelectCountSql() + { + $this->_renderFilters(); + + $countSelect = clone $this->getSelect(); + $countSelect->reset(Zend_Db_Select::ORDER); + $countSelect->reset(Zend_Db_Select::LIMIT_COUNT); + $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET); + $countSelect->reset(Zend_Db_Select::COLUMNS); + + $countSelect->from('', 'COUNT(*)'); + $countSelect->resetJoinLeft(); + + return $countSelect; + } + + /** + * Retrive all ids for collection + * + * @return array + */ + public function getAllIds($limit=null, $offset=null) + { + $idsSelect = clone $this->getSelect(); + $idsSelect->reset(Zend_Db_Select::ORDER); + $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT); + $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET); + $idsSelect->reset(Zend_Db_Select::COLUMNS); + $idsSelect->from(null, 'e.'.$this->getEntity()->getIdFieldName()); + $idsSelect->limit($limit, $offset); + $idsSelect->resetJoinLeft(); + + return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams); + } } \ No newline at end of file diff --git a/app/code/core/Mage/Customer/Model/Session.php b/app/code/core/Mage/Customer/Model/Session.php index 5b477cb360..0f29609fe7 100644 --- a/app/code/core/Mage/Customer/Model/Session.php +++ b/app/code/core/Mage/Customer/Model/Session.php @@ -100,13 +100,17 @@ public function getCustomerId() /** * Get customer group id - * If customer is not logged in, the default customer group id from config will be returned + * If customer is not logged in system not logged in group id will be returned * * @return int */ public function getCustomerGroupId() { - return $this->getCustomer()->getGroupId(); + if ($this->isLoggedIn()) { + return $this->getCustomer()->getGroupId(); + } else { + return Mage_Customer_Model_Group::NOT_LOGGED_IN_ID; + } } /** diff --git a/app/code/core/Mage/Customer/controllers/AccountController.php b/app/code/core/Mage/Customer/controllers/AccountController.php index 17f9969c24..6b26e2e1ff 100644 --- a/app/code/core/Mage/Customer/controllers/AccountController.php +++ b/app/code/core/Mage/Customer/controllers/AccountController.php @@ -492,6 +492,10 @@ public function editAction() */ public function editPostAction() { + if (!$this->_validateFormKey()) { + return $this->_redirect('*/*/edit'); + } + if ($this->getRequest()->isPost()) { $customer = Mage::getModel('customer/customer') ->setId($this->_getSession()->getCustomerId()) @@ -570,6 +574,7 @@ public function editPostAction() ->addException($e, $this->__('Can\'t save customer')); } } + $this->_redirect('*/*/edit'); } -} \ No newline at end of file +} diff --git a/app/code/core/Mage/Customer/controllers/AddressController.php b/app/code/core/Mage/Customer/controllers/AddressController.php index 743a76c00f..a20899cb0d 100644 --- a/app/code/core/Mage/Customer/controllers/AddressController.php +++ b/app/code/core/Mage/Customer/controllers/AddressController.php @@ -62,7 +62,7 @@ public function indexAction() $this->loadLayout(); $this->_initLayoutMessages('customer/session'); $this->_initLayoutMessages('catalog/session'); - + if ($block = $this->getLayout()->getBlock('address_book')) { $block->setRefererUrl($this->_getRefererUrl()); } @@ -98,6 +98,9 @@ public function formAction() public function formPostAction() { + if (!$this->_validateFormKey()) { + return $this->_redirect('*/*/'); + } // Save data if ($this->getRequest()->isPost()) { $address = Mage::getModel('customer/address') @@ -172,4 +175,4 @@ public function deleteAction() } $this->getResponse()->setRedirect(Mage::getUrl('*/*/index')); } -} \ No newline at end of file +} diff --git a/app/code/core/Mage/Customer/etc/api.xml b/app/code/core/Mage/Customer/etc/api.xml index 8803790439..3b5f7df932 100644 --- a/app/code/core/Mage/Customer/etc/api.xml +++ b/app/code/core/Mage/Customer/etc/api.xml @@ -36,6 +36,7 @@ Retrieve customers items + customer/info Create customer @@ -43,6 +44,7 @@ Retrieve customer data + customer/info Update customer data @@ -91,13 +93,15 @@ Retrieve customer addresses items + customer/address/info Create customer address customer/address/create - Retrieve customer data + Retrieve address data + customer/address/info Update customer address data @@ -130,9 +134,24 @@
- - - Customers + + Customers + 3 + + Create + + + Update + + + Delete + + + Retrieve customers info + +
+ Addresses + 100 Create @@ -142,20 +161,11 @@ Delete -
- Addresses - - Create - - - Update - - - Delete - -
- - + + Retrieve address info + +
+
diff --git a/app/code/core/Mage/Customer/etc/config.xml b/app/code/core/Mage/Customer/etc/config.xml index 297b230964..3e1c6701e5 100644 --- a/app/code/core/Mage/Customer/etc/config.xml +++ b/app/code/core/Mage/Customer/etc/config.xml @@ -28,7 +28,7 @@ - 0.8.8 + 0.8.9 @@ -268,24 +268,36 @@ T: {{var telephone}} - + Customers 40 - + Customer Groups 0 - + Manage Customers 10 - + Online Customers 20 + + + + + + Customers Section + 50 + + + + + diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.8-0.8.9.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.8-0.8.9.php new file mode 100644 index 0000000000..29c1f45ac6 --- /dev/null +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.8-0.8.9.php @@ -0,0 +1,44 @@ +startSetup(); + +$installer->getConnection()->addKey($installer->getTable('customer_address_entity_datetime'), 'IDX_VALUE', array('entity_id', 'attribute_id', 'value')); +$installer->getConnection()->addKey($installer->getTable('customer_address_entity_decimal'), 'IDX_VALUE', array('entity_id', 'attribute_id', 'value')); +$installer->getConnection()->addKey($installer->getTable('customer_address_entity_int'), 'IDX_VALUE', array('entity_id', 'attribute_id', 'value')); +$installer->getConnection()->addKey($installer->getTable('customer_address_entity_text'), 'IDX_VALUE', array('entity_id', 'attribute_id')); +$installer->getConnection()->addKey($installer->getTable('customer_address_entity_varchar'), 'IDX_VALUE', array('entity_id', 'attribute_id', 'value')); + +$installer->getConnection()->addKey($installer->getTable('customer_entity_datetime'), 'IDX_VALUE', array('entity_id', 'attribute_id', 'value')); +$installer->getConnection()->addKey($installer->getTable('customer_entity_decimal'), 'IDX_VALUE', array('entity_id', 'attribute_id', 'value')); +$installer->getConnection()->addKey($installer->getTable('customer_entity_int'), 'IDX_VALUE', array('entity_id', 'attribute_id', 'value')); +$installer->getConnection()->addKey($installer->getTable('customer_entity_text'), 'IDX_VALUE', array('entity_id', 'attribute_id')); +$installer->getConnection()->addKey($installer->getTable('customer_entity_varchar'), 'IDX_VALUE', array('entity_id', 'attribute_id', 'value')); + +$installer->endSetup(); \ No newline at end of file diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php index d1c68297a9..05320f9cf2 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php @@ -49,18 +49,20 @@ public function getResource($forWrite = false) $ioConfig = $this->getVars(); switch ($this->getVar('type', 'file')) { case 'file': - $baseDir = Mage::getBaseDir(); - $path = $this->_resource->getCleanPath($baseDir . '/' . trim($this->getVar('path'), '/')); - $basePath = $this->_resource->getCleanPath($baseDir); + if (preg_match('#^'.preg_quote(DS, '#').'#', $this->getVar('path')) || + preg_match('#^[a-z]:'.preg_quote(DS, '#') .'#i', $this->getVar('path'))) { - if (strpos($path, $basePath) !== 0) { - $message = Mage::helper('dataflow')->__('Access denied to destination folder "%s"', $path); - Mage::throwException($message); - } else { - $this->_resource->checkAndCreateFolder($path); + $path = $this->_resource->getCleanPath($this->getVar('path')); + } + else { + $baseDir = Mage::getBaseDir(); + $path = $this->_resource->getCleanPath($baseDir . DS . trim($this->getVar('path'), DS)); } + $this->_resource->checkAndCreateFolder($path); + $realPath = realpath($path); + if (!$isError && $realPath === false) { $message = Mage::helper('dataflow')->__('Destination folder "%s" does not exist or not access to create', $ioConfig['path']); Mage::throwException($message); @@ -75,9 +77,39 @@ public function getResource($forWrite = false) Mage::throwException($message); } else { - $ioConfig['path'] = rtrim($realPath, '/'); + $ioConfig['path'] = rtrim($realPath, DS); } } + +// $baseDir = Mage::getBaseDir(); +// $path = $this->_resource->getCleanPath($baseDir . '/' . trim($this->getVar('path'), '/')); +// $basePath = $this->_resource->getCleanPath($baseDir); +// +// if (strpos($path, $basePath) !== 0) { +// $message = Mage::helper('dataflow')->__('Access denied to destination folder "%s"', $path); +// Mage::throwException($message); +// } else { +// $this->_resource->checkAndCreateFolder($path); +// } +// +// $realPath = realpath($path); +// if (!$isError && $realPath === false) { +// $message = Mage::helper('dataflow')->__('Destination folder "%s" does not exist or not access to create', $ioConfig['path']); +// Mage::throwException($message); +// } +// elseif (!$isError && !is_dir($realPath)) { +// $message = Mage::helper('dataflow')->__('Destination folder "%s" is not a directory', $realPath); +// Mage::throwException($message); +// } +// elseif (!$isError) { +// if ($forWrite && !is_writeable($realPath)) { +// $message = Mage::helper('dataflow')->__('Destination folder "%s" is not a writeable', $realPath); +// Mage::throwException($message); +// } +// else { +// $ioConfig['path'] = rtrim($realPath, '/'); +// } +// } break; default: $ioConfig['path'] = rtrim($this->getVar('path'), '/'); diff --git a/app/code/core/Mage/Dataflow/Model/Profile.php b/app/code/core/Mage/Dataflow/Model/Profile.php index 7d4f8a4d11..38b15e0fbd 100644 --- a/app/code/core/Mage/Dataflow/Model/Profile.php +++ b/app/code/core/Mage/Dataflow/Model/Profile.php @@ -280,6 +280,9 @@ public function _parseGuiData() } else { $parseDataXml = ''.$nl; $parseDataXml .= ' getStoreId().']]>'.$nl; + if (isset($p['export']['add_url_field'])) { + $parseDataXml .= ' '.$nl; + } $parseDataXml .= ''.$nl.$nl; } diff --git a/app/code/core/Mage/Directory/Block/Currency.php b/app/code/core/Mage/Directory/Block/Currency.php index eea3faa04e..be95b0dfd1 100644 --- a/app/code/core/Mage/Directory/Block/Currency.php +++ b/app/code/core/Mage/Directory/Block/Currency.php @@ -57,7 +57,7 @@ public function getCurrencies() foreach ($codes as $code) { if (isset($rates[$code])) { - $currencies[$code] = Mage::app()->getLocale()->getLocale() + $currencies[$code] = Mage::app()->getLocale() ->getTranslation($code, 'nametocurrency'); } } diff --git a/app/code/core/Mage/Directory/Model/Country.php b/app/code/core/Mage/Directory/Model/Country.php index 92a3d9031e..048340caad 100644 --- a/app/code/core/Mage/Directory/Model/Country.php +++ b/app/code/core/Mage/Directory/Model/Country.php @@ -145,7 +145,7 @@ public function getName() if(!$this->getData('name')) { $this->setData( 'name', - Mage::app()->getLocale()->getLocale()->getCountryTranslation($this->getId()) + Mage::app()->getLocale()->getCountryTranslation($this->getId()) ); } return $this->getData('name'); diff --git a/app/code/core/Mage/Directory/Model/Currency/Filter.php b/app/code/core/Mage/Directory/Model/Currency/Filter.php index dd0dc901ec..645f5acd24 100644 --- a/app/code/core/Mage/Directory/Model/Currency/Filter.php +++ b/app/code/core/Mage/Directory/Model/Currency/Filter.php @@ -41,7 +41,7 @@ class Mage_Directory_Model_Currency_Filter implements Zend_Filter_Interface /** * Currency object * - * @var Zend_Currency + * @var Mage_Core_Model_Locale_Currency */ protected $_currency; diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Country/Collection.php b/app/code/core/Mage/Directory/Model/Mysql4/Country/Collection.php index a4e335ae40..2d3cd545f7 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Country/Collection.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Country/Collection.php @@ -115,7 +115,7 @@ public function toOptionArray($emptyLabel = ' ') $sort = array(); foreach ($options as $index=>$data) { - $name = Mage::app()->getLocale()->getLocale()->getCountryTranslation($data['value']); + $name = Mage::app()->getLocale()->getCountryTranslation($data['value']); if (!empty($name)) { $sort[$name] = $data['value']; } diff --git a/app/code/core/Mage/Directory/etc/api.xml b/app/code/core/Mage/Directory/etc/api.xml index 81c284c60c..9b8b423872 100644 --- a/app/code/core/Mage/Directory/etc/api.xml +++ b/app/code/core/Mage/Directory/etc/api.xml @@ -63,17 +63,16 @@ - - - Directory - - Country - - - Region - - - + + Directory + 5 + + Country + + + Region + + diff --git a/app/code/core/Mage/Directory/etc/config.xml b/app/code/core/Mage/Directory/etc/config.xml index 5cbb5cce0d..5260228b52 100644 --- a/app/code/core/Mage/Directory/etc/config.xml +++ b/app/code/core/Mage/Directory/etc/config.xml @@ -28,7 +28,7 @@ - 0.8.2 + 0.8.3 @@ -139,7 +139,7 @@ - AZN,AZM,AFN,ALL,DZD,AOA,ARS,AMD,AWG,AUD,BSD,BHD,BDT,BBD,BYR,BZD,BMD,BTN,BOB,BAM,BWP,BRL,GBP,BND,BGN,BUK,BIF,KHR,CAD,CVE,CZK,KYD,CLP,CNY,COP,KMF,CDF,CRC,HRK,CUP,DKK,DJF,DOP,XCD,EGP,SVC,GQE,ERN,EEK,ETB,EUR,FKP,FJD,GMD,GEK,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,KGS,LAK,LVL,LBP,LSL,LRD,LYD,LTL,MOP,MKD,MGA,MWK,MYR,MVR,LSM,MRO,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,ANG,TRL,TRY,NZD,NIC,NGN,KPW,NOK,OMR,PKR,PAB,PGK,PYG,PES,PHP,PLN,QAR,RHD,RON,ROL,RUB,RWF,SHP,STD,SAR,RSD,SCR,SLL,SGD,SKK,SBD,SOS,ZAR,KRW,LKR,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TMM,USD,UGX,UAH,AED,UYU,UZS,VUV,VEB,VND,CHE,CHW,XOF,WST,YER,ZMK,ZWD + AZN,AZM,AFN,ALL,DZD,AOA,ARS,AMD,AWG,AUD,BSD,BHD,BDT,BBD,BYR,BZD,BMD,BTN,BOB,BAM,BWP,BRL,GBP,BND,BGN,BUK,BIF,KHR,CAD,CVE,CZK,KYD,CLP,CNY,COP,KMF,CDF,CRC,HRK,CUP,DKK,DJF,DOP,XCD,EGP,SVC,GQE,ERN,EEK,ETB,EUR,FKP,FJD,GMD,GEK,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,KGS,LAK,LVL,LBP,LSL,LRD,LYD,LTL,MOP,MKD,MGA,MWK,MYR,MVR,LSM,MRO,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,ANG,TRL,TRY,NZD,NIC,NGN,KPW,NOK,OMR,PKR,PAB,PGK,PYG,PEN,PHP,PLN,QAR,RHD,RON,ROL,RUB,RWF,SHP,STD,SAR,RSD,SCR,SLL,SGD,SKK,SBD,SOS,ZAR,KRW,LKR,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TMM,USD,UGX,UAH,AED,UYU,UZS,VUV,VEB,VND,CHE,CHW,XOF,WST,YER,ZMK,ZWD diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php new file mode 100644 index 0000000000..d6695fece5 --- /dev/null +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php @@ -0,0 +1,38 @@ +startSetup(); + +$installer->run(" +INSERT INTO `{$installer->getTable('directory_country')}` (`country_id`, `iso2_code`, `iso3_code`) VALUES +('AX', 'AX', 'ALA'),('CD', 'CD', 'COD'),('CS', 'CS', 'SCG'),('PS', 'PS', 'PSE'); +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php new file mode 100644 index 0000000000..85a079361f --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php @@ -0,0 +1,144 @@ + + */ +class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable extends Mage_Adminhtml_Block_Widget implements Mage_Adminhtml_Block_Widget_Tab_Interface +{ + + /** + * Reference to product objects that is being edited + * + * @var Mage_Catalog_Model_Product + */ + protected $_product = null; + + protected $_config = null; + + /** + * Class constructor + * + */ + public function __construct() + { + parent::__construct(); +// $this->setSkipGenerateContent(true); + $this->setTemplate('downloadable/product/edit/downloadable.phtml'); + } + + /** + * Get tab URL + * + * @return string + */ +// public function getTabUrl() +// { +// return $this->getUrl('downloadable/product_edit/form', array('_current' => true)); +// } + + /** + * Get tab class + * + * @return string + */ +// public function getTabClass() +// { +// return 'ajax'; +// } + + /** + * Get tab label + * + * @return string + */ + public function getTabLabel() + { + return Mage::helper('downloadable')->__('Downloadable Information'); + } + + /** + * Get tab title + * + * @return string + */ + public function getTabTitle() + { + return Mage::helper('downloadable')->__('Downloadable Information'); + } + + /** + * Check if tab can be displayed + * + * @return boolean + */ + public function canShowTab() + { + return true; + } + + /** + * Check if tab is hidden + * + * @return boolean + */ + public function isHidden() + { + return false; + } + + /** + * Render block HTML + * + * @return string + */ + protected function _toHtml() + { + $accordion = $this->getLayout()->createBlock('adminhtml/widget_accordion') + ->setId('downloadableInfo'); + + $accordion->addItem('samples', array( + 'title' => Mage::helper('adminhtml')->__('Samples'), + 'content' => $this->getLayout()->createBlock('downloadable/adminhtml_catalog_product_edit_tab_downloadable_samples')->toHtml(), + 'open' => false, + )); + + $accordion->addItem('links', array( + 'title' => Mage::helper('adminhtml')->__('Links'), + 'content' => $this->getLayout()->createBlock('downloadable/adminhtml_catalog_product_edit_tab_downloadable_links')->toHtml(), + 'open' => true, + )); + + $this->setChild('accordion', $accordion); + + return parent::_toHtml(); + } + +} diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php new file mode 100644 index 0000000000..5a1f42602d --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php @@ -0,0 +1,268 @@ + + */ +class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links extends Mage_Adminhtml_Block_Template +{ + /** + * Enter description here... + * + * @var unknown_type + */ + protected $_purchasedSeparatelyAttribute = null; + + /** + * Class constructor + * + */ + public function __construct() + { + parent::__construct(); + $this->setTemplate('downloadable/product/edit/downloadable/links.phtml'); + } + + /** + * Get product that is being edited + * + * @return Mage_Catalog_Model_Product + */ + public function getProduct() + { + return Mage::registry('product'); + } + + /** + * Enter description here... + * + * @return Mage_Eav_Model_Entity_Attribute + */ + public function getPurchasedSeparatelyAttribute() + { + if (is_null($this->_purchasedSeparatelyAttribute)) { + $_attributeCode = 'links_purchased_separately'; + + $this->_purchasedSeparatelyAttribute = Mage::getModel('eav/entity_attribute') + ->loadByCode('catalog_product', $_attributeCode); + } + + return $this->_purchasedSeparatelyAttribute; + } + + /** + * Enter description here... + * + * @return string + */ + public function getPurchasedSeparatelySelect() + { + $select = $this->getLayout()->createBlock('adminhtml/html_select') + ->setName('product[links_purchased_separately]') + ->setOptions(Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray()) + ->setValue($this->getProduct()->getLinksPurchasedSeparately()); + + return $select->getHtml(); + } + + /** + * Enter description here... + * + * @return string + */ + public function getAddButtonHtml() + { + $addButton = $this->getLayout()->createBlock('adminhtml/widget_button') + ->setData(array( + 'label' => Mage::helper('downloadable')->__('Add New Row'), + 'id' => 'add_link_item', + 'class' => 'add', + )); + return $addButton->toHtml(); + } + + public function getLinksTitle() + { + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE); + } + + public function getUsedDefault() + { + return is_null($this->getProduct()->getAttributeDefaultValue('links_title')); + } + + /** + * Return true if price in website scope + * + * @return bool + */ + public function getIsPriceWebsiteScope() + { + $scope = (int) Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE); + if ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) { + return true; + } + return false; + } + + /** + * Return array of links + * + * @return array + */ + public function getLinkData() + { + $linkArr = array(); + $links = $this->getProduct()->getTypeInstance()->getLinks(); + $priceWebsiteScope = $this->getIsPriceWebsiteScope(); + foreach ($links as $item) { + $tmpLinkItem = array( + 'link_id' => $item->getId(), + 'title' => $item->getTitle(), + 'price' => $this->getPriceValue($item->getPrice()), + 'number_of_downloads' => $item->getNumberOfDownloads(), + 'is_shareable' => $item->getIsShareable(), + 'link_url' => $item->getLinkUrl(), + 'link_type' => $item->getLinkType(), + 'sample_file' => $item->getSampleFile(), + 'sample_url' => $item->getSampleUrl(), + 'sample_type' => $item->getSampleType(), + 'sort_order' => $item->getSortOrder() + ); + $file = Mage::helper('downloadable/file')->getFilePath( + Mage_Downloadable_Model_Link::getBasePath(), $item->getLinkFile() + ); + if ($item->getLinkFile() && is_file($file)) { + $tmpLinkItem['file_save'] = array( + array( + 'file' => $item->getLinkFile(), + 'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()), + 'size' => filesize($file), + 'status' => 'old' + )); + } + $sampleFile = Mage::helper('downloadable/file')->getFilePath( + Mage_Downloadable_Model_Link::getBaseSamplePath(), $item->getSampleFile() + ); + if ($item->getSampleFile() && is_file($sampleFile)) { + $tmpLinkItem['sample_file_save'] = array( + array( + 'file' => $item->getSampleFile(), + 'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()), + 'size' => filesize($sampleFile), + 'status' => 'old' + )); + } + if ($item->getNumberOfDownloads() == '0') { + $tmpLinkItem['is_unlimited'] = ' checked="checked"'; + } + if ($this->getProduct()->getStoreId() && $item->getStoreTitle()) { + $tmpLinkItem['store_title'] = $item->getStoreTitle(); + } + if ($this->getProduct()->getStoreId() && $priceWebsiteScope) { + $tmpLinkItem['website_price'] = $item->getWebsitePrice(); + } + $linkArr[] = new Varien_Object($tmpLinkItem); + } + return $linkArr; + } + + /** + * Return formated price with two digits after decimal point + * + * @param decimal $value + * @return decimal + */ + public function getPriceValue($value) + { + return number_format($value, 2, null, ''); + } + + public function getConfigMaxDownloads() + { + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_DEFAULT_DOWNLOADS_NUMBER); + } + + protected function _prepareLayout() + { + $this->setChild( + 'upload_button', + $this->getLayout()->createBlock('adminhtml/widget_button') + ->addData(array( + 'id' => '', + 'label' => Mage::helper('adminhtml')->__('Upload Files'), + 'type' => 'button', + 'onclick' => 'Downloadable.massUploadByType(\'links\');Downloadable.massUploadByType(\'linkssample\')' + )) + ); + } + + public function getUploadButtonHtml() + { + return $this->getChild('upload_button')->toHtml(); + } + + /** + * Retrive config json + * + * @return string + */ + public function getConfigJson($type='links') + { + $this->getConfig()->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('downloadable/file/upload', array('type' => $type, '_secure' => true))); + $this->getConfig()->setParams(array('form_key' => $this->getFormKey())); + $this->getConfig()->setFileField($type); + $this->getConfig()->setFilters(array( + 'all' => array( + 'label' => Mage::helper('adminhtml')->__('All Files'), + 'files' => array('*.*') + ) + )); + $this->getConfig()->setReplaceBrowseWithRemove(true); + $this->getConfig()->setWidth('32'); + $this->getConfig()->setHideUploadButton(true); + return Zend_Json::encode($this->getConfig()->getData()); + } + + /** + * Retrive config object + * + * @return Varien_Config + */ + public function getConfig() + { + if(is_null($this->_config)) { + $this->_config = new Varien_Object(); + } + + return $this->_config; + } + +} diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php new file mode 100644 index 0000000000..d10f05c43c --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php @@ -0,0 +1,168 @@ + + */ +class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Samples extends Mage_Adminhtml_Block_Widget +{ + /** + * Class constructor + */ + public function __construct() + { + parent::__construct(); + $this->setTemplate('downloadable/product/edit/downloadable/samples.phtml'); + } + + /** + * Get model of the product that is being edited + * + * @return Mage_Catalog_Model_Product + */ + public function getProduct() + { + return Mage::registry('current_product'); + } + + /** + * Enter description here... + * + * @return string + */ + public function getAddButtonHtml() + { + $addButton = $this->getLayout()->createBlock('adminhtml/widget_button') + ->setData(array( + 'label' => Mage::helper('downloadable')->__('Add New Row'), + 'id' => 'add_sample_item', + 'class' => 'add', + )); + return $addButton->toHtml(); + } + + public function getSampleData() + { + $samplesArr = array(); + $samples = $this->getProduct()->getTypeInstance()->getSamples(); + foreach ($samples as $item) { + $tmpSampleItem = array( + 'sample_id' => $item->getId(), + 'title' => $item->getTitle(), + 'sample_url' => $item->getSampleUrl(), + 'sample_type' => $item->getSampleType(), + 'sort_order' => $item->getSortOrder(), + ); + $file = Mage::helper('downloadable/file')->getFilePath( + Mage_Downloadable_Model_Sample::getBasePath(), $item->getSampleFile() + ); + if ($item->getSampleFile() && is_file($file)) { + $tmpSampleItem['file_save'] = array( + array( + 'file' => $item->getSampleFile(), + 'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()), + 'size' => filesize($file), + 'status' => 'old' + )); + } + if ($this->getProduct() && $item->getStoreTitle()) { + $tmpSampleItem['store_title'] = $item->getStoreTitle(); + } + $samplesArr[] = new Varien_Object($tmpSampleItem); + } + + return $samplesArr; + } + + public function getUsedDefault() + { + return is_null($this->getProduct()->getAttributeDefaultValue('samples_title')); + } + + public function getSamplesTitle() + { + return Mage::getStoreConfig(Mage_Downloadable_Model_Sample::XML_PATH_SAMPLES_TITLE); + } + + protected function _prepareLayout() + { + $this->setChild( + 'upload_button', + $this->getLayout()->createBlock('adminhtml/widget_button') + ->addData(array( + 'id' => '', + 'label' => Mage::helper('adminhtml')->__('Upload Files'), + 'type' => 'button', + 'onclick' => 'Downloadable.massUploadByType(\'samples\')' + )) + ); + } + + public function getUploadButtonHtml() + { + return $this->getChild('upload_button')->toHtml(); + } + + /** + * Retrive config json + * + * @return string + */ + public function getConfigJson() + { + $this->getConfig()->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('downloadable/file/upload', array('type' => 'samples', '_secure' => true))); + $this->getConfig()->setParams(array('form_key' => $this->getFormKey())); + $this->getConfig()->setFileField('samples'); + $this->getConfig()->setFilters(array( + 'all' => array( + 'label' => Mage::helper('adminhtml')->__('All Files'), + 'files' => array('*.*') + ) + )); + $this->getConfig()->setReplaceBrowseWithRemove(true); + $this->getConfig()->setWidth('32'); + $this->getConfig()->setHideUploadButton(true); + return Zend_Json::encode($this->getConfig()->getData()); + } + + /** + * Retrive config object + * + * @return Varien_Config + */ + public function getConfig() + { + if(is_null($this->_config)) { + $this->_config = new Varien_Object(); + } + + return $this->_config; + } +} diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php new file mode 100644 index 0000000000..eeba7a3671 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php @@ -0,0 +1,56 @@ + + */ +class Mage_Downloadable_Block_Adminhtml_Sales_Items_Column_Downloadable_Name extends Mage_Adminhtml_Block_Sales_Items_Column_Name +{ + protected $_purchased = null; + public function getLinks() + { + $this->_purchased = Mage::getModel('downloadable/link_purchased') + ->load($this->getItem()->getOrder()->getId(), 'order_id'); + $purchasedItem = Mage::getModel('downloadable/link_purchased_item')->getCollection() + ->addFieldToFilter('order_item_id', $this->getItem()->getId()); + $this->_purchased->setPurchasedItems($purchasedItem); + return $this->_purchased; + } + + public function getLinksTitle() + { + if ($this->_purchased && $this->_purchased->getLinkSectionTitle()) { + return $this->_purchased->getLinkSectionTitle(); + } + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE); + } +} +?> \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Block/Catalog/Product/Links.php b/app/code/core/Mage/Downloadable/Block/Catalog/Product/Links.php new file mode 100644 index 0000000000..ad90ac57ad --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Catalog/Product/Links.php @@ -0,0 +1,155 @@ + + */ +class Mage_Downloadable_Block_Catalog_Product_Links extends Mage_Catalog_Block_Product_Abstract +{ + + /** + * Enter description here... + * + * @return boolean + */ + public function getLinksPurchasedSeparately() + { + return $this->getProduct()->getLinksPurchasedSeparately(); + } + + /** + * Enter description here... + * + * @return boolean + */ + public function getLinkSelectionRequired() + { + return $this->getProduct()->getTypeInstance()->getLinkSelectionRequired(); + } + + /** + * Enter description here... + * + * @return boolean + */ + public function hasLinks() + { + return $this->getProduct()->getTypeInstance()->hasLinks(); + } + + /** + * Enter description here... + * + * @return array + */ + public function getLinks() + { + return $this->getProduct()->getTypeInstance()->getLinks(); + } + + /** + * Enter description here... + * + * @param Mage_Downloadable_Model_Link $link + * @return string + */ + public function getFormattedLinkPrice($link) + { + $price = $link->getPrice(); + + if (0 == $price) { + return ''; + } + + $_priceInclTax = Mage::helper('tax')->getPrice($link->getProduct(), $price, true); + $_priceExclTax = Mage::helper('tax')->getPrice($link->getProduct(), $price); + + $priceStr = '+'; + if (Mage::helper('tax')->displayPriceIncludingTax()) { + $priceStr .= $this->helper('core')->currency($_priceInclTax, true, true); + } elseif (Mage::helper('tax')->displayPriceExcludingTax()) { + $priceStr .= $this->helper('core')->currency($_priceExclTax, true, true); + } elseif (Mage::helper('tax')->displayBothPrices()) { + $priceStr .= $this->helper('core')->currency($_priceExclTax, true, true); + if ($_priceInclTax != $_priceExclTax) { + $priceStr .= ' (+'.$this->helper('core') + ->currency($_priceInclTax, true, true).' '.$this->__('Incl. Tax').')'; + } + } + $priceStr .= ''; + + return $priceStr; + } + + /** + * Enter description here... + * + * @return string + */ + public function getJsonConfig() + { + $config = array(); + + foreach ($this->getLinks() as $link) { + $config[$link->getId()] = Mage::helper('core')->currency($link->getPrice(), false, false); + } + + return Zend_Json::encode($config); + } + + public function getLinkSamlpeUrl($link) + { + return $this->getUrl('downloadable/download/linkSample', array('link_id' => $link->getId())); + } + + /** + * Return title of links section + * + * @return string + */ + public function getLinksTitle() + { + if ($this->getProduct()->getLinksTitle()) { + return $this->getProduct()->getLinksTitle(); + } + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE); + } + + /** + * Return true if target of link new window + * + * @return bool + */ + public function getIsOpenInNewWindow() + { + return Mage::getStoreConfigFlag(Mage_Downloadable_Model_Link::XML_PATH_TARGET_NEW_WINDOW); + } + +} diff --git a/app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php b/app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php new file mode 100644 index 0000000000..94de13c22c --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php @@ -0,0 +1,84 @@ + + */ +class Mage_Downloadable_Block_Catalog_Product_Samples extends Mage_Catalog_Block_Product_Abstract +{ + + /** + * Enter description here... + * + * @return boolean + */ + public function hasSamples() + { + return $this->getProduct()->getTypeInstance()->hasSamples(); + } + + /** + * Get downloadable product samples + * + * @return array + */ + public function getSamples() + { + return $this->getProduct()->getTypeInstance()->getSamples(); + } + + public function getSampleUrl($sample) + { + return $this->getUrl('downloadable/download/sample', array('sample_id' => $sample->getId())); + } + + /** + * Return title of samples section + * + * @return string + */ + public function getSamplesTitle() + { + if ($this->getProduct()->getSamplesTitle()) { + return $this->getProduct()->getSamplesTitle(); + } + return Mage::getStoreConfig(Mage_Downloadable_Model_Sample::XML_PATH_SAMPLES_TITLE); + } + + /** + * Return true if target of link new window + * + * @return bool + */ + public function getIsOpenInNewWindow() + { + return Mage::getStoreConfigFlag(Mage_Downloadable_Model_Link::XML_PATH_TARGET_NEW_WINDOW); + } +} diff --git a/app/code/core/Mage/Downloadable/Block/Catalog/Product/View/Type.php b/app/code/core/Mage/Downloadable/Block/Catalog/Product/View/Type.php new file mode 100644 index 0000000000..c5b93f92d4 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Catalog/Product/View/Type.php @@ -0,0 +1,37 @@ + + */ +class Mage_Downloadable_Block_Catalog_Product_View_Type extends Mage_Catalog_Block_Product_View_Type_Virtual +{ + +} diff --git a/app/code/core/Mage/Downloadable/Block/Checkout/Cart/Item/Renderer.php b/app/code/core/Mage/Downloadable/Block/Checkout/Cart/Item/Renderer.php new file mode 100644 index 0000000000..c917088b19 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Checkout/Cart/Item/Renderer.php @@ -0,0 +1,69 @@ + + */ +class Mage_Downloadable_Block_Checkout_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_Item_Renderer +{ + + /** + * Enter description here... + * + * @return array + */ + public function getLinks() + { + $itemLinks = array(); + if ($linkIds = $this->getItem()->getOptionByCode('downloadable_link_ids')) { + $productLinks = $this->getProduct()->getTypeInstance()->getLinks(); + foreach (explode(',', $linkIds->getValue()) as $linkId) { + if (isset($productLinks[$linkId])) { + $itemLinks[] = $productLinks[$linkId]; + } + } + } + return $itemLinks; + } + + /** + * Return title of links section + * + * @return string + */ + public function getLinksTitle() + { + if ($this->getProduct()->getLinksTitle()) { + return $this->getProduct()->getLinksTitle(); + } + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE); + } + +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Block/Checkout/Success.php b/app/code/core/Mage/Downloadable/Block/Checkout/Success.php new file mode 100644 index 0000000000..cef47032e2 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Checkout/Success.php @@ -0,0 +1,59 @@ + + */ +class Mage_Downloadable_Block_Checkout_Success extends Mage_Checkout_Block_Onepage_Success +{ + + /** + * Return true if order(s) has one or more downloadable products + * + * @return bool + */ + public function getOrderHasDownloadable() + { + $hasDownloadableFlag = Mage::getSingleton('checkout/session') + ->getHasDownloadableProducts(true); + + return $hasDownloadableFlag; + } + + /** + * Return url to list of ordered downloadable products of customer + * + * @return string + */ + public function getDownloadableProductsUrl() + { + return $this->getUrl('downloadable/customer/products', array('_secure' => true)); + } +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Block/Customer/Products/List.php b/app/code/core/Mage/Downloadable/Block/Customer/Products/List.php new file mode 100644 index 0000000000..2869afe01f --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Customer/Products/List.php @@ -0,0 +1,133 @@ + + */ +class Mage_Downloadable_Block_Customer_Products_List extends Mage_Core_Block_Template +{ + + /** + * Class constructor + */ + public function __construct() + { + parent::__construct(); + $session = Mage::getSingleton('customer/session'); + $purchased = Mage::getResourceModel('downloadable/link_purchased_collection') + ->addFieldToFilter('customer_id', $session->getCustomerId()) + ->addOrder('created_at', 'desc'); + $this->setPurchased($purchased); + $purchasedIds = array(); + foreach ($purchased as $_item) { + $purchasedIds[] = $_item->getId(); + } + $purchasedItems = Mage::getResourceModel('downloadable/link_purchased_item_collection') + ->addFieldToFilter('purchased_id', array('in' => $purchasedIds)) + ->setOrder('item_id', 'desc'); + $this->setItems($purchasedItems); + } + + /** + * Enter description here... + * + * @return Mage_Downloadable_Block_Customer_Products_List + */ + protected function _prepareLayout() + { + parent::_prepareLayout(); + + $pager = $this->getLayout()->createBlock('page/html_pager', 'downloadable.customer.products.pager') + ->setCollection($this->getItems()); + $this->setChild('pager', $pager); + $this->getItems()->load(); + foreach ($this->getItems() as $item) { + $item->setPurchased($this->getPurchased()->getItemById($item->getPurchasedId())); + } + return $this; + } + + /** + * Return order view url + * + * @param integer $orderId + * @return string + */ + public function getOrderViewUrl($orderId) + { + return $this->getUrl('sales/order/view', array('order_id' => $orderId)); + } + + /** + * Enter description here... + * + * @return string + */ + public function getBackUrl() + { + return $this->getUrl('customer/account/'); + } + + /** + * Return number of left downloads or unlimited + * + * @return string + */ + public function getRemainingDownloads($item) + { + if ($item->getNumberOfDownloadsBought()) { + $downloads = $item->getNumberOfDownloadsBought() - $item->getNumberOfDownloadsUsed(); + return $downloads; + } + return Mage::helper('downloadable')->__('Unlimited'); + } + + /** + * Return url to download link + * + * @param Mage_Downloadable_Model_Link_Purchased_Item $item + * @return string + */ + public function getDownloadUrl($item) + { + return $this->getUrl('*/download/link', array('id' => $item->getId())); + } + + /** + * Return true if target of link new window + * + * @return bool + */ + public function getIsOpenInNewWindow() + { + return Mage::getStoreConfigFlag(Mage_Downloadable_Model_Link::XML_PATH_TARGET_NEW_WINDOW); + } + +} diff --git a/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php b/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php new file mode 100644 index 0000000000..f17c1b768f --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php @@ -0,0 +1,67 @@ + + */ +class Mage_Downloadable_Block_Sales_Order_Email_Items_Downloadable extends Mage_Sales_Block_Order_Email_Items_Default +{ + protected $_purchased = null; + + /** + * Enter description here... + * + * @return unknown + */ + public function getLinks() + { + $this->_purchased = Mage::getModel('downloadable/link_purchased') + ->load($this->getItem()->getOrder()->getId(), 'order_id'); + $purchasedLinks = Mage::getModel('downloadable/link_purchased_item')->getCollection() + ->addFieldToFilter('order_item_id', $this->getItem()->getOrderItem()->getId()); + $this->_purchased->setPurchasedItems($purchasedLinks); + + return $this->_purchased; + } + + public function getLinksTitle() + { + if ($this->_purchased->getLinkSectionTitle()) { + return $this->_purchased->getLinkSectionTitle(); + } + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE); + } + + public function getPurchasedLinkUrl($item) + { + return $this->getUrl('downloadable/download/link', array('id' => $item->getId(), '_secure' => true)); + } +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php b/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php new file mode 100644 index 0000000000..f6a9339253 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php @@ -0,0 +1,67 @@ + + */ +class Mage_Downloadable_Block_Sales_Order_Email_Items_Order_Downloadable extends Mage_Sales_Block_Order_Email_Items_Order_Default +{ + protected $_purchased = null; + + /** + * Enter description here... + * + * @return unknown + */ + public function getLinks() + { + $this->_purchased = Mage::getModel('downloadable/link_purchased') + ->load($this->getItem()->getOrder()->getId(), 'order_id'); + $purchasedLinks = Mage::getModel('downloadable/link_purchased_item')->getCollection() + ->addFieldToFilter('order_item_id', $this->getItem()->getId()); + $this->_purchased->setPurchasedItems($purchasedLinks); + + return $this->_purchased; + } + + public function getLinksTitle() + { + if ($this->_purchased->getLinkSectionTitle()) { + return $this->_purchased->getLinkSectionTitle(); + } + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE); + } + + public function getPurchasedLinkUrl($item) + { + return $this->getUrl('downloadable/download/link', array('id' => $item->getId(), '_secure' => true)); + } +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php b/app/code/core/Mage/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php new file mode 100644 index 0000000000..b9d5c69199 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php @@ -0,0 +1,62 @@ + + */ +class Mage_Downloadable_Block_Sales_Order_Item_Renderer_Downloadable extends Mage_Sales_Block_Order_Item_Renderer_Default +{ + protected $_purchasedLinks = null; + + /** + * Enter description here... + * + * @return unknown + */ + public function getLinks() + { + $this->_purchasedLinks = Mage::getModel('downloadable/link_purchased') + ->load($this->getOrderItem()->getOrder()->getId(), 'order_id'); + $purchasedItems = Mage::getModel('downloadable/link_purchased_item')->getCollection() + ->addFieldToFilter('order_item_id', $this->getOrderItem()->getId()); + $this->_purchasedLinks->setPurchasedItems($purchasedItems); + + return $this->_purchasedLinks; + } + + public function getLinksTitle() + { + if ($this->_purchasedLinks->getLinkSectionTitle()) { + return $this->_purchasedLinks->getLinkSectionTitle(); + } + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE); + } + +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Helper/Data.php b/app/code/core/Mage/Downloadable/Helper/Data.php new file mode 100644 index 0000000000..ca30d221e3 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Helper/Data.php @@ -0,0 +1,55 @@ + + */ +class Mage_Downloadable_Helper_Data extends Mage_Core_Helper_Abstract +{ + /** + * Check is link shareable or not + * + * @param Mage_Downloadable_Model_Link | Mage_Downloadable_Model_Link_Purchased_Item $link + * @return bool + */ + public function getIsShareable($link) + { + $shareable = false; + switch ($link->getIsShareable()) { + case Mage_Downloadable_Model_Link::LINK_SHAREABLE_YES: + case Mage_Downloadable_Model_Link::LINK_SHAREABLE_NO: + $shareable = (bool) $link->getIsShareable(); + break; + case Mage_Downloadable_Model_Link::LINK_SHAREABLE_CONFIG: + $shareable = (bool) Mage::getStoreConfigFlag(Mage_Downloadable_Model_Link::XML_PATH_CONFIG_IS_SHAREABLE); + } + return $shareable; + } +} diff --git a/app/code/core/Mage/Downloadable/Helper/Download.php b/app/code/core/Mage/Downloadable/Helper/Download.php new file mode 100644 index 0000000000..eedc1c0f05 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Helper/Download.php @@ -0,0 +1,297 @@ + + */ +class Mage_Downloadable_Helper_Download extends Mage_Core_Helper_Abstract +{ + const LINK_TYPE_URL = 'url'; + const LINK_TYPE_FILE = 'file'; + + const XML_PATH_CONTENT_DISPOSITION = 'catalog/downloadable/content_disposition'; + + /** + * Type of link + * + * @var string + */ + protected $_linkType = self::LINK_TYPE_FILE; + + /** + * Resource file + * + * @var string + */ + protected $_resourceFile = null; + + /** + * Resource open handle + * + * @var resource + */ + protected $_handle = null; + + /** + * Remote server headers + * + * @var array + */ + protected $_urlHeaders = array(); + + /** + * MIME Content-type for a file + * + * @var string + */ + protected $_contentType = 'application/octet-stream'; + + /** + * File name + * + * @var string + */ + protected $_fileName = 'download'; + + /** + * Retrieve Resource file handle (socket, file pointer etc) + * + * @return resource + */ + protected function _getHandle() + { + if (!$this->_resourceFile) { + Mage::throwException(Mage::helper('downloadable')->__('Please set resource file and link type')); + } + + if (is_null($this->_handle)) { + if ($this->_linkType == self::LINK_TYPE_URL) { + $port = 80; + + /** + * Validate URL + */ + $urlProp = parse_url($this->_resourceFile); + if (!isset($urlProp['scheme']) || strtolower($urlProp['scheme'] != 'http')) { + Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL scheme')); + } + if (!isset($urlProp['host'])) { + Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL host')); + } + $hostname = $urlProp['host']; + + if (isset($urlProp['port'])) { + $port = (int)$urlProp['port']; + } + + $path = '/'; + if (isset($urlProp['path'])) { + $path = $urlProp['path']; + } + $query = ''; + if (isset($urlProp['query'])) { + $query = '?' . $urlProp['query']; + } + + try { + $this->_handle = fsockopen($hostname, $port, $errno, $errstr); + } + catch (Exception $e) { + throw $e; + } + + if ($this->_handle === false) { + Mage::throwException(Mage::helper('downloadable')->__('Can\'t connect to remote host, error: %s', $errstr)); + } + + $headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n" + . 'Host: ' . $hostname . "\r\n" + . 'User-Agent: Magento ver/' . Mage::getVersion() . "\r\n" + . 'Connection: close' . "\r\n" + . "\r\n"; + fwrite($this->_handle, $headers); + + while (!feof($this->_handle)) { + $str = fgets($this->_handle, 1024); + if ($str == "\r\n") { + break; + } + $match = array(); + if (preg_match('#^([^:]+): (.*)\s+$#', $str, $match)) { + $k = strtolower($match[1]); + if ($k == 'set-cookie') { + continue; + } + else { + $this->_urlHeaders[$k] = trim($match[2]); + } + } + elseif (preg_match('#^HTTP/[0-9\.]+ (\d+) (.*)\s$#', $str, $match)) { + $this->_urlHeaders['code'] = $match[1]; + $this->_urlHeaders['code-string'] = trim($match[2]); + } + } + + if (!isset($this->_urlHeaders['code']) || $this->_urlHeaders['code'] != 200) { + Mage::throwException(Mage::helper('downloadable')->__('Sorry, the was an error getting requested content. Please contact store owner.')); + } + } + elseif ($this->_linkType == self::LINK_TYPE_FILE) { + $this->_handle = new Varien_Io_File(); + $this->_handle->open(array('path'=>Mage::getBaseDir('var'))); + if (!$this->_handle->fileExists($this->_resourceFile, true)) { + Mage::throwException(Mage::helper('downloadable')->__('File does not exists')); + } + $this->_handle->streamOpen($this->_resourceFile, 'r'); + } + else { + Mage::throwException(Mage::helper('downloadable')->__('Invalid download link type')); + } + } + return $this->_handle; + } + + /** + * Retrieve file size in bytes + */ + public function getFilesize() + { + $handle = $this->_getHandle(); + if ($this->_linkType == self::LINK_TYPE_FILE) { + return $handle->streamStat('size'); + } + elseif ($this->_linkType == self::LINK_TYPE_URL) { + if (isset($this->_urlHeaders['content-length'])) { + return $this->_urlHeaders['content-length']; + } + } + return null; + } + + public function getContentType() + { + $handle = $this->_getHandle(); + if ($this->_linkType == self::LINK_TYPE_FILE) { + if (function_exists('mime_content_type')) { + return mime_content_type($this->_resourceFile); + } else { + return Mage::helper('downloadable/file')->getFileType($this->_resourceFile); + } + } + elseif ($this->_linkType == self::LINK_TYPE_URL) { + if (isset($this->_urlHeaders['content-type'])) { + $contentType = split('; ', $this->_urlHeaders['content-type']); + return $contentType[0]; + } + } + return $this->_contentType; + } + + public function getFilename() + { + $handle = $this->_getHandle(); + if ($this->_linkType == self::LINK_TYPE_FILE) { + return pathinfo($this->_resourceFile, PATHINFO_BASENAME); + } + elseif ($this->_linkType == self::LINK_TYPE_URL) { + if (isset($this->_urlHeaders['content-disposition'])) { + $contentDisposition = split('; ', $this->_urlHeaders['content-disposition']); + if (!empty($contentDisposition[1]) && strpos($contentDisposition[1], 'filename=') !== false) { + return substr($contentDisposition[1], 9); + } + } + if ($fileName = @pathinfo($this->_resourceFile, PATHINFO_BASENAME)) { + return $fileName; + } + } + return $this->_fileName; + } + + /** + * Set resource file for download + * + * @param string $resourceFile + * @param string $linkType + * @return Mage_Downloadable_Helper_Download + */ + public function setResource($resourceFile, $linkType = self::LINK_TYPE_FILE) + { + $this->_resourceFile = $resourceFile; + $this->_linkType = $linkType; + + return $this; + } + + /** + * Retrieve Http Request Object + * + * @return Mage_Core_Controller_Request_Http + */ + public function getHttpRequest() + { + return Mage::app()->getFrontController()->getRequest(); + } + + /** + * Retrieve Http Response Object + * + * @return Mage_Core_Controller_Response_Http + */ + public function getHttpResponse() + { + return Mage::app()->getFrontController()->getResponse(); + } + + public function output() + { + $handle = $this->_getHandle(); + if ($this->_linkType == self::LINK_TYPE_FILE) { + while ($buffer = $handle->streamRead()) { + print $buffer; + } + } + elseif ($this->_linkType == self::LINK_TYPE_URL) { + while (!feof($handle)) { + print fgets($handle, 1024); + } + } + } + + /** + * Use Content-Disposition: attachment + * + * @param mixed $store + * @return bool + */ + public function getContentDisposition($store = null) + { + return Mage::getStoreConfig(self::XML_PATH_CONTENT_DISPOSITION, $store); + } +} diff --git a/app/code/core/Mage/Downloadable/Helper/File.php b/app/code/core/Mage/Downloadable/Helper/File.php new file mode 100644 index 0000000000..6cf95e248f --- /dev/null +++ b/app/code/core/Mage/Downloadable/Helper/File.php @@ -0,0 +1,126 @@ + + */ +class Mage_Downloadable_Helper_File extends Mage_Core_Helper_Abstract +{ + /** + * Move file from tmp path to base path + * + * @param string $baseTmpPath + * @param string $basePath + * @param string $file + * @return string + */ + public function moveFileFromTmp($baseTmpPath, $basePath, $file) + { + $ioObject = new Varien_Io_File(); + $destDirectory = dirname($this->getFilePath($basePath, $file)); + try { + $ioObject->open(array('path'=>$destDirectory)); + } catch (Exception $e) { + $ioObject->mkdir($destDirectory, 0777, true); + $ioObject->open(array('path'=>$destDirectory)); + } + + if (strrpos($file, '.tmp') == strlen($file)-4) { + $file = substr($file, 0, strlen($file)-4); + } + + $destFile = dirname($file) . $ioObject->dirsep() + . Varien_File_Uploader::getNewFileName($this->getFilePath($basePath, $file)); + $result = $ioObject->mv( + $this->getFilePath($baseTmpPath, $file), + $this->getFilePath($basePath, $file) + ); + return str_replace($ioObject->dirsep(), '/', $destFile); + } + + /** + * Return full path to file + * + * @param string $path + * @param string $file + * @return string + */ + public function getFilePath($path, $file) + { + $file = $this->_prepareFileForPath($file); + + if(substr($file, 0, 1) == DS) { + return $path . DS . substr($file, 1); + } + + return $path . DS . $file; + } + + /** + * Replace slashes with directory separator + * + * @param string $file + * @return string + */ + protected function _prepareFileForPath($file) + { + return str_replace('/', DS, $file); + } + + /** + * Return file name form file path + * + * @param string $pathFile + * @return string + */ + public function getFileFromPathFile($pathFile) + { + $file = ''; + + $file = substr($pathFile, strrpos($pathFile, DS)+1); + + return $file; + } + + public function getFileType($filePath) + { + $ext = substr($filePath, strrpos($filePath, '.')+1); + return $this->_getFileTypeByExt($ext); + } + + protected function _getFileTypeByExt($ext) + { + $type = Mage::getConfig()->getNode('global/mime/types/x' . $ext); + if ($type) { + return $type; + } + return 'application/octet-stream'; + } +} diff --git a/app/code/core/Mage/Downloadable/Model/CatalogIndex/Data/Downloadable.php b/app/code/core/Mage/Downloadable/Model/CatalogIndex/Data/Downloadable.php new file mode 100644 index 0000000000..9b8d956042 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/CatalogIndex/Data/Downloadable.php @@ -0,0 +1,47 @@ + + */ +class Mage_Downloadable_Model_CatalogIndex_Data_Downloadable extends Mage_CatalogIndex_Model_Data_Virtual +{ + + /** + * Retrieve product type code + * + * @return string + */ + public function getTypeCode() + { + return Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE; + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/Link.php b/app/code/core/Mage/Downloadable/Model/Link.php new file mode 100644 index 0000000000..bcf6dd7922 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Link.php @@ -0,0 +1,96 @@ + + */ +class Mage_Downloadable_Model_Link extends Mage_Core_Model_Abstract +{ + const XML_PATH_LINKS_TITLE = 'catalog/downloadable/links_title'; + const XML_PATH_DEFAULT_DOWNLOADS_NUMBER = 'catalog/downloadable/downloads_number'; + const XML_PATH_TARGET_NEW_WINDOW = 'catalog/downloadable/links_target_new_window'; + const XML_PATH_CONFIG_IS_SHAREABLE = 'catalog/downloadable/shareable'; + + const LINK_SHAREABLE_YES = 1; + const LINK_SHAREABLE_NO = 0; + const LINK_SHAREABLE_CONFIG = 2; + + /** + * Enter description here... + * + */ + protected function _construct() + { + $this->_init('downloadable/link'); + parent::_construct(); + } + + /** + * Return link files path + * + * @return string + */ + public static function getLinkDir() + { + return Mage::getBaseDir(); + } + + /** + * Enter description here... + * + * @return Mage_Downloadable_Model_Link + */ + protected function _afterSave() + { + $this->getResource()->saveItemTitleAndPrice($this); + return parent::_afterSave(); + } + + public static function getBaseTmpPath() + { + return Mage::getBaseDir('media') . DS . 'downloadable' . DS . 'tmp' . DS . 'links'; + } + + public static function getBasePath() + { + return Mage::getBaseDir('media') . DS . 'downloadable' . DS . 'files' . DS . 'links'; + } + + public static function getBaseSampleTmpPath() + { + return Mage::getBaseDir('media') . DS . 'downloadable' . DS . 'tmp' . DS . 'link_samples'; + } + + public static function getBaseSamplePath() + { + return Mage::getBaseDir('media') . DS . 'downloadable' . DS . 'files' . DS . 'link_samples'; + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/Link/Purchased.php b/app/code/core/Mage/Downloadable/Model/Link/Purchased.php new file mode 100644 index 0000000000..94cce588b2 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Link/Purchased.php @@ -0,0 +1,46 @@ + + */ +class Mage_Downloadable_Model_Link_Purchased extends Mage_Core_Model_Abstract +{ + /** + * Enter description here... + * + */ + protected function _construct() + { + $this->_init('downloadable/link_purchased'); + parent::_construct(); + } + +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php b/app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php new file mode 100644 index 0000000000..bc264197d0 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php @@ -0,0 +1,52 @@ + + */ +class Mage_Downloadable_Model_Link_Purchased_Item extends Mage_Core_Model_Abstract +{ + const XML_PATH_ORDER_STATUS = 'catalog/downloadable/order_status'; + + const LINK_STATUS_PENDING = 'pending'; + const LINK_STATUS_AVAILABLE = 'available'; + const LINK_STATUS_EXPIRED = 'expired'; + + /** + * Enter description here... + * + */ + protected function _construct() + { + $this->_init('downloadable/link_purchased_item'); + parent::_construct(); + } + +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link.php new file mode 100644 index 0000000000..32a0171a00 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link.php @@ -0,0 +1,133 @@ + + */ +class Mage_Downloadable_Model_Mysql4_Link extends Mage_Core_Model_Mysql4_Abstract +{ + + /** + * Varien class constructor + * + */ + protected function _construct() + { + $this->_init('downloadable/link', 'link_id'); + } + + /** + * Save title and price of link item + * + * @param Mage_Downloadable_Model_Link $linkObject + * @return Mage_Downloadable_Model_Mysql4_link + */ + public function saveItemTitleAndPrice($linkObject) + { + $stmt = $this->_getReadAdapter()->select() + ->from($this->getTable('downloadable/link_title')) + ->where('link_id = ?', $linkObject->getId()) + ->where('store_id = ?', $linkObject->getStoreId()); + if ($this->_getReadAdapter()->fetchOne($stmt)) { + $where = $this->_getReadAdapter()->quoteInto('link_id = ?', $linkObject->getId()) . + ' AND ' . $this->_getReadAdapter()->quoteInto('store_id = ?', $linkObject->getStoreId()); + if ($linkObject->getUseDefaultTitle()) { + $this->_getWriteAdapter()->delete( + $this->getTable('downloadable/link_title'), $where); + } else { + $this->_getWriteAdapter()->update( + $this->getTable('downloadable/link_title'), + array('title' => $linkObject->getTitle()), $where); + } + } else { + if (!$linkObject->getUseDefaultTitle()) { + $this->_getWriteAdapter()->insert( + $this->getTable('downloadable/link_title'), + array( + 'link_id' => $linkObject->getId(), + 'store_id' => $linkObject->getStoreId(), + 'title' => $linkObject->getTitle(), + )); + } + } + $stmt = null; + $stmt = $this->_getReadAdapter()->select() + ->from($this->getTable('downloadable/link_price')) + ->where('link_id = ?', $linkObject->getId()) + ->where('website_id = ?', $linkObject->getWebsiteId()); + if ($this->_getReadAdapter()->fetchOne($stmt)) { + $where = $this->_getReadAdapter()->quoteInto('link_id = ?', $linkObject->getId()) . + ' AND ' . $this->_getReadAdapter()->quoteInto('website_id = ?', $linkObject->getWebsiteId()); + if ($linkObject->getUseDefaultPrice()) { + $this->_getReadAdapter()->delete( + $this->getTable('downloadable/link_price'), $where); + } else { + $this->_getWriteAdapter()->update( + $this->getTable('downloadable/link_price'), + array('price' => $linkObject->getPrice()), $where); + } + } else { + if (!$linkObject->getUseDefaultPrice()) { + $this->_getWriteAdapter()->insert( + $this->getTable('downloadable/link_price'), + array( + 'link_id' => $linkObject->getId(), + 'website_id' => $linkObject->getWebsiteId(), + 'price' => $linkObject->getPrice() + )); + } + } + return $this; + } + + public function deleteItems($items) + { + $where = ''; + if ($items instanceof Mage_Downloadable_Model_Link) { + $where = $this->_getReadAdapter()->quoteInto('link_id = ?', $items->getId()); + } + elseif (is_array($items)) { + $where = $this->_getReadAdapter()->quoteInto('link_id in (?)', $items); + } + else { + $where = $this->_getReadAdapter()->quoteInto('sample_id = ?', $items); + } + if ($where) { + $this->_getWriteAdapter()->delete( + $this->getTable('downloadable/link'), $where); + $this->_getWriteAdapter()->delete( + $this->getTable('downloadable/link_title'), $where); + $this->_getWriteAdapter()->delete( + $this->getTable('downloadable/link_price'),$where); + } + return $this; + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Collection.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Collection.php new file mode 100644 index 0000000000..b3c975cecc --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Collection.php @@ -0,0 +1,106 @@ + + */ +class Mage_Downloadable_Model_Mysql4_Link_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + + /** + * Enter description here... + * + */ + protected function _construct() + { + $this->_init('downloadable/link'); + } + + /** + * Enter description here... + * + * @param Mage_Catalog_Model_Product|array|integer|null $product + * @return Mage_Downloadable_Model_Mysql4_Link_Collection + */ + public function addProductToFilter($product) + { + if (empty($product)) { + $this->addFieldToFilter('product_id', ''); + } elseif (is_array($product)) { + $this->addFieldToFilter('product_id', array('in' => $product)); + } elseif ($product instanceof Mage_Catalog_Model_Product) { + $this->addFieldToFilter('product_id', $product->getId()); + } else { + $this->addFieldToFilter('product_id', $product); + } + + return $this; + } + + /** + * Enter description here... + * + * @param integer $storeId + * @return Mage_Downloadable_Model_Mysql4_Link_Collection + */ + public function addTitleToResult($storeId=0) + { + $this->getSelect() + ->joinLeft(array('default_title_table' => $this->getTable('downloadable/link_title')), + '`default_title_table`.link_id=`main_table`.link_id AND `default_title_table`.store_id = 0', + array('default_title'=>'title')) + ->joinLeft(array('store_title_table' => $this->getTable('downloadable/link_title')), + '`store_title_table`.link_id=`main_table`.link_id AND `store_title_table`.store_id = ' . intval($storeId), + array('store_title' => 'title','title' => new Zend_Db_Expr('IFNULL(`store_title_table`.title, `default_title_table`.title)'))) + ->order('main_table.sort_order ASC') + ->order('title ASC'); + + return $this; + } + + /** + * Enter description here... + * + * @param integer $websiteId + * @return Mage_Downloadable_Model_Mysql4_Link_Collection + */ + public function addPriceToResult($websiteId) + { + $this->getSelect() + ->joinLeft(array('default_price_table' => $this->getTable('downloadable/link_price')), + '`default_price_table`.link_id=`main_table`.link_id AND `default_price_table`.website_id = 0', + array('default_price' => 'price')) + ->joinLeft(array('website_price_table' => $this->getTable('downloadable/link_price')), + '`website_price_table`.link_id=`main_table`.link_id AND `website_price_table`.website_id = ' . intval($websiteId), + array('website_price' => 'price','price' => new Zend_Db_Expr('IFNULL(`website_price_table`.price, `default_price_table`.price)'))); + return $this; + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased.php new file mode 100644 index 0000000000..d2d2424f95 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased.php @@ -0,0 +1,46 @@ + + */ +class Mage_Downloadable_Model_Mysql4_Link_Purchased extends Mage_Core_Model_Mysql4_Abstract +{ + + /** + * Varien class constructor + * + */ + protected function _construct() + { + $this->_init('downloadable/link_purchased', 'purchased_id'); + } + +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Collection.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Collection.php new file mode 100644 index 0000000000..d995fdbaad --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Collection.php @@ -0,0 +1,53 @@ + + */ +class Mage_Downloadable_Model_Mysql4_Link_Purchased_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + + /** + * Enter description here... + * + */ + protected function _construct() + { + $this->_init('downloadable/link_purchased'); + } + + public function addPurchasedItemsToResult() + { + $this->getSelect() + ->join(array('purchased_items'=>$this->getTable('downloadable/link_purchased_item')), + '`purchased_items`.purchased_id=`main_table`.purchased_id'); + return $this; + } +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item.php new file mode 100644 index 0000000000..2455dbb5af --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item.php @@ -0,0 +1,46 @@ + + */ +class Mage_Downloadable_Model_Mysql4_Link_Purchased_Item extends Mage_Core_Model_Mysql4_Abstract +{ + + /** + * Varien class constructor + * + */ + protected function _construct() + { + $this->_init('downloadable/link_purchased_item', 'item_id'); + } + +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item/Collection.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item/Collection.php new file mode 100644 index 0000000000..e16bdedaaf --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item/Collection.php @@ -0,0 +1,46 @@ + + */ +class Mage_Downloadable_Model_Mysql4_Link_Purchased_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + + /** + * Enter description here... + * + */ + protected function _construct() + { + $this->_init('downloadable/link_purchased_item'); + } + +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Sample.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Sample.php new file mode 100644 index 0000000000..78ababcf80 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Sample.php @@ -0,0 +1,104 @@ + + */ +class Mage_Downloadable_Model_Mysql4_Sample extends Mage_Core_Model_Mysql4_Abstract +{ + + /** + * Varien class constructor + * + */ + protected function _construct() + { + $this->_init('downloadable/sample', 'sample_id'); + } + + /** + * Save title of sample item in store scope + * + * @param Mage_Downloadable_Model_Sample $sampleObject + * @return Mage_Downloadable_Model_Mysql4_Sample + */ + public function saveItemTitle($sampleObject) + { + $stmt = $this->_getReadAdapter()->select() + ->from($this->getTable('downloadable/sample_title')) + ->where('sample_id = ?', $sampleObject->getId()) + ->where('store_id = ?', $sampleObject->getStoreId()); + if ($this->_getReadAdapter()->fetchOne($stmt)) { + $where = $this->_getReadAdapter()->quoteInto('sample_id = ?', $sampleObject->getId()) . + ' AND ' . $this->_getReadAdapter()->quoteInto('store_id = ?', $sampleObject->getStoreId()); + if ($sampleObject->getUseDefaultTitle()) { + $this->_getWriteAdapter()->delete( + $this->getTable('downloadable/sample_title'), $where); + } else { + $this->_getWriteAdapter()->update( + $this->getTable('downloadable/sample_title'), + array('title' => $sampleObject->getTitle()), $where); + } + } else { + if (!$sampleObject->getUseDefaultTitle()) { + $this->_getWriteAdapter()->insert( + $this->getTable('downloadable/sample_title'), + array( + 'sample_id' => $sampleObject->getId(), + 'store_id' => $sampleObject->getStoreId(), + 'title' => $sampleObject->getTitle(), + )); + } + } + return $this; + } + + public function deleteItems($items) + { + $where = ''; + if ($items instanceof Mage_Downloadable_Model_Sample) { + $where = $this->_getReadAdapter()->quoteInto('sample_id = ?', $items->getId()); + } + elseif (is_array($items)) { + $where = $this->_getReadAdapter()->quoteInto('sample_id in (?)', $items); + } + else { + $where = $this->_getReadAdapter()->quoteInto('sample_id = ?', $items); + } + if ($where) { + $this->_getReadAdapter()->delete( + $this->getTable('downloadable/sample'),$where); + $this->_getReadAdapter()->delete( + $this->getTable('downloadable/sample_title'), $where); + } + return $this; + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Sample/Collection.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Sample/Collection.php new file mode 100644 index 0000000000..684df4f560 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Sample/Collection.php @@ -0,0 +1,88 @@ + + */ +class Mage_Downloadable_Model_Mysql4_Sample_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + + /** + * Enter description here... + * + */ + protected function _construct() + { + $this->_init('downloadable/sample'); + } + + /** + * Enter description here... + * + * @param Mage_Catalog_Model_Product|array|integer|null $product + * @return Mage_Downloadable_Model_Mysql4_Sample_Collection + */ + public function addProductToFilter($product) + { + if (empty($product)) { + $this->addFieldToFilter('product_id', ''); + } elseif (is_array($product)) { + $this->addFieldToFilter('product_id', array('in' => $product)); + } elseif ($product instanceof Mage_Catalog_Model_Product) { + $this->addFieldToFilter('product_id', $product->getId()); + } else { + $this->addFieldToFilter('product_id', $product); + } + + return $this; + } + + /** + * Enter description here... + * + * @param integer $storeId + * @return Mage_Downloadable_Model_Mysql4_Sample_Collection + */ + public function addTitleToResult($storeId=0) + { + $this->getSelect() + ->joinLeft(array('default_title_table' => $this->getTable('downloadable/sample_title')), + '`default_title_table`.sample_id=`main_table`.sample_id AND `default_title_table`.store_id = 0', + array('default_title' => 'title')) + ->joinLeft(array('store_title_table' => $this->getTable('downloadable/sample_title')), + '`store_title_table`.sample_id=`main_table`.sample_id AND `store_title_table`.store_id = ' . intval($storeId), + array('store_title' => 'title','title' => new Zend_Db_Expr('IFNULL(`store_title_table`.title, `default_title_table`.title)'))) + ->order('main_table.sort_order ASC') + ->order('title ASC'); + + return $this; + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/Observer.php b/app/code/core/Mage/Downloadable/Model/Observer.php new file mode 100644 index 0000000000..44e17eb96f --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Observer.php @@ -0,0 +1,200 @@ + + */ +class Mage_Downloadable_Model_Observer +{ + const XML_PATH_DISABLE_GUEST_CHECKOUT = 'catalog/downloadable/disable_guest_checkout'; + + /** + * Prepare product to save + * + * @param Varien_Object $observer + * @return Mage_Downloadable_Model_Observer + */ + public function prepareProductSave($observer) + { + $request = $observer->getEvent()->getRequest(); + $product = $observer->getEvent()->getProduct(); + + if ($downloadable = $request->getPost('downloadable')) { + $product->setDownloadableData($downloadable); + } + + return $this; + } + + /** + * Save data from order to purchased links + * + * @param Varien_Object $observer + * @return Mage_Downloadable_Model_Observer + */ + public function saveDownloadableOrderItem($observer) + { + $orderItem = $observer->getEvent()->getItem(); + $product = Mage::getModel('catalog/product') + ->setStoreId($orderItem->getOrder()->getStoreId()) + ->load($orderItem->getProductId()); + if ($product->getTypeId() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) { + $links = $product->getTypeInstance()->getLinks(); + if ($linkIds = $orderItem->getProductOptionByCode('links')) { + $linkPurchased = Mage::getModel('downloadable/link_purchased'); + Mage::helper('core')->copyFieldset( + 'downloadable_sales_copy_order', + 'to_downloadable', + $orderItem->getOrder(), + $linkPurchased + ); + Mage::helper('core')->copyFieldset( + 'downloadable_sales_copy_order_item', + 'to_downloadable', + $orderItem, + $linkPurchased + ); + $linkSectionTitle = ( + $product->getLinksTitle()? + $product->getLinksTitle():Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE) + ); + $linkPurchased->setLinkSectionTitle($linkSectionTitle) + ->save(); + foreach ($linkIds as $linkId) { + if (isset($links[$linkId])) { + $linkPurchasedItem = Mage::getModel('downloadable/link_purchased_item') + ->setPurchasedId($linkPurchased->getId()) + ->setOrderItemId($orderItem->getId()); + + Mage::helper('core')->copyFieldset( + 'downloadable_sales_copy_link', + 'to_purchased', + $links[$linkId], + $linkPurchasedItem + ); + $numberOfDownloads = $links[$linkId]->getNumberOfDownloads()*$orderItem->getQtyOrdered(); + $linkPurchasedItem->setNumberOfDownloadsBought($numberOfDownloads) + ->setStatus(Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING) + ->setCreatedAt($orderItem->getCreatedAt()) + ->setUpdatedAt($orderItem->getUpdatedAt()) + ->save(); + } + } + } + } + + return $this; + } + + /** + * Set checkout session flag if order has downloadable product(s) + * + * @param Varien_Object $observer + * @return Mage_Downloadable_Model_Observer + */ + public function setHasDownloadableProducts($observer) + { + $session = Mage::getSingleton('checkout/session'); + if (!$session->getHasDownloadableProducts()) { + $order = $observer->getEvent()->getOrder(); + foreach ($order->getAllVisibleItems() as $item) { + if ($item->getProductType() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) { + $session->setHasDownloadableProducts(true); + break; + } + } + } + return $this; + } + + /** + * Set status of link + * + * @param Varien_Object $observer + * @return Mage_Downloadable_Model_Observer + */ + public function setLinkStatus($observer) + { + $order = $observer->getEvent()->getOrder(); + /** @var $order Mage_Sales_Model_Order */ + $status = ''; + $orderStatusToEnable = Mage::getStoreConfig(Mage_Downloadable_Model_Link_Purchased_Item::XML_PATH_ORDER_STATUS); + if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) { + $status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING; + } elseif ($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED + || $order->getState() == Mage_Sales_Model_Order::STATE_CLOSED) { + $status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_EXPIRED; + } elseif ($order->getStatus() == $orderStatusToEnable) { + $status = Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_AVAILABLE; + } + if ($status) { + $orderItemsIds = array(); + foreach ($order->getAllItems() as $item) { + $orderItemsIds[] = $item->getId(); + } + $linkPurchased = Mage::getResourceModel('downloadable/link_purchased_item_collection') + ->addFieldToFilter('order_item_id', array('in'=>$orderItemsIds)); + foreach ($linkPurchased as $link) { + $link->setStatus($status); + $link->save(); + } + } + return $this; + } + + /** + * Check is allowed guest checkuot if quote contain downloadable product(s) + * + * @param Varien_Event_Observer $observer + * @return Mage_Downloadable_Model_Observer + */ + public function isAllowedGuestCheckout(Varien_Event_Observer $observer) + { + $quote = $observer->getEvent()->getQuote(); + /* @var $quote Mage_Sales_Model_Quote */ + $store = $observer->getEvent()->getStore(); + $result = $observer->getEvent()->getResult(); + + $isContain = false; + + foreach ($quote->getAllItems() as $item) { + if (($product = $item->getProduct()) && + $product->getTypeId() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) { + $isContain = true; + } + } + + if ($isContain && Mage::getStoreConfigFlag(self::XML_PATH_DISABLE_GUEST_CHECKOUT, $store)) { + $result->setIsAllowed(false); + } + + return $this; + } +} diff --git a/app/code/core/Mage/Downloadable/Model/Product/Price.php b/app/code/core/Mage/Downloadable/Model/Product/Price.php new file mode 100644 index 0000000000..0c6f344fc0 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Product/Price.php @@ -0,0 +1,72 @@ + + */ +class Mage_Downloadable_Model_Product_Price extends Mage_Catalog_Model_Product_Type_Price +{ + + /** + * Enter description here... + * + * @param integer $qty + * @param Mage_Catalog_Model_Product $product + * @return float + */ + public function getFinalPrice($qty=null, $product) + { + if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) { + return $product->getCalculatedFinalPrice(); + } + + $finalPrice = parent::getFinalPrice($qty, $product); + + /** + * links prices are added to base product price only if they can be purchased separately + */ + if ($product->getLinksPurchasedSeparately()) { + if ($linksIds = $product->getCustomOption('downloadable_link_ids')) { + $linkPrice = 0; + $links = $product->getTypeInstance()->getLinks(); + foreach (explode(',', $linksIds->getValue()) as $linkId) { + if (isset($links[$linkId])) { + $linkPrice += $links[$linkId]->getPrice(); + } + } + $finalPrice += $linkPrice; + } + } + + $product->setData('final_price', $finalPrice); + return max(0, $product->getData('final_price')); + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/Product/Type.php b/app/code/core/Mage/Downloadable/Model/Product/Type.php new file mode 100644 index 0000000000..c0d2378700 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Product/Type.php @@ -0,0 +1,327 @@ + + */ +class Mage_Downloadable_Model_Product_Type extends Mage_Catalog_Model_Product_Type_Virtual +{ + + const TYPE_DOWNLOADABLE = 'downloadable'; + + /** + * Get downloadable product links + * + * @return array + */ + public function getLinks() + { + $product = $this->getProduct(); + /* @var Mage_Catalog_Model_Product $product */ + if (is_null($product->getDownloadableLinks())) { + $_linkCollection = Mage::getModel('downloadable/link')->getCollection() + ->addProductToFilter($product->getId()) + ->addTitleToResult($product->getStoreId()) + ->addPriceToResult($product->getStore()->getWebsiteId()); + $linksCollectionById = array(); + foreach ($_linkCollection as $link) { + /* @var Mage_Downloadable_Model_Link $link */ + $link->setProduct($product); + $linksCollectionById[$link->getId()] = $link; + } + $product->setDownloadableLinks($linksCollectionById); + } + return $product->getDownloadableLinks(); + } + + /** + * Check if product has links + * + * @return boolean + */ + public function hasLinks() + { + return count($this->getLinks()) > 0; + } + + /** + * Check if product has options + * + * @return boolean + */ + public function hasOptions() + { + return true; + return $this->getProduct()->getLinksPurchasedSeparately() || parent::hasOptions(); + } + + /** + * Check if product cannot be purchased with no links selected + * + * @return boolean + */ + public function getLinkSelectionRequired() + { + return $this->getProduct()->getLinksPurchasedSeparately(); + } + + /** + * Get downloadable product samples + * + * @return Mage_Downloadable_Model_Mysql4_Sample_Collection + */ + public function getSamples() + { + $product = $this->getProduct(); + /* @var Mage_Catalog_Model_Product $product */ + if (is_null($product->getDownloadableSamples())) { + $_sampleCollection = Mage::getModel('downloadable/sample')->getCollection() + ->addProductToFilter($product->getId()) + ->addTitleToResult($product->getStoreId()); + $product->setDownloadableSamples($_sampleCollection); + } + + return $product->getDownloadableSamples(); + } + + /** + * Check if product has samples + * + * @return boolean + */ + public function hasSamples() + { + return count($this->getSamples()) > 0; + } + + /** + * Enter description here... + * + * @return Mage_Downloadable_Model_Product_Type + */ + public function save() + { + parent::save(); + + $product = $this->getProduct(); + /* @var Mage_Catalog_Model_Product $product */ + + if ($data = $product->getDownloadableData()) { + if (isset($data['sample'])) { + $_deleteItems = array(); + foreach ($data['sample'] as $sampleItem) { +// Zend_Debug::dump($sampleItem);die(); + if ($sampleItem['is_delete'] == '1') { + if ($sampleItem['sample_id']) { + $_deleteItems[] = $sampleItem['sample_id']; + } + } else { + unset($sampleItem['is_delete']); + if (!$sampleItem['sample_id']) { + unset($sampleItem['sample_id']); + } + $sampleModel = Mage::getModel('downloadable/sample'); + $files = array(); + if (isset($sampleItem['file'])) { + $files = Zend_Json::decode($sampleItem['file']); + unset($sampleItem['file']); + } + + $sampleModel->setData($sampleItem) + ->setSampleType($sampleItem['type']) + ->setProductId($product->getId()) + ->setStoreId($product->getStoreId()); + $fileStatusNew = false; + if (isset($files[0]) && $sampleModel->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) { + $sampleModel->setSampleFile($files[0]['file']); + if ($files[0]['status'] == 'new') { + $fileStatusNew = true; + } + } + + $sampleModel->save(); + if ($sampleModel->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE && $fileStatusNew) { + try { + Mage::helper('downloadable/file')->moveFileFromTmp( + Mage_Downloadable_Model_Sample::getBaseTmpPath(), + Mage_Downloadable_Model_Sample::getBasePath(), + $files[0]['file'] + ); + } catch (Exception $e) { + Mage::throwException(Mage::helper('downloadable')->__('An error occurred while saving the file(s).')); + } + } + } + } + if ($_deleteItems) { + Mage::getResourceModel('downloadable/sample')->deleteItems($_deleteItems); + } + } + if (isset($data['link'])) { + $_deleteItems = array(); + foreach ($data['link'] as $linkItem) { + if ($linkItem['is_delete'] == '1') { + if ($linkItem['link_id']) { + $_deleteItems[] = $linkItem['link_id']; + } + } else { + unset($linkItem['is_delete']); + if (!$linkItem['link_id']) { + unset($linkItem['link_id']); + } + $files = array(); + if (isset($linkItem['file'])) { + $files = Zend_Json::decode($linkItem['file']); + unset($linkItem['file']); + } + $sample = array(); + if (isset($linkItem['sample'])) { + $sample = $linkItem['sample']; + unset($linkItem['sample']); + } + $linkModel = Mage::getModel('downloadable/link') + ->setData($linkItem) + ->setLinkType($linkItem['type']) + ->setProductId($product->getId()) + ->setStoreId($product->getStoreId()) + ->setWebsiteId($product->getStore()->getWebsiteId()); + if ($linkModel->getIsUnlimited()) { + $linkModel->setNumberOfDownloads(0); + } + $fileStatusNew = false; + if (isset($files[0]) && $linkModel->getLinkType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) { + $linkModel->setLinkFile($files[0]['file']); + if ($files[0]['status'] == 'new') { + $fileStatusNew = true; + } + } + $sampleFileNew = false; + if ($sample && isset($sample['type'])) { + if ($sample['type'] == 'url' && $sample['url'] != '') { + $linkModel->setSampleUrl($sample['url']) + ->setSampleType($sample['type']); + } + $sampleFile = Zend_Json::decode($sample['file']); + if ($sample['type'] == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE && isset($sampleFile[0])) { + $linkModel->setSampleFile($sampleFile[0]['file']) + ->setSampleType($sample['type']); + if ($sampleFile[0]['status'] == 'new') { + $sampleFileNew = true; + } + } + } + $linkModel->save(); + if ($linkModel->getLinkType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE && $fileStatusNew) { + try { + Mage::helper('downloadable/file')->moveFileFromTmp( + Mage_Downloadable_Model_Link::getBaseTmpPath(), + Mage_Downloadable_Model_Link::getBasePath(), + $files[0]['file'] + ); + } catch (Exception $e) { + Mage::throwException(Mage::helper('downloadable')->__('An error occurred while saving the file(s).')); + } + } + if ($linkModel->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE && $sampleFileNew) { + try { + Mage::helper('downloadable/file')->moveFileFromTmp( + Mage_Downloadable_Model_Link::getBaseSampleTmpPath(), + Mage_Downloadable_Model_Link::getBaseSamplePath(), + $sampleFile[0]['file'] + ); + } catch (Exception $e) { + Mage::throwException(Mage::helper('downloadable')->__('An error occurred while saving the file(s).')); + } + } + } + } + if ($_deleteItems) { + Mage::getResourceModel('downloadable/link')->deleteItems($_deleteItems); + } + } + } + + return $this; + } + + /** + * Enter description here... + * + * @param Varien_Object $buyRequest + * @return array|string + */ + public function prepareForCart(Varien_Object $buyRequest) + { + $result = parent::prepareForCart($buyRequest); + + if (is_string($result)) { + return $result; + } + $preparedLinks = array(); + if ($this->getProduct()->getLinksPurchasedSeparately()) { + if ($links = $buyRequest->getLinks()) { + foreach ($this->getLinks() as $link) { + if (in_array($link->getId(), $links)) { + $preparedLinks[] = $link->getId(); + } + } + } + } else { + foreach ($this->getLinks() as $link) { + $preparedLinks[] = $link->getId(); + } + } + if ($preparedLinks) { + $this->getProduct()->addCustomOption('downloadable_link_ids', implode(',', $preparedLinks)); + return $result; + } + if ($this->getLinkSelectionRequired()) { + return Mage::helper('downloadable')->__('Please specify product link(s).'); + } + return $result; + } + + public function getOrderOptions() + { + $options = parent::getOrderOptions(); + if ($linkIds = $this->getProduct()->getCustomOption('downloadable_link_ids')) { + $linkOptions = array(); + $links = $this->getLinks(); + foreach (explode(',', $linkIds->getValue()) as $linkId) { + if (isset($links[$linkId])) { + $linkOptions[] = $linkId; + } + } + $options = array_merge($options, array('links' => $linkOptions)); + } + return $options; + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php new file mode 100644 index 0000000000..cf10ad8d1c --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php @@ -0,0 +1,69 @@ + + */ +class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract extends Mage_Sales_Model_Order_Pdf_Items_Abstract +{ + protected $_purchasedLinks = null; + + /** + * Return Purchased link for order item + * + * @return Mage_Downloadable_Model_Link_Purchased + */ + public function getLinks() + { + $this->_purchasedLinks = Mage::getModel('downloadable/link_purchased') + ->load($this->getOrder()->getId(), 'order_id'); + $purchasedItems = Mage::getModel('downloadable/link_purchased_item')->getCollection() + ->addFieldToFilter('order_item_id', $this->getItem()->getOrderItem()->getId()); + $this->_purchasedLinks->setPurchasedItems($purchasedItems); + + return $this->_purchasedLinks; + } + + /** + * Return Links Section Title for order item + * + * @return string + */ + public function getLinksTitle() + { + if ($this->_purchasedLinks->getLinkSectionTitle()) { + return $this->_purchasedLinks->getLinkSectionTitle(); + } + return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE); + } + + public function draw(){} +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php new file mode 100644 index 0000000000..cb991a1b09 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -0,0 +1,137 @@ + + */ +class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Creditmemo extends Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract +{ + public function draw() + { + $order = $this->getOrder(); + $item = $this->getItem(); + $pdf = $this->getPdf(); + $page = $this->getPage(); + +// Mage::getModel('sales/order_pdf_items_creditmemo_default') +// ->setOrder($this->getOrder()) +// ->setItem($this->getItem()) +// ->setPdf($this->getPdf()) +// ->setPage($this->getPage()) +// ->draw(); + + $shift = array(0, 10, 0); + $leftBound = 35; + $rightBound = 565; + + // draw name + $this->_setFontRegular(); + $x = $leftBound; + foreach (Mage::helper('core/string')->str_split($item->getName(), $x, true, true) as $key => $part) { + $page->drawText($part, $x, $pdf->y - $shift[0], 'UTF-8'); + $shift[0] += 10; + } + // draw options + $options = $this->getItemOptions(); + if (isset($options)) { + foreach ($options as $option) { + // draw options label + $this->_setFontItalic(); + foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), $x, false, true) as $_option) { + $page->drawText($_option, $x, $pdf->y - $shift[0], 'UTF-8'); + $shift[0] += 10; + } + // draw options value + $this->_setFontRegular(); + foreach (Mage::helper('core/string')->str_split(strip_tags($option['value']), $x, true, true) as $_value) { + $page->drawText($_value, $x + 5, $pdf->y - $shift[0], 'UTF-8'); + $shift[0] += 10; + } + } + } + // draw product description + foreach ($this->_parseDescription() as $description){ + $page->drawText(strip_tags($description), $x + 5, $pdf->y - $shift[1], 'UTF-8'); + $shift[1] += 10; + } + $x += 220; + + // draw SKU + foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) { + $page->drawText($part, $x, $pdf->y - $shift[2], 'UTF-8'); + $shift[2] += 10; + } + $x += 100; + + $font = $this->_setFontBold(); + + // draw Total(ex) + $text = $order->formatPriceTxt($item->getRowTotal()); + $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8'); + $x += 50; + + // draw Discount + $text = $order->formatPriceTxt(-$item->getDiscountAmount()); + $page->drawText($text, $pdf->getAlignRight($text, $x, 50, $font, 7), $pdf->y, 'UTF-8'); + $x += 50; + + // draw QTY + $text = $item->getQty() * 1; + $page->drawText($text, $pdf->getAlignCenter($text, $x, 30, $font, 7), $pdf->y, 'UTF-8'); + $x += 30; + + // draw Tax + $text = $order->formatPriceTxt($item->getTaxAmount()); + $page->drawText($text, $pdf->getAlignRight($text, $x, 45, $font, 7, 10), $pdf->y, 'UTF-8'); + $x += 45; + + // draw Total(inc) + $text = $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount()); + $page->drawText($text, $pdf->getAlignRight($text, $x, $rightBound - $x, $font, 7, 0), $pdf->y, 'UTF-8'); + + // draw Links Section Title + $this->_setFontItalic(); + $pdf->y -= 10; + $x = $leftBound; + $_purchasedItems = $this->getLinks()->getPurchasedItems(); + $page->drawText($this->getLinksTitle(), $x, $pdf->y, 'UTF-8'); + + // draw Links + $this->_setFontRegular(); + foreach ($_purchasedItems as $_link) { + $pdf->y -= 10; +// $text = $_link->getLinkTitle() . ' ('.$_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought()?$_link->getNumberOfDownloadsBought():'U').')'; + $text = $_link->getLinkTitle(); + $page->drawText($text, $x+10, $pdf->y, 'UTF-8'); + } + $pdf->y -= 15; + } +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php new file mode 100644 index 0000000000..8dec4ab5e5 --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php @@ -0,0 +1,120 @@ + + */ +class Mage_Downloadable_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Downloadable_Model_Sales_Order_Pdf_Items_Abstract +{ + public function draw() + { + $order = $this->getOrder(); + $item = $this->getItem(); + $pdf = $this->getPdf(); + $page = $this->getPage(); + $shift = array(0, 10, 0); + $leftBound = 35; + + $this->_setFontRegular(); + + $page->drawText($item->getQty()*1, 435, $pdf->y, 'UTF-8'); + + /* in case Product name is longer than 80 chars - it is written in a few lines */ + foreach (Mage::helper('core/string')->str_split($item->getName(), 60, true, true) as $key => $part) { + $page->drawText($part, 35, $pdf->y-$shift[0], 'UTF-8'); + $shift[0] += 10; + } + + $options = $this->getItemOptions(); + if (isset($options)) { + foreach ($options as $option) { + // draw options label + $this->_setFontItalic(); + foreach (Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true) as $_option) { + $page->drawText($_option, 35, $pdf->y-$shift[0], 'UTF-8'); + $shift[0] += 10; + } + // draw options value + $this->_setFontRegular(); + if ($option['value']) { + $values = explode(', ', strip_tags($option['value'])); + foreach ($values as $value) { + foreach (Mage::helper('core/string')->str_split($value, 60,true,true) as $_value) { + $page->drawText($_value, 40, $pdf->y-$shift[0], 'UTF-8'); + $shift[0] += 10; + } + } + } + } + } + + foreach ($this->_parseDescription() as $description){ + $page->drawText(strip_tags($description), 65, $pdf->y-$shift[1], 'UTF-8'); + $shift[1] += 10; + } + + /* in case Product SKU is longer than 36 chars - it is written in a few lines */ + foreach (Mage::helper('core/string')->str_split($this->getSku($item), 25) as $key => $part) { + if ($key > 0) { + $shift[2] += 10; + } + $page->drawText($part, 240, $pdf->y-$shift[2], 'UTF-8'); + } + + $font = $this->_setFontBold(); + + $row_total = $order->formatPriceTxt($item->getRowTotal()); + $page->drawText($row_total, 565-$pdf->widthForStringUsingFontSize($row_total, $font, 7), $pdf->y, 'UTF-8'); + + $price = $order->formatPriceTxt($item->getPrice()); + $page->drawText($price, 395-$pdf->widthForStringUsingFontSize($price, $font, 7), $pdf->y, 'UTF-8'); + + $tax = $order->formatPriceTxt($item->getTaxAmount()); + $page->drawText($tax, 495-$pdf->widthForStringUsingFontSize($tax, $font, 7), $pdf->y, 'UTF-8'); + + // draw Links Section Title + $this->_setFontItalic(); + $pdf->y -= 10; + $x = $leftBound; + $_purchasedItems = $this->getLinks()->getPurchasedItems(); + $page->drawText($this->getLinksTitle(), $x, $pdf->y, 'UTF-8'); + + // draw Links + $this->_setFontRegular(); + foreach ($_purchasedItems as $_link) { + $pdf->y -= 10; +// $text = $_link->getLinkTitle() . ' ('.$_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought()?$_link->getNumberOfDownloadsBought():'U').')'; + $text = $_link->getLinkTitle(); + $page->drawText($text, $x+10, $pdf->y, 'UTF-8'); + } + $pdf->y -= 15; + } +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/Model/Sample.php b/app/code/core/Mage/Downloadable/Model/Sample.php new file mode 100644 index 0000000000..583e8784ea --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/Sample.php @@ -0,0 +1,93 @@ + + */ +class Mage_Downloadable_Model_Sample extends Mage_Core_Model_Abstract +{ + const XML_PATH_SAMPLES_TITLE = 'catalog/downloadable/samples_title'; + + /** + * Enter description here... + * + */ + protected function _construct() + { + $this->_init('downloadable/sample'); + parent::_construct(); + } + + /** + * Return sample files path + * + * @return string + */ + public static function getSampleDir() + { + return Mage::getBaseDir(); + } + + /** + * Enter description here... + * + * @return Mage_Downloadable_Model_Sample + */ + protected function _afterSave() + { + $this->getResource()->saveItemTitle($this); + return parent::_afterSave(); + } + + /** + * Enter description here... + * + * @return string + */ + public function getUrl() + { + if ($this->getSampleUrl()) { + return $this->getSampleUrl(); + } else { + return $this->getSampleFile(); + } + } + + public static function getBaseTmpPath() + { + return Mage::getBaseDir('media') . DS . 'downloadable' . DS . 'tmp' . DS . 'samples'; + } + + public static function getBasePath() + { + return Mage::getBaseDir('media') . DS . 'downloadable' . DS . 'files' . DS . 'samples'; + } + +} diff --git a/app/code/core/Mage/Downloadable/Model/System/Config/Source/Contentdisposition.php b/app/code/core/Mage/Downloadable/Model/System/Config/Source/Contentdisposition.php new file mode 100644 index 0000000000..4ccf9aaa6e --- /dev/null +++ b/app/code/core/Mage/Downloadable/Model/System/Config/Source/Contentdisposition.php @@ -0,0 +1,50 @@ + + */ +class Mage_Downloadable_Model_System_Config_Source_Contentdisposition +{ + public function toOptionArray() + { + return array( + array( + 'value' => 'attachment', + 'label' => Mage::helper('downloadable')->__('attachment') + ), + array( + 'value' => 'inline', + 'label' => Mage::helper('downloadable')->__('inline') + ) + ); + } +} + diff --git a/app/code/core/Mage/Downloadable/controllers/CustomerController.php b/app/code/core/Mage/Downloadable/controllers/CustomerController.php new file mode 100644 index 0000000000..cc024bc751 --- /dev/null +++ b/app/code/core/Mage/Downloadable/controllers/CustomerController.php @@ -0,0 +1,62 @@ + + */ +class Mage_Downloadable_CustomerController extends Mage_Core_Controller_Front_Action +{ + + /** + * Check customer authentication + */ + public function preDispatch() + { + parent::preDispatch(); + $action = $this->getRequest()->getActionName(); + $loginUrl = Mage::helper('customer')->getLoginUrl(); + + if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) { + $this->setFlag('', self::FLAG_NO_DISPATCH, true); + } + } + + /** + * Display downloadable links bought by customer + * + */ + public function productsAction() + { + $this->loadLayout(); + $this->_initLayoutMessages('customer/session'); + $this->renderLayout(); + } + +} diff --git a/app/code/core/Mage/Downloadable/controllers/DownloadController.php b/app/code/core/Mage/Downloadable/controllers/DownloadController.php new file mode 100644 index 0000000000..a9c1797583 --- /dev/null +++ b/app/code/core/Mage/Downloadable/controllers/DownloadController.php @@ -0,0 +1,210 @@ + + */ +class Mage_Downloadable_DownloadController extends Mage_Core_Controller_Front_Action +{ + + /** + * Return core session object + * + * @return Mage_Core_Model_Session + */ + protected function _getSession() + { + return Mage::getSingleton('core/session'); + } + + /** + * Return customer session object + * + * @return Mage_Customer_Model_Session + */ + protected function _getCustomerSession() + { + return Mage::getSingleton('customer/session'); + } + + protected function _processDownload($resource, $resourceType) + { + $helper = Mage::helper('downloadable/download'); + /* @var $helper Mage_Downloadable_Helper_Download */ + + $helper->setResource($resource, $resourceType); + + $fileName = $helper->getFilename(); + $contentType = $helper->getContentType(); + + $this->getResponse() + ->setHttpResponseCode(200) + ->setHeader('Pragma', 'public', true) + ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true) + ->setHeader('Content-type', $contentType, true); + + if ($fileSize = $helper->getFilesize()) { + $this->getResponse() + ->setHeader('Content-Length', $fileSize); + } + + if ($contentDisposition = $helper->getContentDisposition()) { + $this->getResponse() + ->setHeader('Content-Disposition', $contentDisposition . '; filename='.$fileName); + } + + $this->getResponse() + ->clearBody(); + $this->getResponse() + ->sendHeaders(); + + $helper->output(); + } + + /** + * Download sample action + * + */ + public function sampleAction() + { + $sampleId = $this->getRequest()->getParam('sample_id', 0); + $sample = Mage::getModel('downloadable/sample')->load($sampleId); + if ($sample->getId()) { + if ($sample->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_URL) { + $resource = $sample->getSampleUrl(); + $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_URL; + } elseif ($sample->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) { + $resource = Mage::helper('downloadable/file')->getFilePath( + Mage_Downloadable_Model_Sample::getBasePath(), $sample->getSampleFile() + ); + $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_FILE; + } + try { + $this->_processDownload($resource, $resourceType); + exit(); + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact store owner.')); + } + } + return $this->_redirectReferer(); + } + + /** + * Download link's sample action + * + */ + public function linkSampleAction() + { + $linkId = $this->getRequest()->getParam('link_id', 0); + $link = Mage::getModel('downloadable/link')->load($linkId); + if ($link->getId()) { + if ($link->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_URL) { + $resource = $link->getSampleUrl(); + $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_URL; + } elseif ($link->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) { + $resource = Mage::helper('downloadable/file')->getFilePath( + Mage_Downloadable_Model_Link::getBaseSamplePath(), $link->getSampleFile() + ); + $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_FILE; + } + try { + $this->_processDownload($resource, $resourceType); + } catch (Mage_Core_Exception $e) { + $this->_getCustomerSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact store owner.')); + } + } + return $this->_redirectReferer(); + } + + /** + * Download link action + */ + public function linkAction() + { + $id = $this->getRequest()->getParam('id', 0); + $linkPurchasedItem = Mage::getModel('downloadable/link_purchased_item')->load($id); + if (!Mage::helper('downloadable')->getIsShareable($linkPurchasedItem)) { + if (!$this->_getCustomerSession()->getCustomerId()) { + $product = Mage::getModel('catalog/product')->load($linkPurchasedItem->getProductId()); + if ($product->getId()) { + $notice = Mage::helper('downloadable')->__( + 'Please log in to download your product or purchase %s.', + $product->getProductUrl(), $product->getName() + ); + } else { + $notice = Mage::helper('downloadable')->__('Please log in to download your product.'); + } + $this->_getCustomerSession()->addNotice($notice); + $this->_getCustomerSession()->authenticate($this); + $this->_getCustomerSession()->setBeforeAuthUrl(Mage::getUrl('downloadable/customer/products/'), array('_secure' => true)); + return ; + } + } + $downloadsLeft = $linkPurchasedItem->getNumberOfDownloadsBought() - $linkPurchasedItem->getNumberOfDownloadsUsed(); + if ($linkPurchasedItem->getStatus() == Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_AVAILABLE + && ($downloadsLeft || $linkPurchasedItem->getNumberOfDownloadsBought() == 0)) { + if ($linkPurchasedItem->getLinkType() == Mage_Downloadable_Helper_Download::LINK_TYPE_URL) { + $resource = $linkPurchasedItem->getLinkUrl(); + $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_URL; + } elseif ($linkPurchasedItem->getLinkType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) { + $resource = Mage::helper('downloadable/file')->getFilePath( + Mage_Downloadable_Model_Link::getBasePath(), $linkPurchasedItem->getLinkFile() + ); + $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_FILE; + } + try { + $this->_processDownload($resource, $resourceType); + $linkPurchasedItem->setNumberOfDownloadsUsed( + $linkPurchasedItem->getNumberOfDownloadsUsed()+1 + ); + if ($linkPurchasedItem->getNumberOfDownloadsBought() != 0 + && !($linkPurchasedItem->getNumberOfDownloadsBought() - $linkPurchasedItem->getNumberOfDownloadsUsed())) { + $linkPurchasedItem->setStatus(Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_EXPIRED); + } + $linkPurchasedItem->save(); + } + catch (Exception $e) { + $this->_getCustomerSession()->addError( + Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact store owner.') + ); + } + } elseif ($linkPurchasedItem->getStatus() == Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_EXPIRED) { + $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__('Link is expired.')); + } elseif ($linkPurchasedItem->getStatus() == Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING) { + $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__('Link is not available.')); + } else { + $this->_getCustomerSession()->addError( + Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact store owner.') + ); + } + return $this->_redirect('*/customer/products'); + } + +} diff --git a/app/code/core/Mage/Downloadable/controllers/FileController.php b/app/code/core/Mage/Downloadable/controllers/FileController.php new file mode 100644 index 0000000000..a34d3ea49c --- /dev/null +++ b/app/code/core/Mage/Downloadable/controllers/FileController.php @@ -0,0 +1,74 @@ + + */ +class Mage_Downloadable_FileController extends Mage_Adminhtml_Controller_Action +{ + public function uploadAction() + { + $type = $this->getRequest()->getParam('type'); + $tmpPath = ''; + if ($type == 'samples') { + $tmpPath = Mage_Downloadable_Model_Sample::getBaseTmpPath(); + } elseif ($type == 'links') { + $tmpPath = Mage_Downloadable_Model_Link::getBaseTmpPath(); + } elseif ($type == 'link_samples') { + $tmpPath = Mage_Downloadable_Model_Link::getBaseSampleTmpPath(); + } + $result = array(); + try { + $uploader = new Varien_File_Uploader($type); +// $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png')); + $uploader->setAllowRenameFiles(true); + $uploader->setFilesDispersion(true); + $result = $uploader->save($tmpPath); +//file_put_contents('/home/ruslan.voitenko/dev/magento.1.x.x/upload2.txt', print_r($tmpPath, true)); +// $result['file'] = $result['file'] . '.tmp'; + $result['cookie'] = array( + 'name' => session_name(), + 'value' => $this->_getSession()->getSessionId(), + 'lifetime' => $this->_getSession()->getCookieLifetime(), + 'path' => $this->_getSession()->getCookiePath(), + 'domain' => $this->_getSession()->getCookieDomain() + ); + } catch (Exception $e) { + $result = array('error'=>$e->getMessage(), 'errorcode'=>$e->getCode()); + } + + $this->getResponse()->setBody(Zend_Json::encode($result)); + } + + protected function _isAllowed() + { + return Mage::getSingleton('admin/session')->isAllowed('catalog/products'); + } +} \ No newline at end of file diff --git a/app/code/core/Mage/Downloadable/controllers/Product/EditController.php b/app/code/core/Mage/Downloadable/controllers/Product/EditController.php new file mode 100644 index 0000000000..96d0317c28 --- /dev/null +++ b/app/code/core/Mage/Downloadable/controllers/Product/EditController.php @@ -0,0 +1,61 @@ + + */ +class Mage_Downloadable_Product_EditController extends Mage_Adminhtml_Catalog_ProductController +{ + + /** + * Varien class constructor + * + */ + protected function _construct() + { + $this->setUsedModuleName('Mage_Downloadable'); + } + + /** + * Load downloadable tab fieldsets + * + */ + public function formAction() + { + $this->_initProduct(); + $this->getResponse()->setBody( + $this->getLayout()->createBlock('downloadable/adminhtml_catalog_product_edit_tab_downloadable', 'admin.product.downloadable.information') + ->toHtml() + ); + } + +} diff --git a/app/code/core/Mage/Downloadable/etc/config.xml b/app/code/core/Mage/Downloadable/etc/config.xml new file mode 100644 index 0000000000..77199e342e --- /dev/null +++ b/app/code/core/Mage/Downloadable/etc/config.xml @@ -0,0 +1,904 @@ + + + + + + 0.1.12 + + + + + + order_id + order_increment_id + * + * + * + + + product_name + product_sku + + + * + * + <to_purchased>link_title</to_purchased> + * + * + * + * + + + + + + + + + + + + + + + Mage_Downloadable_Model + downloadable_mysql4 + + + Mage_Downloadable_Model_Mysql4 + + + downloadable_link
+ + + downloadable_link_title
+
+ + downloadable_link_price
+
+ + downloadable_sample
+
+ + downloadable_sample_title
+
+ + downloadable_link_purchased
+
+ + downloadable_link_purchased_item
+
+
+
+
+ + + Mage_Downloadable_Block + + + + + + Mage_Downloadable + Mage_Catalog_Model_Resource_Eav_Mysql4_Setup + + + core_setup + + + + + core_write + + + + + core_read + + + + + + + + + downloadable/product_type + 1 + downloadable/product_price + downloadable/catalogIndex_data_downloadable + + + + + + + downloadable/sales_order_pdf_items_invoice + + + downloadable/sales_order_pdf_items_creditmemo + + + + + application/vnd.lotus-1-2-3 + text/vnd.in3d.3dml + video/3gpp2 + video/3gpp + application/x-ace-compressed + application/vnd.acucobol + application/vnd.audiograph + application/postscript + audio/x-aiff + + audio/x-aiff + audio/x-aiff + application/vnd.amiga.ami + application/vnd.lotus-approach + video/x-ms-asf + application/vnd.accpac.simply.aso + video/x-ms-asf + application/atom+xml + application/atomcat+xml + + application/atomsvc+xml + application/vnd.antix.game-component + audio/basic + video/x-msvideo + application/x-msdownload + application/x-bcpio + application/vnd.syncml.dm+wbxml + application/vnd.fujitsu.oasysprs + application/vnd.bmi + + image/bmp + application/vnd.previewsystems.box + application/x-bzip2 + image/prs.btif + application/x-bzip + application/x-bzip2 + application/vnd.ms-cab-compressed + application/ccxml+xml + application/vnd.contact.cmsg + + application/vnd.mediastation.cdkey + chemical/x-cdx + application/vnd.chemdraw+xml + application/vnd.cinderella + application/pkix-cert + image/cgm + application/x-chat + application/vnd.ms-htmlhelp + application/vnd.kde.kchart + + chemical/x-cif + application/vnd.anser-web-certificate-issue-initiation + application/vnd.ms-artgalry + application/vnd.claymore + application/vnd.crick.clicker.keyboard + application/vnd.crick.clicker.palette + application/vnd.crick.clicker.template + application/vnd.crick.clicker.wordbank + application/vnd.crick.clicker + + application/x-msclip + application/vnd.cosmocaller + chemical/x-cmdf + chemical/x-cml + application/vnd.yellowriver-custom-menu + image/x-cmx + application/x-msdownload + text/plain + application/x-cpio + + application/mac-compactpro + application/x-mscardfile + application/pkix-crl + application/x-x509-ca-cert + application/x-csh + chemical/x-csml + text/css + text/csv + application/vnd.curl + + application/prs.cww + application/vnd.mobius.daf + application/davmount+xml + application/vnd.oma.dd2+xml + application/vnd.fujixerox.ddd + text/plain + application/x-x509-ca-cert + application/vnd.dreamfactory + application/vnd.mobius.dis + + image/vnd.djvu + image/vnd.djvu + application/x-msdownload + application/vnd.dna + application/msword + application/msword + application/vnd.osgi.dp + application/vnd.dpgraph + text/prs.lines.tag + + application/xml-dtd + application/x-dvi + model/vnd.dwf + image/vnd.dwg + image/vnd.dxf + application/vnd.spotfire.dxp + audio/vnd.nuera.ecelp4800 + audio/vnd.nuera.ecelp7470 + audio/vnd.nuera.ecelp9600 + + application/ecmascript + application/vnd.novadigm.edm + application/vnd.novadigm.edx + application/vnd.picsel + application/vnd.pg.osasli + message/rfc822 + audio/vnd.digital-winds + application/vnd.ms-fontobject + application/postscript + + application/vnd.epson.esf + text/x-setext + application/x-msdownload + application/vnd.novadigm.ext + application/andrew-inset + application/vnd.ezpix-album + application/vnd.ezpix-package + image/vnd.fastbidsheet + application/vnd.fdf + + application/vnd.denovo.fcselayout-link + application/vnd.fujitsu.oasysgp + video/x-fli + application/vnd.micrografx.flo + application/vnd.kde.kivio + text/vnd.fmi.flexstor + text/vnd.fly + application/vnd.frogans.fnc + image/vnd.fpx + + application/vnd.fsc.weblaunch + image/vnd.fst + application/vnd.fluxtime.clip + application/vnd.anser-web-funds-transfer-initiation + video/vnd.fvt + application/vnd.fuzzysheet + image/g3fax + application/vnd.groove-account + model/vnd.gdl + + application/vnd.groove-help + image/gif + application/vnd.groove-identity-message + application/vnd.flographit + application/srgs + application/vnd.groove-injector + application/srgs+xml + application/x-gtar + application/vnd.groove-tool-message + + model/vnd.gtw + video/h261 + video/h263 + video/h264 + application/vnd.hbci + application/x-hdf + application/winhlp + application/vnd.hp-hpgl + application/vnd.hp-hpid + + application/vnd.hp-hps + application/mac-binhex40 + application/vnd.kenameaapp + text/html + text/html + application/vnd.yamaha.hv-dic + application/vnd.yamaha.hv-voice + application/vnd.yamaha.hv-script + #x-conference/x-cooltalk + + image/x-icon + text/calendar + image/ief + text/calendar + application/vnd.shana.informed.formdata + application/vnd.igloader + application/vnd.micrografx.igx + application/vnd.shana.informed.interchange + application/vnd.accpac.simply.imp + + application/vnd.ms-ims + text/plain + application/vnd.shana.informed.package + application/vnd.ibm.rights-management + application/vnd.irepository.package+xml + application/vnd.shana.informed.formtemplate + application/vnd.immervision-ivp + application/vnd.immervision-ivu + text/vnd.sun.j2me.app-descriptor + + application/vnd.jam + text/x-java-source + application/vnd.jisp + application/vnd.hp-jlyt + application/vnd.joost.joda-archive + image/jpeg + image/jpeg + image/jpeg + video/jpm + + video/jpeg + video/jpm + application/javascript + application/json + audio/midi + application/vnd.kde.karbon + application/vnd.kde.kformula + application/vnd.kidspiration + application/vnd.google-earth.kml+xml + + application/vnd.google-earth.kmz + application/vnd.kde.kontour + application/vnd.kde.kspread + application/x-latex + application/vnd.llamagraphics.life-balance.desktop + application/vnd.llamagraphics.life-balance.exchange+xml + application/vnd.hhe.lesson-player + text/plain + text/plain + + application/vnd.ms-lrm + application/vnd.frogans.ltf + audio/vnd.lucent.voice + application/vnd.lotus-wordpro + application/x-msmediaview + application/x-msmediaview + video/mpeg + audio/mpeg + audio/mpeg + + audio/x-mpegurl + video/vnd.mpegurl + application/vnd.ecowin.chart + application/mathml+xml + application/vnd.mobius.mbk + application/mbox + application/vnd.medcalcdata + application/vnd.mcd + application/x-msaccess + + image/vnd.ms-modi + model/mesh + application/vnd.mfmp + application/vnd.proteus.magazine + audio/midi + audio/midi + application/vnd.mif + message/rfc822 + video/mj2 + + video/mj2 + application/vnd.dolby.mlp + application/vnd.chipnuts.karaoke-mmd + application/vnd.smaf + image/vnd.fujixerox.edmics-mmr + application/x-msmoney + video/quicktime + video/x-sgi-movie + audio/mpeg + + audio/mpeg + audio/mpeg + video/mp4 + audio/mp4 + application/mp4 + video/mp4 + application/vnd.mophun.certificate + video/mpeg + video/mpeg + + video/mpeg + video/mp4 + audio/mpeg + application/vnd.apple.installer+xml + application/vnd.blueice.multipass + application/vnd.mophun.application + application/vnd.ms-project + application/vnd.ms-project + application/vnd.ibm.minipay + + application/vnd.mobius.mqy + application/marc + application/mediaservercontrol+xml + application/vnd.mseq + application/vnd.epson.msf + model/mesh + application/x-msdownload + application/vnd.mobius.msl + application/vnd.muvee.style + + model/vnd.mts + application/vnd.musician + application/x-msmediaview + application/vnd.mfer + application/mxf + application/vnd.recordare.musicxml + application/xv+xml + application/vnd.triscape.mxs + video/vnd.mpegurl + + application/vnd.nokia.n-gage.symbian.install + application/vnd.nokia.n-gage.data + application/vnd.neurolanguage.nlu + application/vnd.enliven + application/vnd.noblenet-directory + application/vnd.noblenet-sealer + application/vnd.noblenet-web + image/vnd.net-fpx + application/vnd.lotus-notes + + application/vnd.fujitsu.oasys2 + application/vnd.fujitsu.oasys3 + application/vnd.fujitsu.oasys + application/x-msbinder + application/oda + application/vnd.oasis.opendocument.chart + application/vnd.oasis.opendocument.formula + application/vnd.oasis.opendocument.graphics + application/vnd.oasis.opendocument.image + + application/vnd.oasis.opendocument.presentation + application/vnd.oasis.opendocument.spreadsheet + application/vnd.oasis.opendocument.text + application/ogg + application/vnd.palm + application/vnd.lotus-organizer + application/vnd.oasis.opendocument.chart-template + application/vnd.oasis.opendocument.formula-template + application/vnd.oasis.opendocument.graphics-template + + application/vnd.oasis.opendocument.text-web + application/vnd.oasis.opendocument.image-template + application/vnd.oasis.opendocument.text-master + application/vnd.oasis.opendocument.spreadsheet-template + application/vnd.oasis.opendocument.text-template + application/vnd.openofficeorg.extension + application/pkcs10 + application/x-pkcs7-certreqresp + application/pkcs7-signature + + application/vnd.powerbuilder6 + image/x-portable-bitmap + application/vnd.hp-pcl + application/vnd.hp-pclxl + image/x-pict + image/x-pcx + chemical/x-pdb + application/pdf + application/font-tdpfr + + image/x-portable-graymap + application/x-chess-pgn + application/pgp-encrypted + image/x-pict + application/pkixcmp + application/pkix-pkipath + application/vnd.3gpp.pic-bw-large + application/vnd.mobius.plc + application/vnd.pocketlearn + + application/pls+xml + application/vnd.ctc-posml + image/png + image/x-portable-anymap + application/vnd.macports.portpkg + application/vnd.ms-powerpoint + application/vnd.cups-ppd + image/x-portable-pixmap + application/vnd.ms-powerpoint + + application/vnd.ms-powerpoint + application/vnd.palm + application/vnd.palm + application/vnd.lotus-freelance + application/pics-rules + application/postscript + application/vnd.3gpp.pic-bw-small + image/vnd.adobe.photoshop + application/vnd.pvi.ptid1 + + application/x-mspublisher + application/vnd.3gpp.pic-bw-var + application/vnd.3m.post-it-notes + application/vnd.epson.quickanime + application/vnd.intu.qbo + application/vnd.intu.qfx + application/vnd.publishare-delta-tree + video/quicktime + audio/x-pn-realaudio + + audio/x-pn-realaudio + application/x-rar-compressed + image/x-cmu-raster + application/vnd.ipunplugged.rcprofile + application/rdf+xml + application/vnd.data-vision.rdz + application/vnd.businessobjects + image/x-rgb + application/reginfo+xml + + application/resource-lists+xml + image/vnd.fujixerox.edmics-rlc + application/vnd.rn-realmedia + audio/midi + audio/x-pn-realaudio-plugin + application/vnd.jcp.javame.midlet-rms + application/relax-ng-compact-syntax + application/vnd.nokia.radio-presets + application/vnd.nokia.radio-preset + + application/sparql-query + application/rls-services+xml + application/rsd+xml + application/rss+xml + application/rtf + text/richtext + application/vnd.yamaha.smaf-audio + application/sbml+xml + application/vnd.ibm.secure-container + + application/x-msschedule + application/vnd.lotus-screencam + application/scvp-cv-request + application/scvp-cv-response + application/sdp + application/vnd.seemail + application/vnd.sema + application/vnd.semd + application/vnd.semf + + application/set-payment-initiation + application/set-registration-initiation + application/vnd.spotfire.sfs + text/sgml + text/sgml + application/x-sh + application/x-shar + application/shf+xml + model/mesh + + application/x-stuffit + application/x-stuffitx + application/vnd.epson.salt + audio/basic + application/vnd.yamaha.smaf-phrase + application/x-futuresplash + text/vnd.in3d.spot + application/scvp-vp-response + application/scvp-vp-request + + application/x-wais-source + application/sparql-results+xml + application/vnd.epson.ssf + application/ssml+xml + application/vnd.wt.stf + application/hyperstudio + application/vnd.pg.format + application/vnd.sus-calendar + application/vnd.sus-calendar + + application/x-sv4cpio + application/x-sv4crc + application/vnd.svd + application/x-shockwave-flash + application/vnd.tao.intent-module-archive + application/x-tar + application/vnd.3gpp2.tcap + application/x-tcl + application/x-tex + + text/plain + image/tiff + image/tiff + application/vnd.tmobile-livetv + application/x-bittorrent + application/vnd.groove-tool-template + application/vnd.trid.tpt + application/vnd.trueapp + application/x-msterminal + + text/tab-separated-values + application/vnd.genomatix.tuxedo + application/vnd.mobius.txf + text/plain + application/vnd.umajin + application/vnd.unity + application/vnd.uoml+xml + text/uri-list + text/uri-list + + text/uri-list + application/x-ustar + application/vnd.uiq.theme + text/x-uuencode + application/x-cdlink + text/x-vcard + application/vnd.groove-vcard + text/x-vcalendar + application/vnd.vcx + + application/vnd.visionary + video/vnd.vivo + model/vrml + application/vnd.visio + application/vnd.vsf + application/vnd.visio + application/vnd.visio + application/vnd.visio + model/vnd.vtu + + application/voicexml+xml + audio/x-wav + audio/x-ms-wax + image/vnd.wap.wbmp + application/vnd.criticaltools.wbs+xml + application/vnd.wap.wbxml + application/vnd.ms-works + application/vnd.ms-works + application/vnd.ms-works + + video/x-ms-wm + audio/x-ms-wma + application/x-ms-wmd + application/x-msmetafile + text/vnd.wap.wml + application/vnd.wap.wmlc + text/vnd.wap.wmlscript + application/vnd.wap.wmlscriptc + video/x-ms-wmv + + video/x-ms-wmx + application/x-ms-wmz + application/vnd.wordperfect + application/vnd.ms-wpl + application/vnd.ms-works + application/vnd.wqd + application/x-mswrite + model/vrml + application/wsdl+xml + + application/wspolicy+xml + application/vnd.webturbo + video/x-ms-wvx + application/vnd.hzn-3d-crossword + application/vnd.xara + application/vnd.fujixerox.docuworks.binder + image/x-xbitmap + application/vnd.syncml.dm+xml + application/vnd.adobe.xdp+xml + + application/vnd.fujixerox.docuworks + application/xenc+xml + application/vnd.adobe.xfdf + application/vnd.xfdl + application/xhtml+xml + application/xhtml+xml + application/xv+xml + image/vnd.xiff + application/vnd.ms-excel + + application/vnd.ms-excel + application/vnd.ms-excel + application/vnd.ms-excel + application/vnd.ms-excel + application/vnd.ms-excel + application/xml + application/vnd.olpc-sugar + application/xop+xml + image/x-xpixmap + + application/vnd.is-xpr + application/vnd.ms-xpsdocument + application/xml + application/xslt+xml + application/vnd.syncml+xml + application/xspf+xml + application/vnd.mozilla.xul+xml + application/xv+xml + application/xv+xml + + image/x-xwindowdump + chemical/x-xyz + application/vnd.zzazz.deck+xml + application/zip + application/vnd.handheld-entertainment+xml + + +
+ + + + + + Mage_Downloadable.csv + + + + + + + + + + + + + + Downloadable product Section + + + + + + + + + + + + + downloadable.xml + + + + + + + + singleton + downloadable/observer + prepareProductSave + + + + + + + singleton + downloadable/observer + setLinkStatus + + + + + + + + + standard + + Mage_Downloadable + downloadable + + + + + downloadable/customer/ + + + + + + Mage_Downloadable.csv + + + + + + + + downloadable.xml + + + + + + + + singleton + downloadable/observer + saveDownloadableOrderItem + + + + + + + singleton + downloadable/observer + setLinkStatus + + + + + + + singleton + downloadable/observer + setHasDownloadableProducts + + + + + + + singleton + downloadable/observer + setHasDownloadableProducts + + + + + + + singleton + downloadable/observer + isAllowedGuestCheckout + + + + + + + + + admin + + Mage_Downloadable + downloadable + + + + + + + + 0 + complete + Samples + Links + 1 + inline + 1 + + + +
diff --git a/app/code/core/Mage/Downloadable/etc/system.xml b/app/code/core/Mage/Downloadable/etc/system.xml new file mode 100644 index 0000000000..eefce08478 --- /dev/null +++ b/app/code/core/Mage/Downloadable/etc/system.xml @@ -0,0 +1,115 @@ + + + + + + + + + text + 600 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_order_status + 100 + 1 + 1 + 0 + + + + text + 200 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 300 + 1 + 1 + 0 + + + + text + 400 + 1 + 1 + 1 + + + + text + 500 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 600 + 1 + 1 + 0 + + + + select + downloadable/system_config_source_contentdisposition + 700 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 800 + 1 + 1 + 0 + Guest checkout will only work with shareable + + + + + + + diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-0.1.0.php new file mode 100644 index 0000000000..f925f7ee52 --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-0.1.0.php @@ -0,0 +1,53 @@ +startSetup(); + +$fieldList = array( + 'price', + 'special_price', + 'special_from_date', + 'special_to_date', + 'minimal_price', + 'cost', + 'tier_price', + 'weight', + 'tax_class_id' +); + +// make these attributes applicable to downloadable products +foreach ($fieldList as $field) { + $applyTo = split(',', $installer->getAttribute('catalog_product', $field, 'apply_to')); + if (!in_array('downloadable', $applyTo)) { + $applyTo[] = 'downloadable'; + $installer->updateAttribute('catalog_product', $field, 'apply_to', join(',', $applyTo)); + } +} + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.0-0.1.1.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.0-0.1.1.php new file mode 100644 index 0000000000..d89ea5fd76 --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.0-0.1.1.php @@ -0,0 +1,54 @@ +startSetup(); +// make attribute 'weight' not applicable to downloadable products +$applyTo = split(',', $installer->getAttribute('catalog_product', 'weight', 'apply_to')); +if (in_array('downloadable', $applyTo)) { + $newApplyTo = array(); + foreach ($applyTo as $key=>$value) { + if ($value != 'downloadable') { + $newApplyTo[] = $value; + } + } + $installer->updateAttribute('catalog_product', 'weight', 'apply_to', join(',', $newApplyTo)); +} else { + $installer->updateAttribute('catalog_product', 'weight', 'apply_to', join(',', $applyTo)); +} + +// remove 'weight' values for downloadable products if there were any created +$attributeId = $installer->getAttributeId('catalog_product', 'weight'); +$installer->run(" + DELETE FROM {$installer->getTable('catalog_product_entity_decimal')} + WHERE (entity_id in ( + SELECT entity_id FROM {$installer->getTable('catalog/product')} WHERE type_id = 'downloadable' + )) and attribute_id = {$attributeId} +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.1-0.1.2.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.1-0.1.2.php new file mode 100644 index 0000000000..2c8d71a136 --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.1-0.1.2.php @@ -0,0 +1,126 @@ +getConnection(); +/* @var $conn Varien_Db_Adapter_Pdo_Mysql */ + +$installer->startSetup(); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/sample')}` ( + `sample_id` int(10) unsigned NOT NULL auto_increment, + `product_id` int(10) unsigned NOT NULL default '0', + `sample_file` varchar(255) NOT NULL default '', + `sort_order` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`sample_id`), + KEY `DOWNLODABLE_SAMPLE_PRODUCT` (`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLODABLE_SAMPLE_PRODUCT', $installer->getTable('downloadable/sample'), 'product_id', $installer->getTable('catalog/product'), 'entity_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/sample_title')}` ( + `title_id` int(10) unsigned NOT NULL auto_increment, + `sample_id` int(10) unsigned NOT NULL default '0', + `store_id` smallint(5) unsigned NOT NULL default '0', + `title` varchar(255) NOT NULL default '', + PRIMARY KEY (`title_id`), + KEY `DOWNLOADABLE_SAMPLE_TITLE_SAMPLE` (`sample_id`), + KEY `DOWNLOADABLE_SAMPLE_TITLE_STORE` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_SAMPLE_TITLE_SAMPLE', $installer->getTable('downloadable/sample_title'), 'sample_id', $installer->getTable('downloadable/sample'), 'sample_id' +); +$conn->addConstraint( + 'FK_DOWNLOADABLE_SAMPLE_TITLE_STORE', $installer->getTable('downloadable/sample_title'), 'store_id', $installer->getTable('core/store'), 'store_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link')}` ( + `link_id` int(10) unsigned NOT NULL auto_increment, + `product_id` int(10) unsigned NOT NULL default '0', + `sort_order` int(10) unsigned NOT NULL default '0', + `number_of_downloads` int(10) unsigned, + `is_shareable` smallint(1) unsigned NOT NULL default '0', + `link_file` varchar(255) NOT NULL default '', + `sample_file` varchar(255) NOT NULL default '', + PRIMARY KEY (`link_id`), + KEY `DOWNLODABLE_LINK_PRODUCT` (`product_id`), + KEY `DOWNLODABLE_LINK_PRODUCT_SORT_ORDER` (`product_id` , `sort_order`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLODABLE_LINK_PRODUCT', $installer->getTable('downloadable/link'), 'product_id', $installer->getTable('catalog/product'), 'entity_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link_title')}` ( + `title_id` int(10) unsigned NOT NULL auto_increment, + `link_id` int(10) unsigned NOT NULL default '0', + `store_id` smallint(5) unsigned NOT NULL default '0', + `title` varchar(255) NOT NULL default '', + PRIMARY KEY (`title_id`), + KEY `DOWNLOADABLE_LINK_TITLE_LINK` (`link_id`), + KEY `DOWNLOADABLE_LINK_TITLE_STORE` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_TITLE_LINK', $installer->getTable('downloadable/link_title'), 'link_id', $installer->getTable('downloadable/link'), 'link_id' +); +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_TITLE_STORE', $installer->getTable('downloadable/link_title'), 'store_id', $installer->getTable('core/store'), 'store_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link_price')}` ( + `price_id` int(10) unsigned NOT NULL auto_increment, + `link_id` int(10) unsigned NOT NULL default '0', + `website_id` smallint(5) unsigned NOT NULL default '0', + `price` decimal(12,4) NOT NULL default '0.0000', + PRIMARY KEY (`price_id`), + KEY `DOWNLOADABLE_LINK_PRICE_LINK` (`link_id`), + KEY `DOWNLOADABLE_LINK_PRICE_WEBSITE` (`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_PRICE_LINK', $installer->getTable('downloadable/link_price'), 'link_id', $installer->getTable('downloadable/link'), 'link_id' +); +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_PRICE_WEBSITE', $installer->getTable('downloadable/link_price'), 'website_id', $installer->getTable('core/website'), 'website_id' +); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.10-0.1.11.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.10-0.1.11.php new file mode 100644 index 0000000000..39a4ed774a --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.10-0.1.11.php @@ -0,0 +1,90 @@ +startSetup(); + +$installer->getConnection()->addColumn($installer->getTable('downloadable/sample'), 'sample_type', "varchar(20) NOT NULL default '' AFTER `sample_file`"); +$installer->getConnection()->addColumn($installer->getTable('downloadable/link'), 'link_type', "varchar(20) NOT NULL default '' AFTER `link_file`"); +$installer->getConnection()->addColumn($installer->getTable('downloadable/link'), 'sample_type', "varchar(20) NOT NULL default '' AFTER `sample_file`"); + +$conn->dropForeignKey($installer->getTable('downloadable/link_purchased'), 'FK_DOWNLOADABLE_ORDER_ITEM_ID'); +$conn->dropKey($installer->getTable('downloadable/link_purchased'), 'DOWNLOADABLE_ORDER_ITEM_ID'); + + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link_purchased_item')}`( + `item_id` int(10) unsigned NOT NULL auto_increment, + `purchased_id` int(10) unsigned NOT NULL default '0', + `order_item_id` int(10) unsigned NOT NULL default '0', + `number_of_downloads_bought` int(10) unsigned NOT NULL default '0', + `number_of_downloads_used` int(10) unsigned NOT NULL default '0', + `link_id` int(20) unsigned NOT NULL default '0', + `link_title` varchar(255) NOT NULL default '', + `is_shareable` smallint(1) unsigned NOT NULL default '0', + `link_url` varchar(255) NOT NULL default '', + `link_file` varchar(255) NOT NULL default '', + `link_type` varchar(255) NOT NULL default '', + `status` varchar(50) NOT NULL default '', + `created_at` datetime NOT NULL default '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`item_id`), + KEY `DOWNLOADABLE_LINK_PURCHASED_ID` (`purchased_id`), + KEY `DOWNLOADABLE_ORDER_ITEM_ID` (`order_item_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_PURCHASED_ID', $installer->getTable('downloadable/link_purchased_item'), 'purchased_id', $installer->getTable('downloadable/link_purchased'), 'purchased_id' +); +$conn->addConstraint( + 'FK_DOWNLOADABLE_ORDER_ITEM_ID', $installer->getTable('downloadable/link_purchased_item'), 'order_item_id', $installer->getTable('sales/order_item'), 'item_id' +); + +$installer->run(" + INSERT INTO `{$installer->getTable('downloadable/link_purchased_item')}` + (`purchased_id`, `order_item_id`, `number_of_downloads_bought`, `number_of_downloads_used`, `link_id`, `link_title`, `is_shareable`, `link_url`, `link_file`, `status`, `created_at`, `updated_at`) + SELECT + `purchased_id`, `order_item_id`, `number_of_downloads_bought`, `number_of_downloads_used`, `link_id`, `link_title`, `is_shareable`, `link_url`, `link_file`, `status`, `created_at`, `updated_at` + FROM `{$installer->getTable('downloadable/link_purchased')}` + +"); + +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'order_item_id'); +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'number_of_downloads_bought'); +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'number_of_downloads_used'); +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'link_id'); +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'link_title'); +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'is_shareable'); +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'link_url'); +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'link_file'); +$conn->dropColumn($installer->getTable('downloadable/link_purchased'), 'status'); + +$installer->getConnection()->addColumn($installer->getTable('downloadable/link_purchased'), 'link_section_title', "varchar(255) NOT NULL default '' AFTER `product_sku`"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.11-0.1.12.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.11-0.1.12.php new file mode 100644 index 0000000000..cca2a9dfac --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.11-0.1.12.php @@ -0,0 +1,34 @@ +startSetup(); + +$installer->getConnection()->addColumn($installer->getTable('downloadable/link_purchased_item'), 'product_id', "int(10) unsigned default '0' AFTER `order_item_id`"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.2-0.1.3.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.2-0.1.3.php new file mode 100644 index 0000000000..eb22389552 --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.2-0.1.3.php @@ -0,0 +1,54 @@ +startSetup(); + +$installer->addAttribute('catalog_product', 'links_purchased_separately', array( + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Links can be purchased separately', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'is_configurable' => false + )); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.3-0.1.4.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.3-0.1.4.php new file mode 100644 index 0000000000..a936d08a29 --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.3-0.1.4.php @@ -0,0 +1,34 @@ +startSetup(); + +$installer->getConnection()->addColumn($installer->getTable('downloadable/sample'), 'sample_url', "varchar(255) NOT NULL default '' AFTER `product_id`"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.4-0.1.5.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.4-0.1.5.php new file mode 100644 index 0000000000..54734960f3 --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.4-0.1.5.php @@ -0,0 +1,34 @@ +startSetup(); + +$installer->getConnection()->addColumn($installer->getTable('downloadable/link'), 'link_url', "varchar(255) NOT NULL default '' AFTER `is_shareable`"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.5-0.1.6.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.5-0.1.6.php new file mode 100644 index 0000000000..156223eba5 --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.5-0.1.6.php @@ -0,0 +1,59 @@ +startSetup(); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link_purchased')}` ( + `purchased_id` int(10) unsigned NOT NULL auto_increment, + `order_item_id` int(10) unsigned NOT NULL default '0', + `order_id` int(10) unsigned NOT NULL default '0', + `number_of_downloads_bought` int(10) unsigned NOT NULL default '0', + `number_of_downloads_used` int(10) unsigned NOT NULL default '0', + `link_id` int(20) unsigned NOT NULL default '0', + `link_title` varchar(255) NOT NULL default '', + `link_url` varchar(255) NOT NULL default '', + `link_file` varchar(255) NOT NULL default '', + `status` varchar(50) NOT NULL default '', + `product_name` varchar(255) NOT NULL default '', + `product_sku` varchar(255) NOT NULL default '', + PRIMARY KEY (`purchased_id`), + KEY `DOWNLOADABLE_ORDER_ITEM_ID` (`order_item_id`), + KEY `DOWNLOADABLE_ORDER_ID` (`order_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_ORDER_ITEM_ID', $installer->getTable('downloadable/link_purchased'), 'order_item_id', $installer->getTable('sales/order_item'), 'item_id' +); +$conn->addConstraint( + 'FK_DOWNLOADABLE_ORDER_ID', $installer->getTable('downloadable/link_purchased'), 'order_id', $installer->getTable('sales/order'), 'entity_id' +); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.6-0.1.7.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.6-0.1.7.php new file mode 100644 index 0000000000..6d8da15dee --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.6-0.1.7.php @@ -0,0 +1,167 @@ +startSetup(); + +$installer->run(" + DROP TABLE IF EXISTS `{$installer->getTable('downloadable/link')}`; + DROP TABLE IF EXISTS `{$installer->getTable('downloadable/link_price')}`; + DROP TABLE IF EXISTS `{$installer->getTable('downloadable/link_purchased')}`; + DROP TABLE IF EXISTS `{$installer->getTable('downloadable/link_title')}`; + DROP TABLE IF EXISTS `{$installer->getTable('downloadable/sample')}`; + DROP TABLE IF EXISTS `{$installer->getTable('downloadable/sample_title')}`; +"); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link')}`( + `link_id` int(10) unsigned NOT NULL auto_increment, + `product_id` int(10) unsigned NOT NULL default '0', + `sort_order` int(10) unsigned NOT NULL default '0', + `number_of_downloads` int(10) unsigned default NULL, + `is_shareable` smallint(1) unsigned NOT NULL default '0', + `link_url` varchar(255) NOT NULL default '', + `link_file` varchar(255) NOT NULL default '', + `sample_file` varchar(255) NOT NULL default '', + PRIMARY KEY (`link_id`), + KEY `DOWNLODABLE_LINK_PRODUCT` (`product_id`), + KEY `DOWNLODABLE_LINK_PRODUCT_SORT_ORDER` (`product_id`,`sort_order`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLODABLE_LINK_PRODUCT', $installer->getTable('downloadable/link'), 'product_id', $installer->getTable('catalog/product'), 'entity_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link_price')}`( + `price_id` int(10) unsigned NOT NULL auto_increment, + `link_id` int(10) unsigned NOT NULL default '0', + `website_id` smallint(5) unsigned NOT NULL default '0', + `price` decimal(12,4) NOT NULL default '0.0000', + PRIMARY KEY (`price_id`), + KEY `DOWNLOADABLE_LINK_PRICE_LINK` (`link_id`), + KEY `DOWNLOADABLE_LINK_PRICE_WEBSITE` (`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_PRICE_LINK', $installer->getTable('downloadable/link_price'), 'link_id', $installer->getTable('downloadable/link'), 'link_id' +); +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_PRICE_WEBSITE', $installer->getTable('downloadable/link_price'), 'website_id', $installer->getTable('core/website'), 'website_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link_purchased')}`( + `purchased_id` int(10) unsigned NOT NULL auto_increment, + `order_item_id` int(10) unsigned NOT NULL default '0', + `order_id` int(10) unsigned NOT NULL default '0', + `order_increment_id` varchar(50) NOT NULL default '', + `created_at` datetime NOT NULL default '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL default '0000-00-00 00:00:00', + `customer_id` int(10) unsigned NOT NULL default '0', + `number_of_downloads_bought` int(10) unsigned NOT NULL default '0', + `number_of_downloads_used` int(10) unsigned NOT NULL default '0', + `link_id` int(20) unsigned NOT NULL default '0', + `link_title` varchar(255) NOT NULL default '', + `link_url` varchar(255) NOT NULL default '', + `link_file` varchar(255) NOT NULL default '', + `status` varchar(50) NOT NULL default '', + `product_name` varchar(255) NOT NULL default '', + `product_sku` varchar(255) NOT NULL default '', + PRIMARY KEY (`purchased_id`), + KEY `DOWNLOADABLE_ORDER_ITEM_ID` (`order_item_id`), + KEY `DOWNLOADABLE_ORDER_ID` (`order_id`), + KEY `DOWNLOADABLE_CUSTOMER_ID` (`customer_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_ORDER_ID', $installer->getTable('downloadable/link_purchased'), 'order_id', $installer->getTable('sales/order'), 'entity_id' +); +$conn->addConstraint( + 'FK_DOWNLOADABLE_ORDER_ITEM_ID', $installer->getTable('downloadable/link_purchased'), 'order_item_id', $installer->getTable('sales/order_item'), 'item_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/link_title')}`( + `title_id` int(10) unsigned NOT NULL auto_increment, + `link_id` int(10) unsigned NOT NULL default '0', + `store_id` smallint(5) unsigned NOT NULL default '0', + `title` varchar(255) NOT NULL default '', + PRIMARY KEY (`title_id`), + KEY `DOWNLOADABLE_LINK_TITLE_LINK` (`link_id`), + KEY `DOWNLOADABLE_LINK_TITLE_STORE` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_TITLE_LINK', $installer->getTable('downloadable/link_title'), 'link_id', $installer->getTable('downloadable/link'), 'link_id' +); +$conn->addConstraint( + 'FK_DOWNLOADABLE_LINK_TITLE_STORE', $installer->getTable('downloadable/link_title'), 'store_id', $installer->getTable('core/store'), 'store_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/sample')}`( + `sample_id` int(10) unsigned NOT NULL auto_increment, + `product_id` int(10) unsigned NOT NULL default '0', + `sample_url` varchar(255) NOT NULL default '', + `sample_file` varchar(255) NOT NULL default '', + `sort_order` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`sample_id`), + KEY `DOWNLODABLE_SAMPLE_PRODUCT` (`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLODABLE_SAMPLE_PRODUCT', $installer->getTable('downloadable/sample'), 'product_id', $installer->getTable('catalog/product'), 'entity_id' +); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable/sample_title')}`( + `title_id` int(10) unsigned NOT NULL auto_increment, + `sample_id` int(10) unsigned NOT NULL default '0', + `store_id` smallint(5) unsigned NOT NULL default '0', + `title` varchar(255) NOT NULL default '', + PRIMARY KEY (`title_id`), + KEY `DOWNLOADABLE_SAMPLE_TITLE_SAMPLE` (`sample_id`), + KEY `DOWNLOADABLE_SAMPLE_TITLE_STORE` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_SAMPLE_TITLE_SAMPLE', $installer->getTable('downloadable/sample_title'), 'sample_id', $installer->getTable('downloadable/sample'), 'sample_id' +); + +$conn->addConstraint( + 'FK_DOWNLOADABLE_SAMPLE_TITLE_STORE', $installer->getTable('downloadable/sample_title'), 'store_id', $installer->getTable('core/store'), 'store_id' +); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.7-0.1.8.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.7-0.1.8.php new file mode 100644 index 0000000000..3354f1d87e --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.7-0.1.8.php @@ -0,0 +1,34 @@ +startSetup(); + +$installer->getConnection()->addColumn($installer->getTable('downloadable/link_purchased'), 'is_shareable', "smallint(1) unsigned NOT NULL default '0' AFTER `link_title`"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.8-0.1.9.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.8-0.1.9.php new file mode 100644 index 0000000000..64b33be879 --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.8-0.1.9.php @@ -0,0 +1,34 @@ +startSetup(); + +$installer->getConnection()->addColumn($installer->getTable('downloadable/link'), 'sample_url', "varchar(255) NOT NULL default '' AFTER `link_file`"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.9-0.1.10.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.9-0.1.10.php new file mode 100644 index 0000000000..560dc747ff --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.9-0.1.10.php @@ -0,0 +1,76 @@ +startSetup(); + +$installer->addAttribute('catalog_product', 'samples_title', array( + 'type' => 'varchar', + 'backend' => '', + 'frontend' => '', + 'label' => 'Samples title', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'is_configurable' => false + )); + +$installer->addAttribute('catalog_product', 'links_title', array( + 'type' => 'varchar', + 'backend' => '', + 'frontend' => '', + 'label' => 'Links title', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'is_configurable' => false + )); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute.php b/app/code/core/Mage/Eav/Model/Entity/Attribute.php index 23b9a321dc..276c44c963 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute.php @@ -25,8 +25,31 @@ */ +/** + * EAV Entity attribute model + * + * @category Mage + * @package Mage_Eav + * @author Magento Core Team + */ class Mage_Eav_Model_Entity_Attribute extends Mage_Eav_Model_Entity_Attribute_Abstract { + /** + * Prefix of model events names + * + * @var string + */ + protected $_eventPrefix = 'eav_entity_attribute'; + + /** + * Parameter name in event + * + * In observe method you can use $observer->getEvent()->getAttribute() in this case + * + * @var string + */ + protected $_eventObject = 'attribute'; + const CACHE_TAG = 'EAV_ATTRIBUTE'; protected $_cacheTag = 'EAV_ATTRIBUTE'; @@ -164,9 +187,14 @@ public function getBackendTypeByInput($type) case 'price': return 'decimal'; - +/* default: + Mage::dispatchEvent('eav_attribute_get_backend_type_by_input', array('model'=>$this, 'type'=>$type)); + if ($this->hasBackendTypeByInput()) { + return $this->getData('backend_type_by_input'); + } Mage::throwException('Unknown frontend input type'); +*/ } } @@ -178,6 +206,7 @@ public function getBackendTypeByInput($type) */ public function getDefaultValueByInput($type) { + $field = ''; switch ($type) { case 'select': case 'gallery': @@ -202,12 +231,20 @@ public function getDefaultValueByInput($type) case 'boolean': $field = 'default_value_yesno'; break; - +/* default: + Mage::dispatchEvent('eav_attribute_get_default_value_by_input', array('model'=>$this, 'type'=>$type)); + if ($this->hasBackendTypeByInput()) { + return $this->getData('backend_type_by_input'); + } Mage::throwException('Unknown frontend input type'); +*/ } return $field; } - + public function getAttributeCodesByFrontendType($type) + { + return $this->getResource()->getAttributeCodesByFrontendType($type); + } } diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php index bbe196621e..0c15b8cbc1 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php @@ -36,6 +36,8 @@ abstract class Mage_Eav_Model_Entity_Attribute_Abstract extends Mage_Core_Model_Abstract implements Mage_Eav_Model_Entity_Attribute_Interface { + const TYPE_STATIC = 'static'; + /** * Attribute name * @@ -437,4 +439,14 @@ public function getIdByCode($entityType, $code) } return $this->_attributeIdCache[$k]; } + + /** + * Check if attribute is static + * + * @return bool + */ + public function isStatic() + { + return $this->getBackendType() == self::TYPE_STATIC; + } } diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php index ea666652eb..7266939801 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php @@ -122,8 +122,14 @@ public function organizeData($data) } $this->setRemoveGroups($modelGroupArray); } - $this->setAttributeSetName($data['attribute_set_name']) ->setEntityTypeId($this->getEntityTypeId()); } + + public function validate($name) + { + if (!$this->_getResource()->validate($this, $name)) { + throw new Exception(Mage::helper('eav')->__('Attribute set with the "%s" name already exists',$name)); + } + } } \ No newline at end of file diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php index a5611a63aa..9cd5db8fc6 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php @@ -27,20 +27,39 @@ class Mage_Eav_Model_Entity_Attribute_Source_Table extends Mage_Eav_Model_Entity_Attribute_Source_Abstract { + /** + * Default values for option cache + * + * @var array + */ protected $_optionsDefault = array(); + /** + * Retrieve Full Option values array + * + * @param bool $withEmpty Add empty option to array + * @param bool $defaultValues + * @return array + */ public function getAllOptions($withEmpty = true, $defaultValues = false) { - if (is_null($this->_options)) { + $storeId = $this->getAttribute()->getStoreId(); + if (!is_array($this->_options)) { + $this->_options = array(); + } + if (!is_array($this->_optionsDefault)) { + $this->_optionsDefault = array(); + } + if (!isset($this->_options[$storeId])) { $collection = Mage::getResourceModel('eav/entity_attribute_option_collection') ->setPositionOrder('asc') ->setAttributeFilter($this->getAttribute()->getId()) ->setStoreFilter($this->getAttribute()->getStoreId()) ->load(); - $this->_options = $collection->toOptionArray(); - $this->_optionsDefault = $collection->toOptionArray('default_value'); + $this->_options[$storeId] = $collection->toOptionArray(); + $this->_optionsDefault[$storeId] = $collection->toOptionArray('default_value'); } - $options = ($defaultValues ? $this->_optionsDefault : $this->_options); + $options = ($defaultValues ? $this->_optionsDefault[$storeId] : $this->_options[$storeId]); if ($withEmpty) { array_unshift($options, array('label'=>'', 'value'=>'')); } diff --git a/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php index dab7b0cc26..4a01e6b781 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php @@ -950,6 +950,9 @@ protected function _getAttributeTableAlias($attributeCode) protected function _getAttributeFieldName($attributeCode) { + if (isset($this->_joinAttributes[$attributeCode]['condition_alias'])) { + return $this->_joinAttributes[$attributeCode]['condition_alias']; + } if (isset($this->_joinFields[$attributeCode])) { $attr = $this->_joinFields[$attributeCode]; return $attr['table'] ? $attr['table'] .'.'.$attr['field'] : $attr['field']; diff --git a/app/code/core/Mage/Eav/Model/Entity/Setup.php b/app/code/core/Mage/Eav/Model/Entity/Setup.php index bdc7bc8351..b6dc4c676e 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Setup.php +++ b/app/code/core/Mage/Eav/Model/Entity/Setup.php @@ -471,6 +471,45 @@ public function getAttributeId($entityTypeId, $id) return $id; } + /** + * Return table name for eav attribute + * + * @param int|string $entityTypeId Entity Type id or Entity Type code + * @param int|string $id Attribute id or Attribute code + * @return string + */ + 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() + ->from( + array('e' => $this->getTable('eav/entity_type')), + array('e.entity_table') + ) + ->from( + array('a' => $this->getTable('eav/attribute')), + array('a.backend_type') + ) + ->where('a.entity_type_id=e.entity_type_id') + ->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; + } + return $table; + } + return false; + } + public function removeAttribute($entityTypeId, $code) { if ($attributeId = $this->getAttributeId($entityTypeId, $code)) { @@ -655,4 +694,18 @@ public function createEntityTables($baseName, array $options=array()) return $this; } -} + /** + * Get identifiers of all attribute sets + * + * @return array + */ + public function getAllAttributeSetIds($entityTypeId=null) + { + $where = ''; + if (!is_null($entityTypeId)) { + $where = " WHERE `entity_type_id` = '" . $this->getEntityTypeId($entityTypeId) . "'"; + } + $sql = "SELECT `attribute_set_id` FROM `{$this->getTable('eav/attribute_set')}`" . $where; + return $this->_conn->fetchCol($sql); + } +} \ No newline at end of file diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute.php index eb1090084a..3c86ced919 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute.php @@ -1,361 +1,378 @@ -_init('eav/attribute', 'attribute_id'); - $this->_uniqueFields = array( - array('field' => array('attribute_code','entity_type_id'), - 'title' => Mage::helper('eav')->__('Attribute with the same code') - )); - } - - protected function _loadTypeAttributes($entityTypeId) - { - if (!isset(self::$_entityAttributes[$entityTypeId])) { - $select = $this->_getReadAdapter()->select()->from($this->getMainTable()) - ->where('entity_type_id=?', $entityTypeId); - $data = $this->_getReadAdapter()->fetchAll($select); - foreach ($data as $row) { - self::$_entityAttributes[$entityTypeId][$row['attribute_code']] = $row; - } - } - return $this; - } - - /** - * Enter description here... - * - * @param Mage_Core_Model_Abstract $object - * @param int $entityTypeId - * @param string $code - * @return boolean - */ - public function loadByCode(Mage_Core_Model_Abstract $object, $entityTypeId, $code) - { - $select = $this->_getLoadSelect('attribute_code', $code, $object) - ->where('entity_type_id=?', $entityTypeId); - $data = $this->_getReadAdapter()->fetchRow($select); - - if ($data) { - $object->setData($data); - $this->_afterLoad($object); - return true; - } - return false; - } - - /** - * Enter description here... - * - * @param Mage_Core_Model_Abstract $object - * @return int - */ - private function _getMaxSortOrder(Mage_Core_Model_Abstract $object) - { - if( intval($object->getAttributeGroupId()) > 0 ) { - $read = $this->_getReadAdapter(); - $select = $read->select() - ->from($this->getTable('entity_attribute'), new Zend_Db_Expr("MAX(`sort_order`)")) - ->where("{$this->getTable('entity_attribute')}.attribute_set_id = ?", $object->getAttributeSetId()) - ->where("{$this->getTable('entity_attribute')}.attribute_group_id = ?", $object->getAttributeGroupId()); - $maxOrder = $read->fetchOne($select); - return $maxOrder; - } - - return 0; - } - - /** - * Enter description here... - * - * @param Mage_Core_Model_Abstract $object - * @return Mage_Eav_Model_Mysql4_Entity_Attribute - */ - public function deleteEntity(Mage_Core_Model_Abstract $object) - { - $write = $this->_getWriteAdapter(); - $condition = $write->quoteInto($this->getTable('entity_attribute').'.entity_attribute_id = ?', $object->getEntityAttributeId()); - /** - * Delete attribute values - */ - $select = $write->select() - ->from($this->getTable('entity_attribute')) - ->where($condition); - $data = $write->fetchRow($select); - if (!empty($data)) { - /** - * @todo !!!! need fix retrieving attribute entity, this realization is temprary - */ - $attribute = Mage::getModel('eav/entity_attribute') - ->load($data['attribute_id']) - ->setEntity(Mage::getSingleton('catalog/product')->getResource()); - - if ($this->isUsedBySuperProducts($attribute, $data['attribute_set_id'])) { - Mage::throwException(Mage::helper('eav')->__("Attribute '%s' used in configurable products.", $attribute->getAttributeCode())); - } - - if ($backendTable = $attribute->getBackend()->getTable()) { - $clearCondition = array( - $write->quoteInto('entity_type_id=?',$attribute->getEntityTypeId()), - $write->quoteInto('attribute_id=?',$attribute->getId()), - $write->quoteInto('entity_id IN ( - SELECT entity_id FROM '.$attribute->getEntity()->getEntityTable().' WHERE attribute_set_id=?)', - $data['attribute_set_id']) - ); - $write->delete($backendTable, $clearCondition); - } - } - - $write->delete($this->getTable('entity_attribute'), $condition); - return $this; - } - - /** - * Enter description here... - * - * @param Mage_Core_Model_Abstract $object - * @return Mage_Eav_Model_Mysql4_Entity_Attribute - */ - protected function _beforeSave(Mage_Core_Model_Abstract $object) - { - $frontendLabel = $object->getFrontendLabel(); - if (is_array($frontendLabel)) { - if (!isset($frontendLabel[0]) || is_null($frontendLabel[0]) || $frontendLabel[0]=='') { - Mage::throwException(Mage::helper('eav')->__('Frontend label is not defined')); - } - $object->setFrontendLabel($frontendLabel[0]); - - if ($object->getData('modulePrefix')) { - $str = $object->getData('modulePrefix') . Mage_Core_Model_Translate::SCOPE_SEPARATOR . $frontendLabel[0]; - } - else { - $str = $frontendLabel[0]; - } - Mage::getModel('core/translate_string') - ->setString($str) - ->setTranslate($frontendLabel[0]) - ->setStoreTranslations($frontendLabel) - ->save(); - } - $applyTo = $object->getApplyTo(); - - if (is_array($applyTo)) { - $object->setApplyTo(implode(',', $applyTo)); - } - - /** - * @todo need use default source model of entity type !!! - */ - if (!$object->getId()) { - if ($object->getFrontendInput()=='select') { - $object->setSourceModel('eav/entity_attribute_source_table'); - } - } - - return parent::_beforeSave($object); - } - - /** - * Enter description here... - * - * @param Mage_Core_Model_Abstract $object - * @return Mage_Eav_Model_Mysql4_Entity_Attribute - */ - protected function _afterSave(Mage_Core_Model_Abstract $object) - { - $this->saveInSetIncluding($object) - ->_saveOption($object); - return parent::_afterSave($object); - } - - /** - * Enter description here... - * - * @param Mage_Core_Model_Abstract $object - * @return Mage_Eav_Model_Mysql4_Entity_Attribute - */ - public function saveInSetIncluding(Mage_Core_Model_Abstract $object) - { - $attrId = $object->getId(); - $setId = (int) $object->getAttributeSetId(); - $groupId= (int) $object->getAttributeGroupId(); - - if ($setId && $groupId && $object->getEntityTypeId()) { - $write = $this->_getWriteAdapter(); - $table = $this->getTable('entity_attribute'); - - - $data = array( - 'entity_type_id' => $object->getEntityTypeId(), - 'attribute_set_id' => $setId, - 'attribute_group_id' => $groupId, - 'attribute_id' => $attrId, - 'sort_order' => (($object->getSortOrder()) ? $object->getSortOrder() : $this->_getMaxSortOrder($object) + 1), - ); - - $condition = "$table.attribute_id = '$attrId' - AND $table.attribute_set_id = '$setId'"; - $write->delete($table, $condition); - $write->insert($table, $data); - - } - return $this; - } - - /** - * Enter description here... - * - * @param Mage_Core_Model_Abstract $object - * @return Mage_Eav_Model_Mysql4_Entity_Attribute - */ - protected function _saveOption(Mage_Core_Model_Abstract $object) - { - $option = $object->getOption(); - if (is_array($option)) { - $write = $this->_getWriteAdapter(); - $optionTable = $this->getTable('attribute_option'); - $optionValueTable = $this->getTable('attribute_option_value'); - $stores = Mage::getModel('core/store') - ->getResourceCollection() - ->setLoadDefault(true) - ->load(); - - if (isset($option['value'])) { - $attributeDefaultValue = array(); - if (!is_array($object->getDefault())) { - $object->setDefault(array()); - } - - foreach ($option['value'] as $optionId => $values) { - $intOptionId = (int) $optionId; - if (!empty($option['delete'][$optionId])) { - if ($intOptionId) { - $condition = $write->quoteInto('option_id=?', $intOptionId); - $write->delete($optionTable, $condition); - } - - continue; - } - - if (!$intOptionId) { - $data = array( - 'attribute_id' => $object->getId(), - 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, - ); - $write->insert($optionTable, $data); - $intOptionId = $write->lastInsertId(); - } - else { - $data = array( - 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, - ); - $write->update($optionTable, $data, $write->quoteInto('option_id=?', $intOptionId)); - } - - if (in_array($optionId, $object->getDefault())) { - if ($object->getFrontendInput() == 'multiselect') { - $attributeDefaultValue[] = $intOptionId; - } else if ($object->getFrontendInput() == 'select') { - $attributeDefaultValue = array($intOptionId); - } - } - - - // Default value - if (!isset($values[0])) { - Mage::throwException(Mage::helper('eav')->__('Default option value is not defined')); - } - - $write->delete($optionValueTable, $write->quoteInto('option_id=?', $intOptionId)); - foreach ($stores as $store) { - if (isset($values[$store->getId()]) && (!empty($values[$store->getId()]) || $values[$store->getId()] == "0")) { - $data = array( - 'option_id' => $intOptionId, - 'store_id' => $store->getId(), - 'value' => $values[$store->getId()], - ); - $write->insert($optionValueTable, $data); - } - } - } - - $attribute = Mage::getModel('eav/entity_attribute')->load($object->getId()); - $attribute->setDefaultValue(implode(',', $attributeDefaultValue)); - $attribute->save(); - } - } - return $this; - } - - public function isUsedBySuperProducts(Mage_Core_Model_Abstract $object, $attributeSet=null) - { - $read = $this->_getReadAdapter(); - $attrTable = $this->getTable('catalog/product_super_attribute'); - $productTable = $this->getTable('catalog/product'); - $select = $read->select() - ->from(array('_main_table' => $attrTable), 'COUNT(*)') - ->join(array('_entity'=> $productTable), '_main_table.product_id = _entity.entity_id') - ->where("_main_table.attribute_id = ?", $object->getAttributeId()) - ->group('_main_table.attribute_id') - ->limit(1); - - if (!is_null($attributeSet)) { - $select->where('_entity.attribute_set_id = ?', $attributeSet); - } - $valueCount = $read->fetchOne($select); - return $valueCount; - } - - /** - * Return attribute id - * - * @param string $entityType - * @param string $code - * @return int - */ - public function getIdByCode($entityType, $code) - { - $select = $this->_getReadAdapter()->select() - ->from(array('a'=>$this->getTable('eav/attribute')), array('a.attribute_id')) - ->join(array('t'=>$this->getTable('eav/entity_type')), 'a.entity_type_id = t.entity_type_id', array()) - ->where('t.entity_type_code = ?', $entityType) - ->where('a.attribute_code = ?', $code); - - return $this->_getReadAdapter()->fetchOne($select); - } -} +_init('eav/attribute', 'attribute_id'); + $this->_uniqueFields = array( + array('field' => array('attribute_code','entity_type_id'), + 'title' => Mage::helper('eav')->__('Attribute with the same code') + )); + } + + protected function _loadTypeAttributes($entityTypeId) + { + if (!isset(self::$_entityAttributes[$entityTypeId])) { + $select = $this->_getReadAdapter()->select()->from($this->getMainTable()) + ->where('entity_type_id=?', $entityTypeId); + $data = $this->_getReadAdapter()->fetchAll($select); + foreach ($data as $row) { + self::$_entityAttributes[$entityTypeId][$row['attribute_code']] = $row; + } + } + return $this; + } + + /** + * Enter description here... + * + * @param Mage_Core_Model_Abstract $object + * @param int $entityTypeId + * @param string $code + * @return boolean + */ + public function loadByCode(Mage_Core_Model_Abstract $object, $entityTypeId, $code) + { + $select = $this->_getLoadSelect('attribute_code', $code, $object) + ->where('entity_type_id=?', $entityTypeId); + $data = $this->_getReadAdapter()->fetchRow($select); + + if ($data) { + $object->setData($data); + $this->_afterLoad($object); + return true; + } + return false; + } + + /** + * Enter description here... + * + * @param Mage_Core_Model_Abstract $object + * @return int + */ + private function _getMaxSortOrder(Mage_Core_Model_Abstract $object) + { + if( intval($object->getAttributeGroupId()) > 0 ) { + $read = $this->_getReadAdapter(); + $select = $read->select() + ->from($this->getTable('entity_attribute'), new Zend_Db_Expr("MAX(`sort_order`)")) + ->where("{$this->getTable('entity_attribute')}.attribute_set_id = ?", $object->getAttributeSetId()) + ->where("{$this->getTable('entity_attribute')}.attribute_group_id = ?", $object->getAttributeGroupId()); + $maxOrder = $read->fetchOne($select); + return $maxOrder; + } + + return 0; + } + + /** + * Enter description here... + * + * @param Mage_Core_Model_Abstract $object + * @return Mage_Eav_Model_Mysql4_Entity_Attribute + */ + public function deleteEntity(Mage_Core_Model_Abstract $object) + { + $write = $this->_getWriteAdapter(); + $condition = $write->quoteInto($this->getTable('entity_attribute').'.entity_attribute_id = ?', $object->getEntityAttributeId()); + /** + * Delete attribute values + */ + $select = $write->select() + ->from($this->getTable('entity_attribute')) + ->where($condition); + $data = $write->fetchRow($select); + if (!empty($data)) { + /** + * @todo !!!! need fix retrieving attribute entity, this realization is temprary + */ + $attribute = Mage::getModel('eav/entity_attribute') + ->load($data['attribute_id']) + ->setEntity(Mage::getSingleton('catalog/product')->getResource()); + + if ($this->isUsedBySuperProducts($attribute, $data['attribute_set_id'])) { + Mage::throwException(Mage::helper('eav')->__("Attribute '%s' used in configurable products.", $attribute->getAttributeCode())); + } + + if ($backendTable = $attribute->getBackend()->getTable()) { + $clearCondition = array( + $write->quoteInto('entity_type_id=?',$attribute->getEntityTypeId()), + $write->quoteInto('attribute_id=?',$attribute->getId()), + $write->quoteInto('entity_id IN ( + SELECT entity_id FROM '.$attribute->getEntity()->getEntityTable().' WHERE attribute_set_id=?)', + $data['attribute_set_id']) + ); + $write->delete($backendTable, $clearCondition); + } + } + + $write->delete($this->getTable('entity_attribute'), $condition); + return $this; + } + + /** + * Enter description here... + * + * @param Mage_Core_Model_Abstract $object + * @return Mage_Eav_Model_Mysql4_Entity_Attribute + */ + protected function _beforeSave(Mage_Core_Model_Abstract $object) + { + $frontendLabel = $object->getFrontendLabel(); + if (is_array($frontendLabel)) { + if (!isset($frontendLabel[0]) || is_null($frontendLabel[0]) || $frontendLabel[0]=='') { + Mage::throwException(Mage::helper('eav')->__('Frontend label is not defined')); + } + $object->setFrontendLabel($frontendLabel[0]); + + if ($object->getData('modulePrefix')) { + $str = $object->getData('modulePrefix') . Mage_Core_Model_Translate::SCOPE_SEPARATOR . $frontendLabel[0]; + } + else { + $str = $frontendLabel[0]; + } + Mage::getModel('core/translate_string') + ->setString($str) + ->setTranslate($frontendLabel[0]) + ->setStoreTranslations($frontendLabel) + ->save(); + } + $applyTo = $object->getApplyTo(); + + if (is_array($applyTo)) { + $object->setApplyTo(implode(',', $applyTo)); + } + + /** + * @todo need use default source model of entity type !!! + */ + if (!$object->getId()) { + if ($object->getFrontendInput()=='select') { + $object->setSourceModel('eav/entity_attribute_source_table'); + } + } + + return parent::_beforeSave($object); + } + + /** + * Enter description here... + * + * @param Mage_Core_Model_Abstract $object + * @return Mage_Eav_Model_Mysql4_Entity_Attribute + */ + protected function _afterSave(Mage_Core_Model_Abstract $object) + { + $this->saveInSetIncluding($object) + ->_saveOption($object); + return parent::_afterSave($object); + } + + /** + * Enter description here... + * + * @param Mage_Core_Model_Abstract $object + * @return Mage_Eav_Model_Mysql4_Entity_Attribute + */ + public function saveInSetIncluding(Mage_Core_Model_Abstract $object) + { + $attrId = $object->getId(); + $setId = (int) $object->getAttributeSetId(); + $groupId= (int) $object->getAttributeGroupId(); + + if ($setId && $groupId && $object->getEntityTypeId()) { + $write = $this->_getWriteAdapter(); + $table = $this->getTable('entity_attribute'); + + + $data = array( + 'entity_type_id' => $object->getEntityTypeId(), + 'attribute_set_id' => $setId, + 'attribute_group_id' => $groupId, + 'attribute_id' => $attrId, + 'sort_order' => (($object->getSortOrder()) ? $object->getSortOrder() : $this->_getMaxSortOrder($object) + 1), + ); + + $condition = "$table.attribute_id = '$attrId' + AND $table.attribute_set_id = '$setId'"; + $write->delete($table, $condition); + $write->insert($table, $data); + + } + return $this; + } + + /** + * Enter description here... + * + * @param Mage_Core_Model_Abstract $object + * @return Mage_Eav_Model_Mysql4_Entity_Attribute + */ + protected function _saveOption(Mage_Core_Model_Abstract $object) + { + $option = $object->getOption(); + if (is_array($option)) { + $write = $this->_getWriteAdapter(); + $optionTable = $this->getTable('attribute_option'); + $optionValueTable = $this->getTable('attribute_option_value'); + $stores = Mage::getModel('core/store') + ->getResourceCollection() + ->setLoadDefault(true) + ->load(); + + if (isset($option['value'])) { + $attributeDefaultValue = array(); + if (!is_array($object->getDefault())) { + $object->setDefault(array()); + } + + foreach ($option['value'] as $optionId => $values) { + $intOptionId = (int) $optionId; + if (!empty($option['delete'][$optionId])) { + if ($intOptionId) { + $condition = $write->quoteInto('option_id=?', $intOptionId); + $write->delete($optionTable, $condition); + } + + continue; + } + + if (!$intOptionId) { + $data = array( + 'attribute_id' => $object->getId(), + 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, + ); + $write->insert($optionTable, $data); + $intOptionId = $write->lastInsertId(); + } + else { + $data = array( + 'sort_order' => isset($option['order'][$optionId]) ? $option['order'][$optionId] : 0, + ); + $write->update($optionTable, $data, $write->quoteInto('option_id=?', $intOptionId)); + } + + if (in_array($optionId, $object->getDefault())) { + if ($object->getFrontendInput() == 'multiselect') { + $attributeDefaultValue[] = $intOptionId; + } else if ($object->getFrontendInput() == 'select') { + $attributeDefaultValue = array($intOptionId); + } + } + + + // Default value + if (!isset($values[0])) { + Mage::throwException(Mage::helper('eav')->__('Default option value is not defined')); + } + + $write->delete($optionValueTable, $write->quoteInto('option_id=?', $intOptionId)); + foreach ($stores as $store) { + if (isset($values[$store->getId()]) && (!empty($values[$store->getId()]) || $values[$store->getId()] == "0")) { + $data = array( + 'option_id' => $intOptionId, + 'store_id' => $store->getId(), + 'value' => $values[$store->getId()], + ); + $write->insert($optionValueTable, $data); + } + } + } + + $write->update($this->getMainTable(), array( + 'default_value' => implode(',', $attributeDefaultValue) + ), $write->quoteInto($this->getIdFieldName() . '=?', $object->getId())); + } + } + return $this; + } + + public function isUsedBySuperProducts(Mage_Core_Model_Abstract $object, $attributeSet=null) + { + $read = $this->_getReadAdapter(); + $attrTable = $this->getTable('catalog/product_super_attribute'); + $productTable = $this->getTable('catalog/product'); + $select = $read->select() + ->from(array('_main_table' => $attrTable), 'COUNT(*)') + ->join(array('_entity'=> $productTable), '_main_table.product_id = _entity.entity_id') + ->where("_main_table.attribute_id = ?", $object->getAttributeId()) + ->group('_main_table.attribute_id') + ->limit(1); + + if (!is_null($attributeSet)) { + $select->where('_entity.attribute_set_id = ?', $attributeSet); + } + $valueCount = $read->fetchOne($select); + return $valueCount; + } + + /** + * Return attribute id + * + * @param string $entityType + * @param string $code + * @return int + */ + public function getIdByCode($entityType, $code) + { + $select = $this->_getReadAdapter()->select() + ->from(array('a'=>$this->getTable('eav/attribute')), array('a.attribute_id')) + ->join(array('t'=>$this->getTable('eav/entity_type')), 'a.entity_type_id = t.entity_type_id', array()) + ->where('t.entity_type_code = ?', $entityType) + ->where('a.attribute_code = ?', $code); + + return $this->_getReadAdapter()->fetchOne($select); + } + + public function getAttributeCodesByFrontendType($type) + { + $select = $this->_getReadAdapter()->select(); + $select + ->from($this->getTable('eav/attribute'), 'attribute_code') + ->where('frontend_input = ?', $type); + + $result = $this->_getReadAdapter()->fetchCol($select); + + if ($result) { + return $result; + } else { + return array(); + } + } + +} diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Collection.php index 97680a8fa4..e57b8cd475 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Collection.php @@ -193,6 +193,17 @@ public function addIsFilterableFilter() return $this; } + /** + * Add filterable in search filter + * + * @return Mage_Eav_Model_Mysql4_Entity_Attribute_Collection + */ + public function addIsFilterableInSearchFilter() + { + $this->getSelect()->where('main_table.is_filterable_in_search>0'); + return $this; + } + /** * Enter description here... * diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set.php index 7495e74845..d90e946175 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set.php @@ -62,4 +62,21 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) } return parent::_afterSave($object); } + + public function validate($object,$name) + { + $read = $this->_getReadAdapter(); + $select = $read->select()->from($this->getMainTable()) + ->where("attribute_set_name=?",$name) + ->where("entity_type_id=?",$object->getEntityTypeId()); + + if ($object->getId()) { + $select->where("attribute_set_id!=?",$object->getId()); + } + + if (!$read->fetchOne($select)) + return true; + + return false; + } } \ No newline at end of file diff --git a/app/code/core/Mage/Eav/etc/config.xml b/app/code/core/Mage/Eav/etc/config.xml index 6fe29f8652..8a822241ff 100644 --- a/app/code/core/Mage/Eav/etc/config.xml +++ b/app/code/core/Mage/Eav/etc/config.xml @@ -28,7 +28,7 @@ - 0.7.10 + 0.7.11 diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.10-0.7.11.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.10-0.7.11.php new file mode 100644 index 0000000000..f1bc243843 --- /dev/null +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.10-0.7.11.php @@ -0,0 +1,49 @@ + + */ + +$installer = $this; +/* @var $installer Mage_Eav_Model_Entity_Setup */ + +$installer->startSetup(); +$table = $installer->getTable('eav/attribute'); +$installer->getConnection()->addColumn( + $table, + "is_filterable_in_search", + "TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1'" +); +$installer->run(" + UPDATE `{$table}` SET is_filterable_in_search=(is_filterable!=0) +"); +$installer->endSetup(); diff --git a/app/code/core/Mage/GiftMessage/Model/Observer.php b/app/code/core/Mage/GiftMessage/Model/Observer.php index ce765e2f92..3d66b2b4b2 100644 --- a/app/code/core/Mage/GiftMessage/Model/Observer.php +++ b/app/code/core/Mage/GiftMessage/Model/Observer.php @@ -176,9 +176,9 @@ public function catalogEventProductCollectionAfterLoad($observer) } /** - * Duplicates giftmessage from order to quote on import + * Duplicates giftmessage from order to quote on import or reorder * - * @param Varien_Object $observer + * @param Varien_Event_Observer $observer * @return Mage_GiftMessage_Model_Observer */ public function salesEventOrderToQuote($observer) @@ -193,4 +193,25 @@ public function salesEventOrderToQuote($observer) return $this; } + /** + * Duplicates giftmessage from order item to quote item on import or reorder + * + * @param Varien_Event_Observer $observer + * @return Mage_GiftMessage_Model_Observer + */ + public function salesEventOrderItemToQuoteItem($observer) + { + $orderItem = $observer->getEvent()->getOrderItem(); + $quoteItem = $observer->getEvent()->getQuoteItem(); + /* @var $orderItem Mage_Sales_Model_Order_Item */ + /* @var $quoteItem Mage_Sales_Model_Quote_Item */ + if ($giftMessageId = $orderItem->getGiftMessageId()) { + $giftMessage = Mage::getModel('giftmessage/message')->load($giftMessageId) + ->setId(null) + ->save(); + $quoteItem->setGiftMessageId($giftMessage->getId()); + } + + return $this; + } } diff --git a/app/code/core/Mage/GiftMessage/etc/config.xml b/app/code/core/Mage/GiftMessage/etc/config.xml index ba495f5395..ef3f3f0cdd 100644 --- a/app/code/core/Mage/GiftMessage/etc/config.xml +++ b/app/code/core/Mage/GiftMessage/etc/config.xml @@ -140,6 +140,15 @@ + + + + model + giftmessage/observer + salesEventOrderItemToQuoteItem + + + diff --git a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php index d799d9186b..cf8f5a0325 100644 --- a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php +++ b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php @@ -90,7 +90,7 @@ public function getOrderHtml() $address = $order->getBillingAddress(); $html = ''; return $html; @@ -141,11 +145,11 @@ public function getAccount() public function getPageName() { if (!$this->hasData('page_name')) { - $queryStr = ''; - if ($request = Mage::app()->getFrontController()->getRequest()) { - $queryStr = substr($request->getRequestUri(), strpos($request->getRequestUri(), '?')); - } - $this->setPageName(Mage::getSingleton('core/url')->escape($this->getRequest()->getPathInfo()) . $queryStr); + //$queryStr = ''; + //if ($this->getRequest() && $this->getRequest()->getQuery()) { + // $queryStr = '?' . http_build_query($this->getRequest()->getQuery()); + //} + $this->setPageName(Mage::getSingleton('core/url')->escape($_SERVER['REQUEST_URI'])); } return $this->getData('page_name'); } diff --git a/app/code/core/Mage/GoogleAnalytics/etc/config.xml b/app/code/core/Mage/GoogleAnalytics/etc/config.xml index 72c9516233..c997e27152 100644 --- a/app/code/core/Mage/GoogleAnalytics/etc/config.xml +++ b/app/code/core/Mage/GoogleAnalytics/etc/config.xml @@ -94,7 +94,7 @@ - + Google API diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Captcha.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Captcha.php new file mode 100644 index 0000000000..c216a61de7 --- /dev/null +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Captcha.php @@ -0,0 +1,57 @@ + + */ +class Mage_GoogleBase_Block_Adminhtml_Captcha extends Mage_Adminhtml_Block_Template +{ + + public function __construct() + { + parent::__construct(); + $this->setTemplate('googlebase/captcha.phtml'); + } + + public function getConfirmButtonHtml() + { + $confirmButton = $this->getLayout()->createBlock('adminhtml/widget_button') + ->setData(array( + 'label' => $this->__('Confirm'), + 'onclick' => "if($('user_confirm').value != '') + { + setLocation('".$this->getUrl('*/*/confirmCaptcha', array('_current'=>true))."' + 'user_confirm/' + $('user_confirm').value + '/'); + }", + 'class' => 'task' + )); + return $confirmButton->toHtml(); + } +} \ No newline at end of file diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items.php index 41c3b4eeac..e6a010e394 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items.php @@ -67,11 +67,20 @@ public function getAddButtonHtml() ->setData($addButtonData) ->toHtml(); } + public function getStoreSwitcherHtml() { return $this->getChildHtml('store_switcher'); } + public function getCaptchaHtml() + { + return $this->getLayout()->createBlock('googlebase/adminhtml_captcha') + ->setGbaseCaptchaToken($this->getGbaseCaptchaToken()) + ->setGbaseCaptchaUrl($this->getGbaseCaptchaUrl()) + ->toHtml(); + } + public function getStore() { $storeId = (int) $this->getRequest()->getParam('store', 0); diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Item.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Item.php index e2e909fb39..aa4f3100c9 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Item.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Item.php @@ -132,6 +132,7 @@ protected function _prepareMassaction() { $this->setMassactionIdField('item_id'); $this->getMassactionBlock()->setFormFieldName('item'); + $this->setNoFilterMassactionColumn(true); $this->getMassactionBlock()->addItem('delete', array( 'label' => $this->__('Delete'), diff --git a/app/code/core/Mage/GoogleBase/Model/Item.php b/app/code/core/Mage/GoogleBase/Model/Item.php index 529378e267..a81ca21978 100644 --- a/app/code/core/Mage/GoogleBase/Model/Item.php +++ b/app/code/core/Mage/GoogleBase/Model/Item.php @@ -186,7 +186,7 @@ protected function _prepareProductObject() { $product = clone $this->getProduct(); /* @var $product Mage_Catalog_Model_Product */ - $url = $product->getProductUrl(); + $url = $product->getProductUrl(false); if (!Mage::getStoreConfigFlag('web/url/use_store')) { $urlInfo = parse_url($url); $store = $product->getStore()->getCode(); diff --git a/app/code/core/Mage/GoogleBase/Model/Service.php b/app/code/core/Mage/GoogleBase/Model/Service.php index 17c522f333..b8d0d335f9 100644 --- a/app/code/core/Mage/GoogleBase/Model/Service.php +++ b/app/code/core/Mage/GoogleBase/Model/Service.php @@ -38,7 +38,7 @@ class Mage_GoogleBase_Model_Service extends Varien_Object * * @return Zend_Http_Client */ - public function getClient($storeId = null) + public function getClient($storeId = null, $loginToken = null, $loginCaptcha = null) { $user = Mage::getStoreConfig('google/googlebase/login', $storeId); $pass = Mage::getStoreConfig('google/googlebase/password', $storeId); @@ -46,12 +46,12 @@ public function getClient($storeId = null) // Create an authenticated HTTP client $errorMsg = Mage::helper('googlebase')->__('Unable to connect to Google Base. Please, check Account settings in configuration.'); try { - $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, Zend_Gdata_Gbase::AUTH_SERVICE_NAME); - } catch (Zend_Gdata_App_AuthException $e) { - Mage::throwException($errorMsg . Mage::helper('googlebase')->__('Error: %s', $e->getMessage())); + $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, Zend_Gdata_Gbase::AUTH_SERVICE_NAME, null, '', $loginToken, $loginCaptcha); + } catch (Zend_Gdata_App_CaptchaRequiredException $e) { + throw $e; } catch (Zend_Gdata_App_HttpException $e) { Mage::throwException($errorMsg . Mage::helper('googlebase')->__('Error: %s', $e->getMessage())); - } catch (Zend_Gdata_App_CaptchaRequiredException $e) { + } catch (Zend_Gdata_App_AuthException $e) { Mage::throwException($errorMsg . Mage::helper('googlebase')->__('Error: %s', $e->getMessage())); } diff --git a/app/code/core/Mage/GoogleBase/controllers/ItemsController.php b/app/code/core/Mage/GoogleBase/controllers/ItemsController.php index b7c77053f2..fd7187f277 100644 --- a/app/code/core/Mage/GoogleBase/controllers/ItemsController.php +++ b/app/code/core/Mage/GoogleBase/controllers/ItemsController.php @@ -45,14 +45,26 @@ protected function _initAction() public function indexAction() { + $contentBlock = $this->getLayout()->createBlock('googlebase/adminhtml_items'); + + if ($this->getRequest()->getParam('captcha_token') && $this->getRequest()->getParam('captcha_url')) { + $contentBlock->setGbaseCaptchaToken( + Mage::helper('core')->urlDecode($this->getRequest()->getParam('captcha_token')) + ); + $contentBlock->setGbaseCaptchaUrl( + Mage::helper('core')->urlDecode($this->getRequest()->getParam('captcha_url')) + ); + } + $this->_initAction() ->_addBreadcrumb(Mage::helper('googlebase')->__('Items'), Mage::helper('googlebase')->__('Items')) - ->_addContent($this->getLayout()->createBlock('googlebase/adminhtml_items')) + ->_addContent($contentBlock) ->renderLayout(); } public function gridAction() { + $this->loadLayout(); return $this->getResponse()->setBody( $this->getLayout() ->createBlock('googlebase/adminhtml_items_item') @@ -90,6 +102,10 @@ public function massAddAction() } else { $this->_getSession()->addError($this->__('No products were added to Google Base')); } + } catch (Zend_Gdata_App_CaptchaRequiredException $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirectToCaptcha($e); + return; } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); } @@ -120,6 +136,10 @@ public function massDeleteAction() } else { $this->_getSession()->addError($this->__('No items were deleted from Google Base')); } + } catch (Zend_Gdata_App_CaptchaRequiredException $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirectToCaptcha($e); + return; } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); } @@ -149,6 +169,10 @@ public function massPublishAction() } else { $this->_getSession()->addError($this->__('No items were published')); } + } catch (Zend_Gdata_App_CaptchaRequiredException $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirectToCaptcha($e); + return; } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); } @@ -178,6 +202,10 @@ public function massHideAction() } else { $this->_getSession()->addError($this->__('No items were saved as Inactive items')); } + } catch (Zend_Gdata_App_CaptchaRequiredException $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirectToCaptcha($e); + return; } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); } @@ -233,6 +261,10 @@ public function refreshAction() $this->_getSession()->addSuccess( $this->__('Total of %d items(s) were successfully deleted, Total of %d items(s) were successfully updated', $totalDeleted, $totalUpdated) ); + } catch (Zend_Gdata_App_CaptchaRequiredException $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirectToCaptcha($e); + return; } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); } @@ -240,6 +272,43 @@ public function refreshAction() $this->_redirect('*/*/index', array('store'=>$storeId)); } + public function confirmCaptchaAction() + { + $storeId = $this->_getStore()->getId(); + try { + Mage::getModel('googlebase/service')->getClient( + $storeId, + Mage::helper('core')->urlDecode($this->getRequest()->getParam('captcha_token')), + $this->getRequest()->getParam('user_confirm') + ); + $this->_getSession()->addSuccess($this->__('Captcha confirmed successfully')); + + } catch (Zend_Gdata_App_CaptchaRequiredException $e) { + $this->_getSession()->addError($this->__('Captcha confirmation error: %s', $e->getMessage())); + $this->_redirectToCaptcha($e); + return; + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Captcha confirmation error: %s', $e->getMessage())); + } + + $this->_redirect('*/*/index', array('store'=>$storeId)); + } + + /** + * Redirect user to Google Captcha challenge + * + * @param Zend_Gdata_App_CaptchaRequiredException $e + */ + protected function _redirectToCaptcha($e) + { + $this->_redirect('*/*/index', + array('store' => $this->_getStore()->getId(), + 'captcha_token' => Mage::helper('core')->urlEncode($e->getCaptchaToken()), + 'captcha_url' => Mage::helper('core')->urlEncode($e->getCaptchaUrl()) + ) + ); + } + public function _getStore() { $storeId = (int) $this->getRequest()->getParam('store', 0); diff --git a/app/code/core/Mage/GoogleBase/controllers/SelectionController.php b/app/code/core/Mage/GoogleBase/controllers/SelectionController.php index 4c8d9919a4..9b39361194 100644 --- a/app/code/core/Mage/GoogleBase/controllers/SelectionController.php +++ b/app/code/core/Mage/GoogleBase/controllers/SelectionController.php @@ -46,6 +46,7 @@ public function searchAction() public function gridAction() { + $this->loadLayout(); return $this->getResponse()->setBody( $this->getLayout() ->createBlock('googlebase/adminhtml_items_product') diff --git a/app/code/core/Mage/GoogleBase/etc/config.xml b/app/code/core/Mage/GoogleBase/etc/config.xml index 81a9b797d4..0a7c143d22 100644 --- a/app/code/core/Mage/GoogleBase/etc/config.xml +++ b/app/code/core/Mage/GoogleBase/etc/config.xml @@ -154,15 +154,15 @@ - + Google Base 500 - + Manage Attributes 0 - + Manage Items 5 diff --git a/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-install-0.1.0.php index fbcec89203..c3e0b0e412 100644 --- a/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-install-0.1.0.php +++ b/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-install-0.1.0.php @@ -54,7 +54,7 @@ `views` smallint(5) unsigned not null default '0', `is_hidden` tinyint not null default '0', PRIMARY KEY (`item_id`), - CONSTRAINT `GOOGLEBASE_ITEMS_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES `{$this->getTable('catalog/product_entity')}` (`entity_id`) ON DELETE CASCADE, + CONSTRAINT `GOOGLEBASE_ITEMS_PRODUCT_ID` FOREIGN KEY (`product_id`) REFERENCES `{$this->getTable('catalog/product')}` (`entity_id`) ON DELETE CASCADE, CONSTRAINT `GOOGLEBASE_ITEMS_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Google Base Items Products'; diff --git a/app/code/core/Mage/GoogleCheckout/Block/Form.php b/app/code/core/Mage/GoogleCheckout/Block/Form.php index 2f56849bb1..d6f6d33e9a 100644 --- a/app/code/core/Mage/GoogleCheckout/Block/Form.php +++ b/app/code/core/Mage/GoogleCheckout/Block/Form.php @@ -27,17 +27,20 @@ /** * GoogleCheckout Form Block * - * @category Mage - * @package Mage_GoogleCheckout - * @name Mage_GoogleCheckout_Block_Form - * @author Magento Core Team + * @category Mage + * @package Mage_GoogleCheckout + * @author Magento Core Team */ class Mage_GoogleCheckout_Block_Form extends Mage_Payment_Block_Form { + + /** + * Varien constructor + */ protected function _construct() { $this->setTemplate('googlecheckout/form.phtml'); parent::_construct(); } -} \ No newline at end of file +} diff --git a/app/code/core/Mage/GoogleCheckout/Block/Link.php b/app/code/core/Mage/GoogleCheckout/Block/Link.php index 89b2cba46a..75c6668acf 100644 --- a/app/code/core/Mage/GoogleCheckout/Block/Link.php +++ b/app/code/core/Mage/GoogleCheckout/Block/Link.php @@ -86,4 +86,17 @@ public function _toHtml() return ''; } + + public function getIsDisabled() + { + $quote = Mage::getSingleton('checkout/session')->getQuote(); + /* @var $quote Mage_Sales_Model_Quote */ + foreach ($quote->getAllVisibleItems() as $item) { + /* @var $item Mage_Sales_Model_Quote_Item */ + if ($item->getProduct()->getDisableGooglecheckout()) { + return true; + } + } + return false; + } } \ No newline at end of file diff --git a/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php b/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php index 9459f0d53f..09260a8aba 100644 --- a/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php +++ b/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php @@ -342,6 +342,7 @@ protected function _responseNewOrderNotification() Mage::getSingleton('checkout/session') ->setLastQuoteId($quote->getId()) ->setLastOrderId($order->getId()) + ->setLastSuccessQuoteId($quote->getId()) ->setLastRealOrderId($order->getIncrementId()); if ($emailAllowed) { @@ -483,6 +484,9 @@ protected function _responseRiskInformationNotification() $order->save(); } + /** + * Process authorization notification + */ protected function _responseAuthorizationAmountNotification() { $this->getGResponse()->SendAck(); @@ -495,8 +499,8 @@ protected function _responseAuthorizationAmountNotification() $expDate = $this->getData('root/authorization-expiration-date/VALUE'); $expDate = new Zend_Date($expDate); $msg = $this->__('Google Authorization:'); - $msg .= '
'.$this->__('Amount: %s', ''.Mage::helper('core')->currency($payment->getAmountAuthorized()).''); - $msg .= '
'.$this->__('Expiration: %s', ''.$expDate->toString().''); + $msg .= '
'.$this->__('Amount: %s', '' . $this->_formatAmount($payment->getAmountAuthorized()) . ''); + $msg .= '
'.$this->__('Expiration: %s', '' . $expDate->toString() . ''); $order->addStatusToHistory($order->getStatus(), $msg); @@ -506,6 +510,10 @@ protected function _responseAuthorizationAmountNotification() $order->save(); } + /** + * Process charge notification + * + */ protected function _responseChargeAmountNotification() { $this->getGResponse()->SendAck(); @@ -519,8 +527,8 @@ protected function _responseChargeAmountNotification() $order->setIsInProcess(true); $msg = $this->__('Google Charge:'); - $msg .= '
'.$this->__('Latest Charge: %s', ''.Mage::helper('core')->currency($latestCharged).''); - $msg .= '
'.$this->__('Total Charged: %s', ''.Mage::helper('core')->currency($totalCharged).''); + $msg .= '
'.$this->__('Latest Charge: %s', '' . $this->_formatAmount($latestCharged) . ''); + $msg .= '
'.$this->__('Total Charged: %s', '' . $this->_formatAmount($totalCharged) . ''); if (!$order->hasInvoices() && abs($order->getGrandTotal()-$latestCharged)<.0001) { $invoice = $this->_createInvoice(); @@ -588,6 +596,10 @@ protected function _responseChargebackAmountNotification() } + /** + * Process refund notification + * + */ protected function _responseRefundAmountNotification() { $this->getGResponse()->SendAck(); @@ -599,8 +611,8 @@ protected function _responseRefundAmountNotification() $payment->setAmountCharged($totalRefunded); $msg = $this->__('Google Refund:'); - $msg .= '
'.$this->__('Latest Refund: %s', ''.Mage::helper('core')->currency($this->getData('root/latest-refund-amount/VALUE')).''); - $msg .= '
'.$this->__('Total Refunded: %s', ''.Mage::helper('core')->currency($totalRefunded).''); + $msg .= '
'.$this->__('Latest Refund: %s', '' . $this->_formatAmount($this->getData('root/latest-refund-amount/VALUE')) . ''); + $msg .= '
'.$this->__('Total Refunded: %s', '' . $this->_formatAmount($totalRefunded) . ''); $order->addStatusToHistory($order->getStatus(), $msg); $order->save(); @@ -696,4 +708,16 @@ protected function _orderStateChangeFulfillmentWillNotDeliver() } + /** + * Format amount to be displayed + * + * @param mixed $amount + * @return string + */ + protected function _formatAmount($amount) + { + // format currency in currency format, but don't enclose it into + return Mage::helper('core')->currency($amount, true, false); + } + } \ No newline at end of file diff --git a/app/code/core/Mage/GoogleCheckout/etc/config.xml b/app/code/core/Mage/GoogleCheckout/etc/config.xml index 68f8a870c2..5619b7c621 100644 --- a/app/code/core/Mage/GoogleCheckout/etc/config.xml +++ b/app/code/core/Mage/GoogleCheckout/etc/config.xml @@ -28,10 +28,19 @@ - 0.7.0 + 0.7.1 + + + + + + + + + Mage_GoogleCheckout_Model @@ -136,7 +145,7 @@ Something like this is to be added to resolve bug #4890 - + Google API diff --git a/app/code/core/Mage/GoogleCheckout/sql/googlecheckout_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/GoogleCheckout/sql/googlecheckout_setup/mysql4-upgrade-0.7.0-0.7.1.php new file mode 100644 index 0000000000..8bb8a07d3f --- /dev/null +++ b/app/code/core/Mage/GoogleCheckout/sql/googlecheckout_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -0,0 +1,60 @@ +startSetup(); + +$installer->addAttribute('catalog_product', 'disable_googlecheckout', array( + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Not available for purchase with Google Checkout', + 'input' => 'select', + 'class' => '', + 'source' => 'eav/entity_attribute_source_boolean', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'default' => '0', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => '', + 'is_configurable' => false + )); + +$attributeId = $installer->getAttributeId('catalog_product', 'disable_googlecheckout'); + +foreach ($installer->getAllAttributeSetIds('catalog_product') as $attributeSetId) { + $attributeGroupId = $installer->getAttributeGroupId('catalog_product', $attributeSetId, 'Prices'); + $installer->addAttributeToSet('catalog_product', $attributeSetId, $attributeGroupId, $attributeId); +} +$installer->endSetup(); \ No newline at end of file diff --git a/app/code/core/Mage/GoogleOptimizer/Helper/Data.php b/app/code/core/Mage/GoogleOptimizer/Helper/Data.php index dd66eb9d78..722a075689 100644 --- a/app/code/core/Mage/GoogleOptimizer/Helper/Data.php +++ b/app/code/core/Mage/GoogleOptimizer/Helper/Data.php @@ -51,9 +51,9 @@ public function getStoreId() return $this->_storeId; } - public function isOptimizerActive() + public function isOptimizerActive($store = null) { - return Mage::app()->getStore()->getConfig(self::XML_PATH_ENABLED); + return Mage::getStoreConfig(self::XML_PATH_ENABLED, $store); } /** diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Observer.php b/app/code/core/Mage/GoogleOptimizer/Model/Observer.php index 6e2b0a6390..fa203b3571 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Observer.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Observer.php @@ -42,6 +42,11 @@ class Mage_GoogleOptimizer_Model_Observer public function appendToProductGoogleOptimizerScripts($observer) { $product = $observer->getEvent()->getProduct(); + + if (!Mage::helper('googleoptimizer')->isOptimizerActive()) { + return $this; + } + $googleOptimizerModel = Mage::getModel('googleoptimizer/code_product') ->setEntity($product) ->loadScripts($product->getStoreId()); @@ -51,13 +56,23 @@ public function appendToProductGoogleOptimizerScripts($observer) return $this; } + /** + * @deprecated please use prepareProductGoogleOptimizerScripts method instead + * + * @param Varien_Object $observer + */ + public function prepareGoogleOptimizerScripts($observer) + { + $this->prepareProductGoogleOptimizerScripts($observer); + } + /** * Prepare product scripts for saving * * @param Varien_Object $observer * @return Mage_Googleoptimizer_Model_Observer */ - public function prepareGoogleOptimizerScripts($observer) + public function prepareProductGoogleOptimizerScripts($observer) { $product = $observer->getEvent()->getProduct(); $request = $observer->getEvent()->getRequest(); @@ -190,6 +205,11 @@ public function assignHandlers($observer) public function appendToCategoryGoogleOptimizerScripts($observer) { $category = $observer->getEvent()->getCategory(); + + if (!Mage::helper('googleoptimizer')->isOptimizerActive()) { + return $this; + } + $googleOptimizerModel = Mage::getModel('googleoptimizer/code_category') ->setEntity($category) ->loadScripts($category->getStoreId()); @@ -226,6 +246,10 @@ public function saveCategoryGoogleOptimizerScripts($observer) { $category = $observer->getEvent()->getCategory(); + if (!Mage::helper('googleoptimizer')->isOptimizerActive()) { + return $this; + } + if ($category->getGoogleOptimizerScripts()) { $googleOptimizer = Mage::getModel('googleoptimizer/code_category') ->setEntity($category) diff --git a/app/code/core/Mage/GoogleOptimizer/etc/config.xml b/app/code/core/Mage/GoogleOptimizer/etc/config.xml index f4c7f79e92..78abfd5a2c 100644 --- a/app/code/core/Mage/GoogleOptimizer/etc/config.xml +++ b/app/code/core/Mage/GoogleOptimizer/etc/config.xml @@ -20,7 +20,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_GoogleCheckout + * @package Mage_GoogleOptimizer * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ @@ -75,35 +75,6 @@ Mage_GoogleOptimizer_Block - - - - - singleton - googleoptimizer/observer - appendToPageGoogleOptimizerScripts - - - - - - - singleton - googleoptimizer/observer - appendToProductGoogleOptimizerScripts - - - - - - - singleton - googleoptimizer/observer - appendToCategoryGoogleOptimizerScripts - - - - @@ -140,6 +111,33 @@ + + + + singleton + googleoptimizer/observer + appendToPageGoogleOptimizerScripts + + + + + + + singleton + googleoptimizer/observer + appendToProductGoogleOptimizerScripts + + + + + + + singleton + googleoptimizer/observer + appendToCategoryGoogleOptimizerScripts + + + @@ -177,7 +175,7 @@ singleton googleoptimizer/observer - prepareGoogleOptimizerScripts + prepareProductGoogleOptimizerScripts @@ -199,6 +197,15 @@ + + + + singleton + googleoptimizer/observer + appendToCategoryGoogleOptimizerScripts + + + @@ -226,6 +233,15 @@ + + + + singleton + googleoptimizer/observer + appendToPageGoogleOptimizerScripts + + + diff --git a/app/code/core/Mage/Install/Block/Locale.php b/app/code/core/Mage/Install/Block/Locale.php index 781e7b20c8..2b266c21bb 100644 --- a/app/code/core/Mage/Install/Block/Locale.php +++ b/app/code/core/Mage/Install/Block/Locale.php @@ -62,7 +62,8 @@ public function getLocale() */ public function getPostUrl() { - return $this->getUrl('*/*/localePost'); + return $this->getCurrentStep()->getNextUrl(); + //return $this->getUrl('*/*/localePost'); } /** diff --git a/app/code/core/Mage/Install/Model/Installer.php b/app/code/core/Mage/Install/Model/Installer.php index 680e98ad6b..21bae0fe23 100644 --- a/app/code/core/Mage/Install/Model/Installer.php +++ b/app/code/core/Mage/Install/Model/Installer.php @@ -55,7 +55,7 @@ class Mage_Install_Model_Installer extends Varien_Object */ public function isApplicationInstalled() { - return Mage::app()->isInstalled(); + return Mage::isInstalled(); } /** diff --git a/app/code/core/Mage/Install/Model/Installer/Console.php b/app/code/core/Mage/Install/Model/Installer/Console.php index 92aaca0f55..05c313d788 100644 --- a/app/code/core/Mage/Install/Model/Installer/Console.php +++ b/app/code/core/Mage/Install/Model/Installer/Console.php @@ -216,8 +216,7 @@ public function getErrors() protected function _checkFlag($value) { $res = (1 == $value) - || preg_match('/^yes$/i', $value) - || preg_match('/^true$/i', $value); + || preg_match('/^(yes|y|true)$/i', $value); return $res; } @@ -258,7 +257,7 @@ public function init(Mage_Core_Model_App $app) /** * Check if already installed */ - if ($this->_app->isInstalled()) { + if (Mage::isInstalled()) { $this->addError('ERROR: Magento is already installed'); return false; } @@ -327,7 +326,7 @@ public function install() /** * Check if already installed */ - if ($this->_app->isInstalled()) { + if (Mage::isInstalled()) { $this->addError('ERROR: Magento is already installed'); return false; } @@ -361,6 +360,7 @@ public function install() /** * Reinitialize configuration (to use new config data) */ + $this->_app->cleanCache(); Mage::getConfig()->reinit(); diff --git a/app/code/core/Mage/Install/controllers/WizardController.php b/app/code/core/Mage/Install/controllers/WizardController.php index c820a73068..1d82ff61d2 100644 --- a/app/code/core/Mage/Install/controllers/WizardController.php +++ b/app/code/core/Mage/Install/controllers/WizardController.php @@ -283,6 +283,10 @@ public function configAction() $this->setFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT, true); $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true); + if ($data = $this->getRequest()->getQuery('config')) { + Mage::getSingleton('install/session')->setLocaleData($data); + } + $this->_prepareLayout(); $this->_initLayoutMessages('install/session'); $this->getLayout()->getBlock('content')->append( diff --git a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Collection.php b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Collection.php index 7b96ae543d..07cd08e523 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Collection.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Collection.php @@ -149,6 +149,7 @@ public function useOnlineFilter($minutes=null) $email = $customersCollection->getAttribute('email'); $this->_select + ->from('', array('type' => 'IF(customer_id, \''.Mage_Log_Model_Visitor::VISITOR_TYPE_CUSTOMER.'\', \''.Mage_Log_Model_Visitor::VISITOR_TYPE_VISITOR.'\')')) ->joinLeft( array('customer_lastname_table'=>$lastname->getBackend()->getTable()), 'customer_lastname_table.entity_id=customer_table.customer_id diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php index 26c6a034c5..7aec1c24d0 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php @@ -105,9 +105,23 @@ public function useQueue(Mage_Newsletter_Model_Queue $queue) return $this; } + /** + * Retrive all ids for collection + * @todo : In future we need to extend all newslatter classes from abstract classes + * + * @return array + */ public function getAllIds() { - return $this->getColumnValues('subscriber_id'); + $idsSelect = clone $this->getSelect(); + $idsSelect->reset(Zend_Db_Select::ORDER); + $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT); + $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET); + $idsSelect->reset(Zend_Db_Select::COLUMNS); + $idsSelect->from(null, + 'main_table.subscriber_id' + ); + return $this->getConnection()->fetchCol($idsSelect); } /** diff --git a/app/code/core/Mage/Newsletter/Model/Subscriber.php b/app/code/core/Mage/Newsletter/Model/Subscriber.php index 28309c2c52..798230c1a2 100644 --- a/app/code/core/Mage/Newsletter/Model/Subscriber.php +++ b/app/code/core/Mage/Newsletter/Model/Subscriber.php @@ -290,12 +290,12 @@ public function subscribe($email) $this->setSubscriberConfirmCode($this->randomSequence()); } - if(($this->getCustomerId() && !$customerSession->isLoggedIn()) - || ($this->getCustomerId() - && $customerSession->getCustomerId() != $this->getCustomerId() - )) { - return $this->getSubscriberStatus(); - } +// if(($this->getCustomerId() && !$customerSession->isLoggedIn()) +// || ($this->getCustomerId() +// && $customerSession->getCustomerId() != $this->getCustomerId() +// )) { +// return $this->getSubscriberStatus(); +// } if (!$this->getId() || $this->getStatus()==self::STATUS_UNSUBSCRIBED || $this->getStatus()==self::STATUS_NOT_ACTIVE) { if (Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) { diff --git a/app/code/core/Mage/Newsletter/controllers/ManageController.php b/app/code/core/Mage/Newsletter/controllers/ManageController.php index 55395cc781..201e00ea6b 100644 --- a/app/code/core/Mage/Newsletter/controllers/ManageController.php +++ b/app/code/core/Mage/Newsletter/controllers/ManageController.php @@ -62,6 +62,9 @@ public function indexAction() public function saveAction() { + if (!$this->_validateFormKey()) { + return $this->_redirect('customer/account/'); + } try { Mage::getSingleton('customer/session')->getCustomer() ->setStoreId(Mage::app()->getStore()->getId()) @@ -74,4 +77,4 @@ public function saveAction() } $this->_redirect('customer/account/'); } -} \ No newline at end of file +} diff --git a/app/code/core/Mage/Newsletter/controllers/SubscriberController.php b/app/code/core/Mage/Newsletter/controllers/SubscriberController.php index 8a9c3c796c..0bf3c748a2 100644 --- a/app/code/core/Mage/Newsletter/controllers/SubscriberController.php +++ b/app/code/core/Mage/Newsletter/controllers/SubscriberController.php @@ -34,14 +34,19 @@ class Mage_Newsletter_SubscriberController extends Mage_Core_Controller_Front_Action { /** - * New subscription action - */ + * New subscription action + */ public function newAction() { if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) { - $session = Mage::getSingleton('core/session'); - $email = (string) $this->getRequest()->getPost('email'); - try { + $session = Mage::getSingleton('core/session'); + $email = (string) $this->getRequest()->getPost('email'); + + try { + if (!Zend_Validate::is($email, 'EmailAddress')) { + Mage::throwException($this->__('Please enter a valid email address')); + } + $status = Mage::getModel('newsletter/subscriber')->subscribe($email); if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) { $session->addSuccess($this->__('Confirmation request has been sent')); @@ -49,13 +54,13 @@ public function newAction() else { $session->addSuccess($this->__('Thank you for your subscription')); } - } - catch (Mage_Core_Exception $e) { - $session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage())); - } - catch (Exception $e) { - $session->addException($e, $this->__('There was a problem with the subscription')); - } + } + catch (Mage_Core_Exception $e) { + $session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage())); + } + catch (Exception $e) { + $session->addException($e, $this->__('There was a problem with the subscription')); + } } $this->_redirectReferer(); } @@ -65,23 +70,23 @@ public function newAction() */ public function confirmAction() { - $id = (int) $this->getRequest()->getParam('id'); - $code = (string) $this->getRequest()->getParam('code'); + $id = (int) $this->getRequest()->getParam('id'); + $code = (string) $this->getRequest()->getParam('code'); - if ($id && $code) { - $subscriber = Mage::getModel('newsletter/subscriber')->load($id); + if ($id && $code) { + $subscriber = Mage::getModel('newsletter/subscriber')->load($id); $session = Mage::getSingleton('core/session'); - if($subscriber->getId() && $subscriber->getCode()) { + if($subscriber->getId() && $subscriber->getCode()) { if($subscriber->confirm($code)) { $session->addSuccess($this->__('Your subscription was successfully confirmed')); } else { $session->addError($this->__('Invalid subscription confirmation code')); } - } else { + } else { $session->addError($this->__('Invalid subscription ID')); - } - } + } + } $this->_redirectUrl(Mage::getBaseUrl()); } @@ -91,24 +96,24 @@ public function confirmAction() */ public function unsubscribeAction() { - $id = (int) $this->getRequest()->getParam('id'); - $code = (string) $this->getRequest()->getParam('code'); + $id = (int) $this->getRequest()->getParam('id'); + $code = (string) $this->getRequest()->getParam('code'); - if ($id && $code) { - $session = Mage::getSingleton('core/session'); - try { - $result = Mage::getModel('newsletter/subscriber')->load($id) + if ($id && $code) { + $session = Mage::getSingleton('core/session'); + try { + Mage::getModel('newsletter/subscriber')->load($id) ->setCheckCode($code) ->unsubscribe(); $session->addSuccess($this->__('You have been successfully unsubscribed.')); - } - catch (Mage_Core_Exception $e) { + } + catch (Mage_Core_Exception $e) { $session->addException($e, $e->getMessage()); - } + } catch (Exception $e) { $session->addException($e, $this->__('There was a problem with the un-subscription.')); } - } + } $this->_redirectReferer(); } } \ No newline at end of file diff --git a/app/code/core/Mage/Newsletter/etc/config.xml b/app/code/core/Mage/Newsletter/etc/config.xml index c1ae63113c..cc3aaa08cf 100644 --- a/app/code/core/Mage/Newsletter/etc/config.xml +++ b/app/code/core/Mage/Newsletter/etc/config.xml @@ -161,27 +161,27 @@ - + Newsletter Section - + Newsletter 60 - + Newsletter Problem Reports - + Newsletter Queue - + Newsletter Subscribers -