diff --git a/.htaccess b/.htaccess
index 2ea2a09ca8..60e17952c8 100644
--- a/.htaccess
+++ b/.htaccess
@@ -144,6 +144,13 @@
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
+############################################
+## redirect for mobile user agents
+
+ #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
+ #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
+ #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
+
############################################
## always send 404 on missing files in these folders
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index b54e748dbc..b9dd15ad63 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,588 @@
+==== 1.7.0.0 ====
+
+=== Major Highlights ===
+Optimized Layered Navigation for pricing
+Added CAPTCHA support for admin and customer users
+Added different base price per customer group
+Added auto generation of coupon codes
+Improved the basic Backup and Rollback functionality
+Added EU VAT ID validation service integration
+Implemented DHL for Europe
+Added REST API
+Mobile theme was redesigned
+Implemented the frontend Cookie Restriction functionality (EU cookie law compliance)
+Added the Cash On Delivery and Bank Transfer payment methods
+
+=== Improvements ===
+XmlConnect package release v22.1
+Upgraded TinyMCE to v3.4.7
+Added the ability to translate action array parameter nodes in the layout.xml
+Added the support for using custom currency symbols
+Added the functionality for cleaning old cache files by cron tasks
+Refactored rules-based modules
+Improved customer address handling for PayPal Express checkout
+Added the ability to customize a store logo in emails from an admin
+Refactored the escaping functionality used for translations
+Added the ability to turn off/on IP tracking (e.g. 'Placed from IP', displayed on the order-related pages in the backend)
+Provided the logic for disabling ACL resources in configuration files
+Added additional placeholders for extension developers
+
+=== Changes ===
+Added support for "memcached" PHP extension
+The js/scriptaculous/dragdrop.js library is upgraded to version 1.9.0
+Files in .jpg format are allowed to be used for a favicon
+Added the ability to extend the list of attributes in the SELECT query for categories loaded via Mage_Catalog_Model_Resource_Category_Flat::_loadNodes()
+Added changes to lib/Varien/Http/Adapter/Curl.php to provide interface for setting different cURL options
+Displaying State or Province can be optional for any country
+Added the ability to get Magento type from Mage.php
+
+=== Fixes ===
+Fixed: Impossible to reset Customer Password via link in Forgot Password email template
+Fixed: Reference to non-existing class Mage_Catalog_Block_Seo_Searchterm
+Fixed: System can't find page by the URL when Payflow Link PayPal payment method used
+Fixed: Grammar issues reported by community
+Fixed: Layout is broken for PDF documents, values are overlapped
+Fixed: Admin Notifications in backend should not appear again after it been removed or marked as read
+Fixed: Reference and contents information is absent in the shipping label for DHL
+Fixed: Include commented rewrite rules to .htaccess
+Fixed: Shopping Cart is cleared after pressing "Enter"
+Fixed: Group Name of "Not Logged IN" Customer Groups is removed automatically after saving
+Fixed: Not possible to assign one picture to two products (Media Storage = Database)
+Fixed: Exception in shop when accessed by Googlebot
+Fixed: SLI for DHL used credentials only from the default configuration scope
+Fixed: Old copyright data and system version exist in page footer
+Fixed: CMS widgets: Required validation for drop-down "Type" and "Design Package/Theme"
+Fixed: On "New Widget Instance" page, drop-down "Type" doesn't have required validation
+Fixed: Auto-redirect to Base URL = Yes with correct behavior may cause problems when secure URL is hardcoded
+Fixed: Enable Qty Increments on global config has higher priority than product config
+Fixed: Short open tag in app/design/adminhtml/default/default/template/currencysymbol/grid.phtml
+Fixed: UPS, FedEx and DHL methods should work if zip code from/to isn't required
+Fixed: No ability to cancel Partial Authorization checkout with Authorize.net in the frontend
+Fixed: Incorrect displaying of the "New User" page
+Fixed: Multiple warnings in system.log after running compilation process
+Fixed: Session is lost while redirecting from secure to unsecure URL
+Fixed: Redirect to base URL should consider full request URI string
+Fixed: Product name with <> processed incorrect during creation order in backend
+Fixed: FedEx SmartPost method doesn't appears in rate request
+Fixed: 3 and 4 digits CVV should be accepted for JCB cards
+Fixed: Google Checkout tax isn't applied to Bundle product
+Fixed: FPT is not considered by Google Checkout
+Fixed: An error occurred during second Customer authorization fail
+Fixed: Property declaration typo in Mage_Bundle_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option
+Fixed: Product is not shown in the Catalog when it is Out of Stock and Display Out of Stock Products = Yes
+Fixed: Impossible download downloadable product (problem with secure link)
+Fixed: Wrong letter case in class names may cause malfunction when Compiler is enabled
+Fixed: Incorrect invoice amount in order with FPT
+Fixed: Attributes not connected to any product of selected category display in layered navigation
+Fixed: No feedback on creating attribute set in IE9 and IE8
+Fixed: Unexpected breaking import process leads to creation phantom data into database
+Fixed: Two of the same FedEx option show instead of one
+Fixed: Notification for Google contains link that cover large area and blocked user work
+Fixed: Possible to create user role with empty name if it starts with "less than" sign
+Fixed: Impossible to use Clear Shopping Cart button in IE7
+Fixed: Impossible create product with one FPT price for all State/Province
+Fixed: 'Interval Division Limit' affects to global displaying of Layered Navigation
+Fixed: Shipping method must be recalculated on Order Review page if Transfer Shipping Options is enabled
+Fixed: Issue with different secure/unsecure URL cause session data lost
+Fixed: Can't save option Country in Store Information Tab
+Fixed: Rule date information has been missed after using Product Rule or Shopping Cart Price Rule
+Fixed: Billing/Shipping address algorithm for PayPal Express checkout works incorrect
+Fixed: Error during quick search
+Fixed: Block "Description" on Catalog Price Rule page has incorrect size
+Fixed: Search doesn't work if Maximum Query Length field is empty
+Fixed: The Tags Product RSS doesn't update information after changing tag
+Fixed: Customer Attributes and Customer Address Attributes validation
+Fixed: Issue with final price calculation for Configurable product with sub products
+Fixed: Blank page after customer registration with enabled compilation
+Fixed: "Place Order" button must be enabled if all required fields passed the validation on PayPal Express Checkout
+Fixed: Products quantity displays incorrect in price ranges after import (rounding problem)
+Fixed: Layout issue in shopping cart on frontend (IE8)
+Fixed: Impossible to assign user to the role if he is assigned to another role
+Fixed: 'Total records found' on Reports -> Tags -> Popular page shows wrong quantity of records
+Fixed: Unable to refresh lifetime statistics
+Fixed: After changing Price Navigation Step calculation from Automatic(eq price range) to Automatic(eq prod count) the category is loaded very slowly
+Fixed: No ability to create Shipping Label (in case with USPS First-Class Mail International Parcel method)
+Fixed: It is impossible to create Shipping Label for FedEx
+Fixed: Redirect Customer to Account Dashboard after Logging is in enabled and doesn't work for Wishlist
+Fixed: No ability to edit values using mass actions for product in IE8, IE9
+Fixed: Wrong message during checkout process in Inline Translate mode
+Fixed: Default country is selected in Shipping Address during Admin order creation
+Fixed: The Static block widget doesn't displayed on the Product View Extra hint for bundle product
+Fixed: Bunch of W3C validation errors on frontend while using inline translate
+Fixed: Product's association to root category is lost after export/import
+Fixed: WYSIWYG Editor: Page is scrolled to the top after inserting variables
+Fixed: Incorrect Backup/Rollback message
+Fixed: FedEx Free shipping doesn't work correctly
+Fixed: Configurable product displaying double price when choosing option
+Fixed: Impossible to configure Admin User Emails for store view scope
+Fixed: Long payment method data is printed improperly in PDF invoice
+Fixed: Impossibility of changing the Rating Value title for store view in existing Rating Value with filled the Rating Value title for store view
+Fixed: Trademark symbol not showing up
+Fixed: Add "Delivery Option" for FedEx Configurations
+Fixed: Saving product takes long time
+Fixed: Notice message disappear after clearing cache
+Fixed: Products qty displays incorrect in price ranges after import (rounding problem)
+Fixed: Images in CSS fail when merging CSS files
+Fixed: Mass action update of any attributes resets multi-select attributes to NULL
+Fixed: Move CSS from Prototype Windows plug-in to the backend skin
+Fixed: DB adapter should check transaction level in case of DDL query
+Fixed: When Payment method additional info contains double quote it is displayed as '"' in invoice PDF
+Fixed: Incorrect Unit Price(Excl. Tax) in the Shopping Cart Grid after changing currency
+Fixed: Incorrect total quantity of records and pagination doesn't work on Reports->Reviews->Products Reviews page
+Fixed: Incorrect title of All Reviews for product page
+Fixed: Invalid message in shopping cart when trying to add products amount more than allowed
+Fixed: Layered Navigation: Icon "Previous" should be appear only on sub-intervals level
+Fixed: Processing error occurred when big numeric value is entered to an browser URL
+Fixed: Issue with credit memo for multiple bundled products (order status is Processing)
+Fixed: Customer group has to be emulated even if customer is sticky assigned to the group
+Fixed: "Customs Value" isn't represented in store base currency
+Fixed: Layered Navigation: After clicking on interval $0.00, should be filtered and displayed products with price 0.00
+Fixed: Absence of redirecting to the grid page after saving Role/User
+Fixed: Incorrect logic of assignment of unique ID in Varien_Data_Collection
+Fixed: Problems with sorting actions
+Fixed: When product is set to be not available for selling checkout is still possible depending on its position in cart
+Fixed: Impossibility of creating new order with "Reorder" button when Out of stock or disabled products had been ordered
+Fixed: "Online Minute Interval" customer configuration option should have global scope
+Fixed: Unable to translate Active/Inactive in promotions grid
+Fixed: Response headers contains 500 error during frontend pages browsing
+Fixed: Add additional button to PayPal Redirect Page
+Fixed: Category Permissions: if "Display Product Price" is set to "No" the page toolbar is absent
+Fixed: Layered navigation options have wrong order in backend
+Fixed: The "Remember Me" check box with the "What's this?" link should be located below the "Forgot Your Password?" link
+Fixed: Warning message is absent, when "Recovery Link Expiration Period" is specified within the correct range
+Fixed: PayPal HSS (Website Payment Pro Hosted Solutions) France doesn't work
+Fixed: Remove email from Billing address section of the PayPal Express Order Review page
+Fixed: It is available enter negative digits in the "Layered Navigation Price Step" (on Category page)
+Fixed: First/Last Name algorithm for PayPal Express checkout
+Fixed: Asterisk isn't imported in Zip/Post Code field
+Fixed: Some strings are not translated in widgets
+Fixed: Session isn't stored between secure and unsecure URLs when they are located in different paths of the same domain (no SID in request)
+Fixed: "USPS First Class International Parcel" will not show up as an option for customers during checkout
+Fixed: UPS, FedEx and DHL methods should work if zip code from / to isn't required
+Fixed: Issue when trying to create an order from the backend without selecting the state/province
+Fixed: HTTP error when uploading images from a MacOS with shockwave flash 11.1.102.55
+Fixed: UPS Configuration "All Methods" should be selected by default
+Fixed: Cannot create a product review through backend
+Fixed: Typos in Role Permission tree
+Fixed: WYSIWYG button layout issue on product page
+Fixed: Require Customer's Billing Address is missing option "For Virtual Quotes Only"
+Fixed: Errors appears on Design Configuration page if transactional email's logo image and/or favicon files were deleted
+Fixed: State/Province value is reset after page reload on some forms
+Fixed: Cannot access backend after switching on and switching off "Use Custom Admin URL"
+Fixed: "Unsubscribe Selected" and "Delete Selected Problems" buttons don't work
+Fixed: After selecting shipping from dropdown system doesn't update order data automatically on PayPal Express Order Review page
+Fixed: Buttons on the backend order page don't have titles
+Fixed: ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION error in Chrome browser
+Fixed: Changes related with Apply and Discount Amount options for sub item, applied after clicking "Save Rule" button
+Fixed: Invalid Timezone error for Asia/Calcutta when changing default country to India
+Fixed: Sorting by position doesn't work for up-sells and related products
+Fixed: Absent validation for "Only X left Threshold" field
+Fixed: Shipping method calculation based on default shipping address instead of 'Same as billing' setting in backend
+Fixed: There is no validation of the field "Handling Fee" that allows number less than zero in UPS shipping method
+Fixed: Product name with "<>" processed incorrect during creation order in backend
+Fixed: Billing Address Line is always blank if "REQUIREBILLING = 1" for PayPal Express
+Fixed: Configuration->Inventory->Qty Increment isn't validated properly
+Fixed: Absent message about not enough quantity for bundle and configurable products
+Fixed: Wrong behavior of split buttons in IE8
+Fixed: Warning message appears after unselecting user in the Role Users grid
+Fixed: Incorrect total weight calculation in external shipping methods for products with decimal Qty Increments
+Fixed: Tax calculation is incorrect if configurable product mixed up with other composite products in the shopping cart for Store Tax != Customer Tax
+Fixed: Products qty displays wrong in layered navigation after changing currency
+Fixed: Billing address fields are editable if "Same as shipping" selected on the PayPal Express order review page
+Fixed: Incorrect location of "Clear All" link
+Fixed: Incorrect price for bundle fixed product with custom option % and catalog price rule applied
+Fixed: Import/Export: Append Complex Data works incorrect for customer's address and product's customs data
+Fixed: Discount changes subtotal when FPT is active
+Fixed: There is no ability to specify backup's name
+Fixed: Multi selections fields for website scope settings are greyed out
+Fixed: Persistent Shopping Cart: After deleting customers via backend, on frontend customer should be logout completely
+Fixed: Incorrect logic during dividing products into multiple boxes for shipping
+Fixed: Polls are not working properly in case with different domains for http and https
+Fixed: "Block Reference" drop-down contains wrong list of options for frontend Apps types with Products
+Fixed: "Wrong store specified" appears on order creation page
+Fixed: Customer can't continue Checkout process after selecting Billing Address
+Fixed: Refresh Statistics gone from Reports Role
+Fixed: USPS shipping label is printed with "SAMPLE - DO NOT MAIL" sign
+Fixed: Shipping methods are not refreshed after Update Order Data is pressed on PayPal Express Order Review page
+Fixed: Product still invisible in frontend after required re-index
+Fixed: JS error on configurable products
+Fixed: Configurable product missing name in error message when exceeding quantity during order
+Fixed: Added Display Product Count on the Layout Navigation
+Fixed: "FedEx Priority Overnight" shipping method isn't calculated correctly
+Fixed: Incorrect product price for Bundle products with fixed prices in the shopping cart
+Fixed: "Ship Bundle Items" for bundle product works incorrect
+Fixed: Impossible to expand settings accordions on the "Design Settings Editor" tab of Theme Customization page under IE7
+Fixed: Impossibility to configure Bundle product with Disabled status and create new order with it in the backend
+Fixed: Customer email isn't saved in Account Information field
+Fixed: Unable to sort products by price
+Fixed: Errors during creating/extracting "tar" archive with symbolic links
+Fixed: Wrong message text in "Manage Coupon" tab on Shopping Cart Price Rule page
+Fixed: 404 page not found error occurs when "Default Store" value is changed for Main Website
+Fixed: Unable to import products if Catalog price rule enabled
+Fixed: Partial Re-index isn't done for product saved in backend
+Fixed: Catalog Price Rule: "Save and Apply" action leads to apply ALL rules, but it have to apply only specified rule
+Fixed: Tax isn't recalculated on PayPal Express
+Fixed: Backup Name field should allow entering only a limited number of characters
+Fixed: In the "Subtotal" row of "Coupons Usage Report" displayed amounts for all Shopping Cart Price Rule in the system
+Fixed: Shipping address isn't passed to Magento from PayPal
+Fixed: Store view isn't changed when customer subscribes for newsletters
+Fixed: Shopping Cart Price Rules are not marked after creating Coupons Usage Report
+Fixed: Change buttons structure in prototype/windows.js to match general adminhtml buttons structure
+Fixed: Wrong error message on Create New Order page in backend
+Fixed: Impossible to configure order of displaying rating values in the frontend
+Fixed: Incoming Message in Admin Part has the superfluous symbol '\'
+Fixed: Numerous issues with promotions on complex products
+Fixed: Recipient Postal-State Mismatch error seen on Shipping Label with FedEx
+Fixed: Text messages "This is a required fields." are displayed in the hidden FTP section
+Fixed: Incorrect popup on Manage Coupon Codes tab in Shopping Cart Price Rule
+Fixed: Layered navigation work incorrect if attribute values defined on Store View level
+Fixed: Checking import file returns blank page
+Fixed: Change the VAT Number format before sending to VAT ID Validation service
+Fixed: Simple products with configured customs options displayed in wishlist incorrectly
+Fixed: Incorrect text message for product for which there is no enough quantity in stock
+Fixed: Setting float Qty Increments is possible, but doesn't work
+Fixed: SQL error during checkout when customers register at checkout and orders a nominal item
+Fixed: Iframe for gateway isn't reloaded on the Payment information tab
+Fixed: Incorrect behavior after placing order from backend in FF9
+Fixed: Catalog price rule skips conditions specified and applies to all products in the catalog
+Fixed: Price rule is applying to individual items in bundle when price is set to Dynamic
+Fixed: Impossible to save payment method configurations on the Default Config scope
+Fixed: "There has been an error processing your request" message is display if not CSV file was selected to import
+Fixed: Wrong reindex product attributes after bundle product save
+Fixed: Add Products button absent during creating order from backend
+Fixed: "All methods" should be selected by default in configuration section "Allowed Methods" for UPS
+Fixed: Redirect to base URL issue
+Fixed: Added Backup sorting by name possibility
+Fixed: Fix grammar mistakes
+Fixed: Notifications are not shown if URL Rewrite used
+Fixed: "Stop Further Rules Processing" option doesn't work
+Fixed: Admin cannot un-assign product from the tag if already approved tag was added to the product by customer
+Fixed: Inaccuracy calculation could be 10% for FedEx International Ground shipping
+Fixed: Incorrect price calculation of configurable product with custom options (resolved conflicts)
+Fixed: Wrong currency displayed in Recently Viewed Product App
+Fixed: Tabs are grayed on admin dashboard
+Fixed: JS validation for product weight attribute doesn't work
+Fixed: Group Price attribute is present as text field using the mass update action
+Fixed: Shopping Cart Price Rule isn't applied to Not Logged In Customers
+Fixed: "Sign up for our newsletter" text appearing twice
+Fixed: Newsletter problem report grid on backend throws Exception
+Fixed: Special price doesn't work for Bundles with Dynamic price
+Fixed: My Orders block disappears in My Account pages when Reorder functionality is disabled
+Fixed: Search doesn't work in Backups grid
+Fixed: Re-index "Catalog URL Rewrites" works extremely slowly
+Fixed: Checkbox state is preserved for "Put store on the maintenance mode while rollback processing"
+Fixed: UPS Configuration All Methods Should Be Selected by Default
+Fixed: Rollback fails if database backup was performed after product import
+Fixed: Incorrect behavior with 10-digit Zip code, after creating new Tax Rate
+Fixed: Configurable attributes that used for create configurable product should not be applied to that product
+Fixed: Default group has to be used if customer selects address without VAT number
+Fixed: No ability to create Shopping Cart Price Rule
+Fixed: Layout issue appears in IE9 on the export grids
+Fixed: Issue when trying to view the order using a specific admin user
+Fixed: System messages are not displayed at CMS pages and appears only when another message will be invoked
+Fixed: On the frontend Search doesn't work properly if search value is 0 (null)
+Fixed: The size of the columns in Backup grid is changed if no records were found
+Fixed: Maintenance flag isn't deleted if rollback fails with not enough permissions error
+Fixed: Customer's group isn't changed if his billing address modified within backend
+Added Add a message and the link in the mini shopping cart, when the cart is empty
+Fixed: On Edit Shipping Address page button "Validate VAT Number" should be hidden
+Fixed: Fatal error when try to ship order with Flat Rate shipping method
+- fixed potentially problematic chaining involved getShippingCarrier method
+Fixed: No ability to open PDF file with Label
+Fixed: Incorrect final price for configurable products if several custom options used
+Fixed: "Length", "Width" and "Height" fields on "Create Packages" pop up are active, when "Documents" type is selected in IE7 and IE9
+Fixed: HTTP 500 error on frontend for bundle fixed with percent options enabled for sub-products
+Fixed: Shipment created on Magento side doesn't send to Google side for Merchant Calculated shipping
+- added check for process only Google Checkout internal methods
+Fixed: PDF files for invoices and credit memos are not displaying Including Tax Price
+Fixed: Default value that was specified in system settings doesn't presented in Code Format drop-down on Manage Coupon Codes tab
+Fixed: Qty wipes out to 0 when no qty column is included on import
+Fixed: Broken controls makeup is observed after resizing window when customer's page is opened on the backend
+Fixed: Values don't fit to "Date Fields Order" drop-downs in "Date & Time Custom Options" on the Catalog page
+Fixed: Processing error appears for products with "Qty Uses Decimals" = No and enabled DHL International
+Fixed: Apply Tax to FPT setting doesn't seem to work for products with Fixed Product Taxes
+Fixed: Apply Coupon Code textbox doesn't fit in the Apply Coupon Code channel on the backend after reducing the browser window
+Fixed: Tax and Shipping amounts aren't showing on the merchant reports for Websites Payments Pro PayFlow Edition
+Fixed: Incorrect error popup on Manage Coupon Codes tab in Shopping Cart Price Rule
+Fixed: No ability to create Shipping Label with New DHL shipping methods
+Fixed: Indexing update on save takes too long for large catalog_product_entity_int tables
+Fixed: VAT ID group validation takes Default configuration on order creation from backend
+Fixed: Pagination isn't shown on My Product Reviews page when items count exceeds the "Show per page" setting
+Fixed: Inline translation missing for customer account information labels
+Fixed: Corrupted text if drag attribute on Manage Attribute Sets page (IE8)
+Fixed: Wrong calculation price of Bundle product with Fixed price, when special price is configured
+Fixed: Error Message isn't displayed during unsuccessful Shipping Label creation
+Fixed: Unverified redirect is possible in Checkout controller
+Fixed: Customer group in not validated again on checkout if Tax Calculation Based on = Shipping Address
+Fixed: "Clear All" link doesn't work
+Fixed: Wrong message appears when products quantity is updated in the Shopping Cart with enabled Qty Increments setting
+Fixed: Created On field on Manage Coupon Codes grid shows incorrect date/time
+Fixed: Incorrect price calculation of configurable product with custom options
+Fixed: Manage Products > Custom options: Should be possible to enter negative price for custom option of 'Date' type
+Fixed: HTTP 500 Internal Server Error on Admin Forgot Password page
+Fixed: CSV/Excel XML export doesn't work on Sales->Invoices if filter by Selected=Yes is used
+Fixed: "Same As Billing Address" check-box doesn't work
+Fixed: Impossible to enter zero in the base price field for customer groups
+Fixed: Group Price attribute position on the Prices tab is incorrect
+Fixed: Add new column to the grid with number of used coupons
+Fixed: Custom options are not stored when downloadable product is duplicated
+Fixed: Broken logic for "Zero Subtotal Checkout" order statuses
+Fixed: Coupon codes generation fails when trying to generate large amount of codes
+Fixed: PayFlow Link: Using "Pay with PayPal" and selected shipping method that is greater than 0 doesn't process order
+Fixed: User have to stay on Add New Rule page if error appears on save shopping cart price rule
+Fixed: "Automatically Invoice All Items" should be inactive, when were selected "New Order Status: Pending" in "Zero Subtotal Checkout" settings
+Fixed: When enormous request in search fields on the front end 414 error appears
+Fixed: JS error on edit Shopping Cart Price Rule Page
+Fixed: Clear Shopping Cart button add selected item to Items Ordered if check box "Add to Order" is selected
+Fixed: "Clear Shopping Cart" button must be located to the left to "Update Shopping Cart" button
+Fixed: Export of Group Price data doesn't work
+Fixed: Incorrect translation messages definitions
+Fixed: Error message isn't displayed if currency exchange rate not found (in case with DHL Int)
+Fixed: User role with partial access can't edit attributes of configurable products
+Fixed: Letter "n" missed in the word "handling"
+Fixed: Buttons don't react for pressing on the "Widget Options" section in Insert Widget window
+Fixed: Regular price displays incorrect
+Fixed: {{base_url}} in (un)secure_url doesn't work since 1.6.1
+Fixed: Product selection field gets cleared out with recently added products from latest page
+Fixed: "Change" button while checkout doesn't work
+Fixed: MySQL BIGINT field type is wrongly casted to integer
+Fixed: Magento Connect Manager proceed with installation of extension if error appears on database backup
+Fixed: "Set product as New from/to Date" works excluding selected dates
+Fixed: Function fireEvent from lib/varien/js.js does not work in IE9
+Fixed: Searching with first and last name has no results
+Fixed: CMS Pages: Error in IE7 when select CMS page
+Fixed: White screen appears instead of 404 Error Page when going to review a product which doesn't exist
+Fixed: "Maximum Package Weight" option works incorrect in case with decimal Qty in shopping Cart
+Fixed: Unable to create tables for new EAV entity via SQL upgrade script
+Fixed: Customer group isn't revalidated on checkout if Enable Automatic Assignment to Customer Group = Yes
+Fixed: Mistake in PayPal Payments Advanced field set title
+Fixed: Zero Subtotal Checkout payment method is used, when it is disabled in settings
+Fixed: Some info lost from address when customer sets this address as default for shipping
+Fixed: Incorrect calculation logic during distribution products between several pieces (in case with DHL)
+Fixed: No ability to get shipping rates from US to another country (in case with DHL)
+Fixed: Incorrect calculation of pieces weight (in case with Bundle Product)
+Fixed: Product Flat Data index causes replication lag on MySQL master/slave model
+Fixed: Exception is shown, when admin user provides filtration of Newsletter problem reports by Subscriber
+Fixed: Typo in JavaScript error message
+Fixed: Unable to do mass action update for products
+Fixed: Error Message isn't displayed if currency exchange rate not found (in case with DHL)
+Fixed: Weight field is absent during Quick simple product creation
+Fixed: correct helper resolving
+Fixed: Shipping methods are shown twice in DHLs shipping quote
+Fixed: Unable to translate shipping and billing forms on the order creation page
+Fixed: Drop-down attribute with layered navigation filter doesn't work with value is set to 0
+Fixed: Free Shipping options don't work (in case with DHL)
+Fixed: Handling Fee doesn't applied Per Package
+Fixed: Free Shipping options works incorrect
+Fixed: WYSIWYG Editor: It's impossible insert Widget to CMS page content
+Fixed: Customer's group is not changed if his billing address modified within backend
+Fixed: Wrong behavior and exception while using invalid image
+Fixed: Uninformative error message during saving two nodes with the same parameter URL Key
+Fixed: Unable to change order addresses in the admin panel
+Fixed: PayPal Express always uses default billing address from customer account
+Fixed: Unable to place order if customer selects Register on checkout
+Fixed: Performance Issue: Most Viewed product reports on large amount of items
+Fixed: In "Customer Addresses" block before and after of State name is located symbols ","
+Fixed: Lightbox 2.5 with IE7 returns JS error on the page
+Fixed: Unable to change customer status (confirmed/not confirmed) when customer logged in
+Fixed: Incorrect notification for empty field during creation catalog price rules
+Fixed: Unable to save product with non-checked multiple select attribute
+Fixed: Package Size setting for DHL
+Fixed: No Input Validation for Catalog Fields
+Fixed: Row Total Calculation in Refund
+Fixed: "Maximum number of price intervals" should be written with capital letters
+Fixed: Divide Order Weight options for DHL
+Fixed: Impossible to create new customer in the backend
+Fixed: Catalog data-upgrade-1.6.0.0.4-1.6.0.0.5.php is extremely slow
+Fixed: Mage_Catalog_Helper_Product::getProduct() doesn't load product by its SKU
+Fixed: Preview Template doesn't work correctly
+Fixed: Some options of Bundle Product disappeared from the Invoice PDF
+Fixed: "Allow Countries" affects on "Country of Manufacture" attribute
+Fixed: Some phrases are not translated
+Fixed: Incorrect Ordered Qty in Order (in case with decimal qty)
+Fixed: Trademark character isn't being displayed properly in the PDF invoice
+Fixed: Can't search transactions by order_id in manager.paypal.com
+Fixed: Inline Translation: Grid headers are displayed incorrect on the Tag Edit page
+Fixed: "Create Extension Package" page becomes broken after compilation
+Fixed: Price including tax isn't displayed for some kinds of bundle products
+Fixed: Layered navigation for prices displays incorrect price ranges in manual mode
+Fixed: Pager works wrong with float page number
+Fixed: Incorrect foreign key for EAV entity tables
+Fixed: Misprint in downloader/lib/Mage/Connect/Command/Install.php
+Fixed: URL Rewrites must be case-sensitive
+Fixed: Unable to install package via uploader if author name contains dash
+Fixed: Invoice subtotals for cases with partial invoice and discount
+Fixed: Catalog URL Rewrites works incorrectly on creating categories
+Fixed: New Oder Status setting, specified for payment method works incorrectly when only virtual products are present in Order
+Fixed: Rounding issue in catalog and product view if price includes tax
+Fixed: Wrong status of catalog event is displayed by editing catalog event
+Fixed: Role Resources are not saved
+Fixed: "Qty for Item's Status to Become Out of Stock" option works incorrect
+Fixed: XML parser works incorrect
+Fixed: Mage_Reports_Model_Mysql4_Product_Index_Abstract must be declared abstract
+Fixed: "Date & Time" and "Time" custom options becomes required when editing product
+Fixed: Unable to cancel an order for an expired Authorize.net authorization
+Fixed: Custom options are not stored when downloadable product is duplicated
+Fixed: "Cannot initialize the indexer process" error during Mass "Reindex Data" Action
+Fixed: Search by new attribute fails, attribute is not shown in layered navigation
+Fixed: Exception when "Price Navigation Step Calculation" set to "Manual" mode and FPT enabled
+Fixed: WPPHS: Cancel URL doesn't work as should be
+Fixed: Error about insufficient permissions is not appears on database backup creation
+Fixed: After rollback admin doesn't redirected to the Log in to Admin Panel page
+Fixed: Database Backup must not include indexer table data
+Fixed: Scheduled Backup creation/failure isn't logged
+Fixed: Deleting backup while it is used by another process
+Fixed: Opening *.tar files causes an error "There are no trailing zero-filled records"
+Fixed: Unable to search by "Time" and "No" in Backups table
+Fixed: Backups are deleted without confirmation
+Fixed: Reports must be excluded from database snapshot backup
+Fixed: There are no products in filtering results, if step calculation in automatic mode
+Fixed: No validation for "Default Price Navigation Step"
+Fixed: "Back" button doesn't work on the Create New Order page
+Fixed: Incorrect logic of Token expiration in Two Step Password Reset flow
+Fixed: Tag is present in tool-tip for field "Number of results (For the last time placed)" on the Edit Search page
+Fixed: Unnecessary hard code in Magento Extension
+Fixed: Wrong logic in Mage_Core_Model_Resource_Db_Collection_Abstract::join()
+Fixed: Description and Short Description are displayed incorrectly for products added with WYSIWYG
+Fixed: Adding product to the cart from the product review page leads to 404 page
+Fixed: Special symbols in Sort Order field
+Fixed: Text is wrong displayed with enabled Inline translation for Admin on backend
+Fixed: Inline Translation: Unable to translate some customer information
+Fixed: Useless colon on frontend login page
+Fixed: Unable to continue checkout for product with zero price and non-zero shipping price
+Fixed: Import news_from_date field is configured poorly. It is not accepting the data from file
+Fixed: When updating product data through import, attributes that have a value cannot be assigned a new value that is empty
+Fixed: Unable to replace non-complex data for products with empty values during import
+Fixed: "Wrong order ID" exception in PayPal Express module under heavy load
+Fixed: Tax is applying on the order when creating it in the admin panel for a Customer Group with no taxes
+Fixed: Issue with retrieving order statuses for array of states
+Fixed: Wrong calculation product price with custom option type = Field and Fixed price
+Fixed: Back ordered downloadable product is not available even when it is set to be be accessible when order status is Pending
+Fixed: Missing column "position" at table catalog_category_anc_products_index_tmp
+Fixed: Incorrect behavior of "Save in address book" option during admin Order creation for a new customer
+- refactored Mage_Adminhtml_Model_Sales_Order_Create::_prepareCustomer()
+Fixed: Terms and Conditions is named differently on different pages
+Fixed: "Apply" and "Discount Amount" fields appear twice in the Catalog Price Rule
+Fixed: Poll shows incorrect percentage
+Fixed: Added validation ability for admin configuration forms
+Fixed: UPS XML misprint
+Fixed: Misprint in uploading files form
+Fixed: Unnecessary check boxes for gift options
+Fixed: Wrong resource section declaration in Mage_Tag module
+Fixed: "Customers Submitted this Tag" section doesn't update when customer has deleted tag from his account
+Fixed: Correct product in category position
+Fixed: Unable to create folder in Media Storage
+Fixed: Translation with single quotes breaks JavaScript
+Fixed: Out of memory error with hundreds of thousands of coupons attached to a single sales rule
+Fixed: Unable to translate buttons and tabs on the "Manage Category" page
+Fixed: Product Categories Tree doesn't expand in Manage Products page
+Fixed: Incorrect products qty returns to stock after refund for configurable product
+Fixed: Swf Uploader problems with cross domain Flash Player Policy
+Fixed: Unable to translate "Layout Updates" block on create/edit widget page
+Fixed: IE7: "Remember Me" checkbox visible on billing information step
+Fixed: CMS WYSIWYG Editor - widget is inserted as new while editing in IE8
+Fixed: Currency code doesn't correspond to the amount in reports
+Fixed: Mage_Adminhtml_Block_Sales_Order_View_Tab_History::getFullHistory() doesn't use unique keys for each message
+Fixed: Scope labels are shown without translate wrapper
+Fixed: Wrong parameters handling in Core Helper formatDate()
+Fixed: Apostrophe in store name breaks Google Analytics tracking
+Fixed: Customer attribute prefix is not shown on frontend
+Fixed: Incorrect rounding for product with custom options (percent price)
+Fixed: Invoicing only part of products results in wrong totals calculation
+Fixed: Incorrect Row Total Calculation in Refund
+- fixed rounding issues for partial Invoice and Refund
+- refactored delta rounding
+Fixed: Filter by "Allow Countries" not working for Customer Address Form in the backend
+- checking added for set country to be in available list
+Fixed: There are sql-installs with empty string used as defaults for table columns, while column is not null able
+Fixed: Unable to translate "Note" in "Product Stock Options"
+Fixed: Various warning are displayed after creating shipment for 0 items
+Fixed: Invalid content in Content-header in the top of page during scrolling during order creation
+Fixed: "Online invoice" button present in backend when using Zero Subtotal Checkout
+Fixed: String cast type in in_array function
+Fixed: Newsletter template content should not disappear when "Show" / "Hide Editor" button was clicked
+Fixed: Import feature doesn't validate whether super_products_sku is existing or not
+Fixed: Cannot place order with downloadable product and discount code using Paypal Express payment method
+Fixed: Product still out of stock after Stock Status reindex
+Fixed: Save catalog price rule gives trace if full reindex has already started
+Fixed: Reindex requires notification is not shown for Stock Status when stock is updated for several products using Mass Action
+Fixed: Incorrect FedEx's shipping rates (in case with non-US country origin)
+Fixed: After partial reindex MSRP value is not applied (not viewed) in catalog during mass update action
+Fixed: Wrong stock reindex on catalog if partial reindex done after full reindex started
+Fixed: In error message string "already exists." written twice, when trying to save Product Tax Class with the same name
+Fixed: Slow checkout with non-flushed cache
+Fixed: Bundle product total is incorrect in Customization block
+Fixed: Special price isn't considered for bundle dynamic products in "Your Customization" block
+Fixed: Situation when any amount of duplicate reindex process can be running at one time
+Fixed: Error with Advanced Search (in case with Date Attribute)
+Fixed: Product Flat Data index isn't marked as "Reindex Required" after importing products when Flat Catalog is enabled
+Fixed: User can't change root category for the store
+Fixed: JS error causes the overwrite of Title field in PayPal Advanced configuration
+Fixed: Mass action doesn't partially reindex catalog for product name/description
+Fixed: Remove hint about $1 auth amount from informational message text (PayflowLink configuration)
+Fixed: Mass action doesn't partially reindex catalog for product prices
+Fixed: PayPal Payments Advanced works with $0 Auth instead of Full Auth
+Fixed: Impossible to place Order using "Pay with PayPal" button from PayPal Payments Advanced iframe
+Fixed: Mass action doesn't partially reindex catalog search for product if searchable attribute was updated
+Fixed: "Please wait" AJAX screen doesn't appear in the middle of the page
+Fixed: Checkout link on frontend is always referenced as http
+Fixed: GET request is incorrectly formed during category creation
+- adjusted assertion to determine last viewed store
+Fixed: Display of Tier Pricing with Configurable Products
+- added functionality to dynamically update tier prices accordingly to chosen product configuration
+Fixed: Google Analytics e-commerce tracking not working
+Fixed: URL key isn't used when product is saved
+Fixed: Added validation class to 'Qty increments'
+Fixed: Entered from admin customer date 1970 (or less) is saved as 2070 (or less)
+Fixed: cUrl resource must be closed after checking it for errors, not before
+Fixed: Exception while products mass update attributes in backend
+Fixed: No ability to reindex Catalog URL Rewrites, error is shown
+Fixed: Package with Core dependency
+Fixed: Stock Availability isn't updated if 1: Run Price Reindex 2: Update Stock Availability on product with mass action/single product
+Fixed: Blank page instead shopping cart page when compilation and PSC are enabled
+Fixed: Unable to save redirect URL with special characters in search terms
+Fixed: Attribute Set field should have client-side validation and appropriate information message
+Fixed: "Localhost" isn't a valid domain name for installation
+Fixed: Iframe for PayPal Payments Advanced is not loaded
+Fixed: Retain the selected tab on editing CMS page
+Fixed: Payflow Link Express Checkout (pay with PayPal button) payment
+Fixed: Wrong number of reindex options is displayed
+Fixed: Wrong phpDocs for Varien_Db_Select
+Fixed: JavaScript calendar date range
+- fixed JS calendar behavior to use 4-digits year format
+Fixed: Performance issue connected with sales rules on adding product to cart
+Fixed: DHL same error message appears several times
+Fixed: Item Status says "Mixed" when an order has been completed, should say "Shipped"
+Fixed: Product option title is absent in backend order page
+Fixed: Incorrect items number during multi shipping checkout
+Fixed: User name displays differently in the unsuccessful message and in the text field label (log in form)
+Fixed: If one or more indexers have Update Required = Yes and all Status = READY for all indexers than there is no notification for user to do reindex action
+Fixed: No space between Address line 1 and line 2 in Shipping Label (in case with FedEx)
+Fixed: JS works depends on the position attributes of the product
+Fixed: Char set encoding is out-of-date in Settlement reports
+Fixed: Settlement reports can't be downloaded if in merchant's account 'Settlement file' is set to 6.0 version
+Fixed: Unable to login when secure and unsecure URLs are different
+Fixed: Customer session lost when using different domain/subdomain names for secure and unsecure URLs
+Fixed: "Most Viewed" reports ignore Store View switcher
+Fixed: Long FPT name (and product name) doesn't fit into "My cart" block
+Fixed: Paypal IPN post back failure
+Fixed: Customer was unable to receive newsletters when it was created via backend
+Fixed: Wrong Comments History in notification of order creation/cancellation
+Fixed: Non escaped string causes javascript error
+Fixed: Unable to view pictures during product editing
+Fixed: Ampersand is saved incorrect in attribute label
+Fixed: IE8: JS error appears after pressing 'Add new rule' in catalog price rules menu
+Fixed: Exception after sorting newsletter queue
+Fixed: Customer is not able to log in from URL without "www" in some cases
+Fixed: SQL error on category view with enabled and configured FPT
+Fixed: Automatic reindexing based on matched events doesn't change "Status" and "Last Run" columns at process list grid
+Fixed: Performance issue with Magento Compiler + APC results in too many I/O calls
+Fixed: Website Administrator is able to change default values
+Fixed: Some of wishlist blocks and templates still treat the collection of wishlist items as collection of products
+Fixed: Unnecessary comments in "Share Wishlist" email
+
+
+
==== 1.7.0.0-rc1 ====
=== Major Highlights ===
@@ -27,7 +612,7 @@ Provided logic to disable ACL resources through configuration files
Added additional placeholders for extensions developers
=== Changes ===
-Added "Cache On Delivery" and "Bank Transfer" payment methods
+Added "Cash On Delivery" and "Bank Transfer" payment methods
Support for "memcached" PHP extension was added
Library js/scriptaculous/dragdrop.js is upgraded to version 1.9.0
Image file of "jpg" type are allowed for favicon
@@ -1364,7 +1949,6 @@ Fixed Import feature doesn't validate whether super_products_sku is existing or
-
==== 1.6.x-devel-131783 ====
=== Major Highlights ===
diff --git a/app/Mage.php b/app/Mage.php
index 8736004b52..3dafad03a4 100644
--- a/app/Mage.php
+++ b/app/Mage.php
@@ -171,8 +171,8 @@ public static function getVersionInfo()
'minor' => '7',
'revision' => '0',
'patch' => '0',
- 'stability' => 'rc',
- 'number' => '1',
+ 'stability' => '',
+ 'number' => '',
);
}
diff --git a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-1.6.0.0-1.6.1.0.php b/app/code/core/Mage/Admin/sql/admin_setup/upgrade-1.6.0.0-1.6.1.0.php
similarity index 100%
rename from app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-1.6.0.0-1.6.1.0.php
rename to app/code/core/Mage/Admin/sql/admin_setup/upgrade-1.6.0.0-1.6.1.0.php
diff --git a/app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php b/app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php
index 1ddb1b2f54..5c75cec142 100755
--- a/app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php
+++ b/app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php
@@ -101,7 +101,13 @@ public function parse(Mage_AdminNotification_Model_Inbox $object, array $data)
foreach ($data as $item) {
$select = $adapter->select()
->from($this->getMainTable())
- ->where('url=?', $item['url']);
+ ->where('title = ?', $item['title']);
+
+ if (empty($item['url'])) {
+ $select->where('url IS NULL');
+ } else {
+ $select->where('url = ?', $item['url']);
+ }
if (isset($item['internal'])) {
$row = false;
diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php
index 33de152188..bd7bf96474 100644
--- a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php
+++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php
@@ -160,7 +160,7 @@ public function getElementLabelHtml()
{
$element = $this->getElement();
$label = $element->getLabel();
- if (empty($label)) {
+ if (!empty($label)) {
$element->setLabel($this->__($label));
}
return $element->getLabelHtml();
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php
index b4be25c478..f014593d32 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php
+++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php
@@ -30,12 +30,13 @@
* @author Magento Core Team
*/
-class Mage_Adminhtml_Block_Sales_Order_Create_Totals_Shipping extends Mage_Adminhtml_Block_Sales_Order_Create_Totals_Default
+class Mage_Adminhtml_Block_Sales_Order_Create_Totals_Shipping
+ extends Mage_Adminhtml_Block_Sales_Order_Create_Totals_Default
{
protected $_template = 'sales/order/create/totals/shipping.phtml';
/**
- * Check if we need display shipping include and exlude tax
+ * Check if we need display shipping include and exclude tax
*
* @return bool
*/
@@ -82,7 +83,7 @@ public function getShippingExcludeTax()
*/
public function getIncludeTaxLabel()
{
- return $this->helper('tax')->__('Shipping Incl. Tax (%s)', $this->getTotal()->getAddress()->getShippingDescription());
+ return $this->helper('tax')->__('Shipping Incl. Tax (%s)', $this->escapeHtml($this->getTotal()->getAddress()->getShippingDescription()));
}
/**
@@ -92,6 +93,6 @@ public function getIncludeTaxLabel()
*/
public function getExcludeTaxLabel()
{
- return $this->helper('tax')->__('Shipping Excl. Tax (%s)', $this->getTotal()->getAddress()->getShippingDescription());
+ return $this->helper('tax')->__('Shipping Excl. Tax (%s)', $this->escapeHtml($this->getTotal()->getAddress()->getShippingDescription()));
}
}
diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php b/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php
index 9f3eec68ea..2b0716ab12 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php
@@ -102,14 +102,20 @@ public function saveAction()
$customerGroup = Mage::getModel('customer/group');
$id = $this->getRequest()->getParam('id');
if (!is_null($id)) {
- $customerGroup->load($id);
+ $customerGroup->load((int)$id);
}
- if ($taxClass = $this->getRequest()->getParam('tax_class')) {
+ $taxClass = (int)$this->getRequest()->getParam('tax_class');
+
+ if ($taxClass) {
try {
- $customerGroup->setCode($this->getRequest()->getParam('code'))
- ->setTaxClassId($taxClass)
- ->save();
+ $customerGroupCode = (string)$this->getRequest()->getParam('code');
+
+ if (!empty($customerGroupCode)) {
+ $customerGroup->setCode($customerGroupCode);
+ }
+
+ $customerGroup->setTaxClassId($taxClass)->save();
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customer')->__('The customer group has been saved.'));
$this->getResponse()->setRedirect($this->getUrl('*/customer_group'));
return;
@@ -122,7 +128,6 @@ public function saveAction()
} else {
$this->_forward('new');
}
-
}
/**
diff --git a/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php b/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php
index d2051269b2..b1cacfccae 100644
--- a/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php
+++ b/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php
@@ -87,19 +87,11 @@ public function editAction()
$breadcrumb = $this->__('New User');
}
$this->_initAction()
- ->_addBreadcrumb($breadcrumb, $breadcrumb)
- ->_addContent(
- $this->getLayout()
- ->createBlock('adminhtml/permissions_user_edit')
- ->setData('action', $this->getUrl('*/permissions_user/save'))
- )
- ->_addLeft($this->getLayout()->createBlock('adminhtml/permissions_user_edit_tabs'));
-
- $this->_addJs(
- $this->getLayout()
- ->createBlock('adminhtml/template')
- ->setTemplate('permissions/user_roles_grid_js.phtml')
- );
+ ->_addBreadcrumb($breadcrumb, $breadcrumb);
+
+ $this->getLayout()->getBlock('adminhtml.permissions.user.edit')
+ ->setData('action', $this->getUrl('*/permissions_user/save'));
+
$this->renderLayout();
}
diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
index abc69335bf..627bdd8f1c 100644
--- a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
+++ b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
@@ -64,7 +64,7 @@ public function getHandler()
return $this->getData('handler');
}
- /**
+ /**
* Set webservice api controller
*
* @param Mage_Api_Controller_Action $controller
@@ -103,12 +103,11 @@ public function getController()
*/
public function run()
{
-
$apiConfigCharset = Mage::getStoreConfig("api/config/charset");
if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
// Generating wsdl content from template
- $io = new Varien_Io_File();
+ $io = new Varien_Io_File();
$io->open(array('path'=>Mage::getModuleDir('etc', 'Mage_Api')));
$wsdlContent = $io->read('wsdl.xml');
@@ -121,14 +120,11 @@ public function run()
unset($queryParams['wsdl']);
}
- $wsdlConfig->setUrl(
- htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams) ))
- );
+ $wsdlConfig->setUrl(htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams))));
$wsdlConfig->setName('Magento');
$wsdlConfig->setHandler($this->getHandler());
- $template->setVariables(array('wsdl'=>$wsdlConfig));
-
+ $template->setVariables(array('wsdl' => $wsdlConfig));
$this->getController()->getResponse()
->clearHeaders()
@@ -188,9 +184,9 @@ public function fault($code, $message)
}
/**
- * Check whether Soap extension is loaded
+ * Check whether Soap extension is loaded
*
- * @return boolean
+ * @return boolean
*/
protected function _extensionLoaded()
{
@@ -206,18 +202,18 @@ protected function _extensionLoaded()
protected function getWsdlUrl($params = null, $withAuth = true)
{
$urlModel = Mage::getModel('core/url')
- ->setUseSession(false);
+ ->setUseSession(false);
$wsdlUrl = $params !== null
- ? $urlModel->getUrl('*/*/*', array('_current' => true, '_query' => $params))
- : $urlModel->getUrl('*/*/*');
+ ? $urlModel->getUrl('*/*/*', array('_current' => true, '_query' => $params))
+ : $urlModel->getUrl('*/*/*');
if( $withAuth ) {
$phpAuthUser = $this->getController()->getRequest()->getServer('PHP_AUTH_USER', false);
$phpAuthPw = $this->getController()->getRequest()->getServer('PHP_AUTH_PW', false);
if ($phpAuthUser && $phpAuthPw) {
- $wsdlUrl = sprintf("http://%s:%s@%s", $phpAuthUser, $phpAuthPw, str_replace('http://', '', $wsdlUrl ) );
+ $wsdlUrl = sprintf("http://%s:%s@%s", $phpAuthUser, $phpAuthPw, str_replace('http://', '', $wsdlUrl ));
}
}
@@ -233,24 +229,31 @@ protected function getWsdlUrl($params = null, $withAuth = true)
protected function _instantiateServer()
{
$apiConfigCharset = Mage::getStoreConfig('api/config/charset');
- ini_set('soap.wsdl_cache_enabled', '0');
+ $wsdlCacheEnabled = (bool) Mage::getStoreConfig('api/config/wsdl_cache_enabled');
+
+ if ($wsdlCacheEnabled) {
+ ini_set('soap.wsdl_cache_enabled', '1');
+ } else {
+ ini_set('soap.wsdl_cache_enabled', '0');
+ }
+
$tries = 0;
do {
$retry = false;
try {
- $this->_soap = new Zend_Soap_Server(
- $this->getWsdlUrl(array("wsdl" => 1)), array('encoding' => $apiConfigCharset)
- );
+ $this->_soap = new Zend_Soap_Server($this->getWsdlUrl(array("wsdl" => 1)),
+ array('encoding' => $apiConfigCharset));
} catch (SoapFault $e) {
- $importMessage = "can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'";
- if (false !== strpos($e->getMessage(), $importMessage)) {
+ if (false !== strpos($e->getMessage(),
+ "can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'")
+ ) {
$retry = true;
sleep(1);
} else {
throw $e;
}
$tries++;
- }
+ }
} while ($retry && $tries < 5);
use_soap_error_handler(false);
$this->_soap
diff --git a/app/code/core/Mage/Api/etc/config.xml b/app/code/core/Mage/Api/etc/config.xml
index 695d6d6ae9..eceac462b9 100644
--- a/app/code/core/Mage/Api/etc/config.xml
+++ b/app/code/core/Mage/Api/etc/config.xml
@@ -123,6 +123,7 @@
UTF-836000
+ 0
diff --git a/app/code/core/Mage/Api/etc/system.xml b/app/code/core/Mage/Api/etc/system.xml
index 6e37ba6db0..0e1a2e80f5 100644
--- a/app/code/core/Mage/Api/etc/system.xml
+++ b/app/code/core/Mage/Api/etc/system.xml
@@ -70,6 +70,16 @@
11
+
+
+ select
+ adminhtml/system_config_source_yesno
+ adminhtml/system_config_backend_store
+ 40
+ 1
+ 1
+ 1
+
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit/Form.php b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit/Form.php
index b917c9340f..29973a1d7a 100644
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit/Form.php
+++ b/app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Edit/Form.php
@@ -26,10 +26,10 @@
/**
- * OAuth consumer edit form block
+ * Attribute edit form block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Api2
* @author Magento Core Team
*/
class Mage_Api2_Block_Adminhtml_Attribute_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles.php
index 3e69348fd6..40cbd00050 100644
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles.php
+++ b/app/code/core/Mage/Api2/Block/Adminhtml/Roles.php
@@ -25,10 +25,10 @@
*/
/**
- * OAuth consumers grid container block
+ * Roles grid container block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Api2
* @author Magento Core Team
*/
class Mage_Api2_Block_Adminhtml_Roles extends Mage_Adminhtml_Block_Widget_Grid_Container
diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php
index 0807b6b9a2..c920b856c4 100644
--- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php
+++ b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php
@@ -25,10 +25,10 @@
*/
/**
- * OAuth Consumer grid block
+ * Roles grid block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Api2
* @author Magento Core Team
*/
class Mage_Api2_Block_Adminhtml_Roles_Grid extends Mage_Adminhtml_Block_Widget_Grid
@@ -126,7 +126,7 @@ public function getRowUrl($row)
* Decorate 'User Type' column
*
* @param string $renderedValue Rendered value
- * @param Mage_OAuth_Model_Token $row
+ * @param Mage_Api2_Model_Acl_Global_Role $row
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
* @param bool $isExport
* @return string
diff --git a/app/code/core/Mage/Api2/Model/Auth/Adapter/Oauth.php b/app/code/core/Mage/Api2/Model/Auth/Adapter/Oauth.php
index c8a437bb26..feccb16ab9 100644
--- a/app/code/core/Mage/Api2/Model/Auth/Adapter/Oauth.php
+++ b/app/code/core/Mage/Api2/Model/Auth/Adapter/Oauth.php
@@ -43,15 +43,15 @@ class Mage_Api2_Model_Auth_Adapter_Oauth extends Mage_Api2_Model_Auth_Adapter_Ab
*/
public function getUserParams(Mage_Api2_Model_Request $request)
{
- /** @var $oauthServer Mage_OAuth_Model_Server */
- $oauthServer = Mage::getModel('oAuth/server', $request);
+ /** @var $oauthServer Mage_Oauth_Model_Server */
+ $oauthServer = Mage::getModel('oauth/server', $request);
$userParamsObj = (object) array('type' => null, 'id' => null);
try {
$token = $oauthServer->checkAccessRequest();
$userType = $token->getUserType();
- if (Mage_OAuth_Model_Token::USER_TYPE_ADMIN == $userType) {
+ if (Mage_Oauth_Model_Token::USER_TYPE_ADMIN == $userType) {
$userParamsObj->id = $token->getAdminId();
} else {
$userParamsObj->id = $token->getCustomerId();
diff --git a/app/code/core/Mage/Api2/Model/Config.php b/app/code/core/Mage/Api2/Model/Config.php
index 89048609cc..76655459e1 100644
--- a/app/code/core/Mage/Api2/Model/Config.php
+++ b/app/code/core/Mage/Api2/Model/Config.php
@@ -232,7 +232,7 @@ public function getResource($node)
public function getResourceAttributes($node)
{
$attributes = $this->getNode('resources/' . $node . '/attributes');
- return $attributes ? (array) $attributes : array();
+ return $attributes ? $attributes->asCanonicalArray() : array();
}
/**
@@ -385,7 +385,7 @@ public function getResourceModel($node)
public function getResourceUserPrivileges($resource, $userType)
{
$attributes = $this->getNode('resources/' . $resource . '/privileges/' . $userType);
- return $attributes ? (array)$attributes : array();
+ return $attributes ? $attributes->asCanonicalArray() : array();
}
/**
@@ -397,7 +397,7 @@ public function getResourceUserPrivileges($resource, $userType)
public function getResourceSubresources($node)
{
$subresources = $this->getNode('resources/' . $node . '/subresources');
- return $subresources ? (array)$subresources : array();
+ return $subresources ? $subresources->asCanonicalArray() : array();
}
/**
@@ -410,7 +410,7 @@ public function getResourceSubresources($node)
public function getValidationConfig($resourceType, $validatorType)
{
$config = $this->getNode('resources/' . $resourceType . '/validators/' . $validatorType);
- return $config ? $config->asArray() : array();
+ return $config ? $config->asCanonicalArray() : array();
}
/**
diff --git a/app/code/core/Mage/Api2/Model/Resource/Validator/Eav.php b/app/code/core/Mage/Api2/Model/Resource/Validator/Eav.php
index 91fac69963..36d0c8ff9a 100644
--- a/app/code/core/Mage/Api2/Model/Resource/Validator/Eav.php
+++ b/app/code/core/Mage/Api2/Model/Resource/Validator/Eav.php
@@ -118,6 +118,47 @@ public function __construct($options)
->ignoreInvisible(false);
}
+ /**
+ * Validate attribute value for attributes with source models
+ *
+ * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
+ * @param mixed $attrValue
+ * @return array|bool
+ */
+ protected function _validateAttributeWithSource(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $attrValue)
+ {
+ $errors = array();
+
+ // validate attributes with source models
+ if (null !== $attrValue && $attribute->getSourceModel()) {
+ if ('multiselect' !== $attribute->getFrontendInput() && is_array($attrValue)) {
+ return array('Invalid value type for ' . $attribute->getAttributeCode());
+ }
+ $possibleValues = $attribute->getSource()->getAllOptions(false);
+
+ foreach ((array) $attrValue as $value) {
+ if (is_scalar($value)) {
+ $value = (string) $value;
+ $isValid = false;
+ foreach ($possibleValues as $optionData) {
+ // comparison without types check is performed only when both values are numeric
+ $useStrictMode = !(is_numeric($value) && is_numeric($optionData['value']));
+ $isValid = $useStrictMode ? $value === $optionData['value'] : $value == $optionData['value'];
+ if ($isValid) {
+ break;
+ }
+ }
+ if (!$isValid) {
+ $errors[] = 'Invalid value "' . $value . '" for '. $attribute->getAttributeCode();
+ }
+ } else {
+ $errors[] = 'Invalid value type for ' . $attribute->getAttributeCode();
+ }
+ }
+ }
+ return $errors ? $errors : true;
+ }
+
/**
* Filter request data.
*
@@ -151,22 +192,58 @@ public function isValidData(array $data, $partial = false)
if ($this->_eavForm->ignoreInvisible() && !$attribute->getIsVisible()) {
continue;
}
- if (!isset($data[$attribute->getAttributeCode()])) {
- $data[$attribute->getAttributeCode()] = null;
- }
+ $attrValue = isset($data[$attribute->getAttributeCode()]) ? $data[$attribute->getAttributeCode()] : null;
$result = Mage_Eav_Model_Attribute_Data::factory($attribute, $this->_eavForm->getEntity())
- ->setExtractedData($data)->validateValue($data[$attribute->getAttributeCode()]);
+ ->setExtractedData($data)
+ ->validateValue($attrValue);
+
if ($result !== true) {
$errors = array_merge($errors, $result);
+ } else {
+ $result = $this->_validateAttributeWithSource($attribute, $attrValue);
+
+ if (true !== $result) {
+ $errors = array_merge($errors, $result);
+ }
}
}
+ $this->_setErrors($errors);
- if (count($errors)) {
- $this->_setErrors($errors);
- return false;
- }
+ return $errors ? false : true;
+ }
- return true;
+ /**
+ * Returns an array of errors
+ *
+ * @return array
+ */
+ public function getErrors()
+ {
+ // business asked to avoid additional validation message, so we filter it here
+ $errors = array();
+ $helper = Mage::helper('eav');
+ $requiredAttrs = array();
+ $isRequiredRE = '/^' . str_replace('%s', '(.+)', preg_quote($helper->__('"%s" is a required value.'))). '$/';
+ $greaterThanRE = '/^' . str_replace(
+ '%s', '(.+)', preg_quote($helper->__('"%s" length must be equal or greater than %s characters.'))
+ ) . '$/';
+
+ // find all required attributes labels
+ foreach ($this->_errors as $error) {
+ if (preg_match($isRequiredRE, $error, $matches)) {
+ $requiredAttrs[$matches[1]] = true;
+ }
+ }
+ // exclude additional messages for required attributes been failed
+ foreach ($this->_errors as $error) {
+ if (preg_match($isRequiredRE, $error)
+ || !preg_match($greaterThanRE, $error, $matches)
+ || !isset($requiredAttrs[$matches[1]])
+ ) {
+ $errors[] = $error;
+ }
+ }
+ return $errors;
}
}
diff --git a/app/code/core/Mage/Bundle/Model/Product/Type.php b/app/code/core/Mage/Bundle/Model/Product/Type.php
index 04a37b8a71..2f718961d9 100644
--- a/app/code/core/Mage/Bundle/Model/Product/Type.php
+++ b/app/code/core/Mage/Bundle/Model/Product/Type.php
@@ -901,16 +901,6 @@ public function getForceChildItemQtyChanges($product = null)
return true;
}
- /**
- * Force apply discount for parent item
- *
- * @return bool
- */
- public function getForceApplyDiscountToParentItem()
- {
- return true;
- }
-
/**
* Retrieve additional searchable data from type instance
* Using based on product id and store_id data
diff --git a/app/code/core/Mage/Captcha/Block/Captcha/Zend.php b/app/code/core/Mage/Captcha/Block/Captcha/Zend.php
index cb17ea6d9b..31b03f6257 100755
--- a/app/code/core/Mage/Captcha/Block/Captcha/Zend.php
+++ b/app/code/core/Mage/Captcha/Block/Captcha/Zend.php
@@ -57,12 +57,9 @@ public function getTemplate()
*/
public function getRefreshUrl()
{
- $isSecure = Mage::app()->getStore()->isAdmin()
- ? Mage::app()->getStore()->isAdminUrlSecure()
- : Mage::getConfig()->shouldUrlBeSecure(Mage::app()->getRequest()->getPathInfo());
return Mage::getUrl(
Mage::app()->getStore()->isAdmin() ? 'adminhtml/refresh/refresh' : 'captcha/refresh',
- array('_secure' => $isSecure)
+ array('_secure' => Mage::app()->getStore()->isCurrentlySecure())
);
}
diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest.php
index badc3d7b75..850fa6cfd9 100644
--- a/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest.php
+++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest.php
@@ -44,6 +44,7 @@ abstract class Mage_Catalog_Model_Api2_Product_Image_Rest extends Mage_Catalog_M
* @var array
*/
protected $_mimeTypes = array(
+ 'image/jpg' => 'jpg',
'image/jpeg' => 'jpg',
'image/gif' => 'gif',
'image/png' => 'png'
diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php
index e0c3a82762..9109796eba 100644
--- a/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php
+++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php
@@ -75,7 +75,8 @@ protected function _create(array $data)
$this->_critical($e->getMessage(), Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR);
}
$product = $this->_getProduct();
- $imageFileUri = $this->_getMediaGallery()->addImage($product, $apiTempDir . DS . $imageFileName);
+ $imageFileUri = $this->_getMediaGallery()
+ ->addImage($product, $apiTempDir . DS . $imageFileName, null, false, false);
$ioAdapter->rmdir($apiTempDir, true);
// updateImage() must be called to add image data that is missing after addImage() call
$this->_getMediaGallery()->updateImage($product, $imageFileUri, $data);
diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php
index 3f7168d8f4..59d3cae02c 100644
--- a/app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php
+++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php
@@ -73,7 +73,7 @@ protected function _retrieveCollection()
->addPriceData($this->_getCustomerGroupId(), $store->getWebsiteId())
->addAttributeToSelect(array_diff($availableAttributes, $entityOnlyAttributes))
->addAttributeToFilter('visibility', array(
- 'neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE))
+ 'neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE))
->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
$this->_applyCategoryFilter($collection);
$this->_applyCollectionModifiers($collection);
@@ -125,7 +125,7 @@ protected function _prepareProductForResponse(Mage_Catalog_Model_Product $produc
$productData['final_price_without_tax'] = $this->_applyTaxToPrice($finalPrice, false);
$productData['is_saleable'] = $product->getIsSalable();
- $productData['image_url'] = (string) Mage::helper('catalog/image')->init($product, 'image');
+ $productData['image_url'] = (string)Mage::helper('catalog/image')->init($product, 'image');
if ($this->getActionType() == self::ACTION_TYPE_ENTITY) {
// define URLs
@@ -201,7 +201,7 @@ protected function _getProduct()
$this->_critical(self::RESOURCE_NOT_FOUND);
}
// check if product belongs to website current
- if ($this->getRequest()->getParam('store')) {
+ if ($this->_getStore()->getId()) {
$isValidWebsite = in_array($this->_getStore()->getWebsiteId(), $product->getWebsiteIds());
if (!$isValidWebsite) {
$this->_critical(self::RESOURCE_NOT_FOUND);
@@ -211,7 +211,8 @@ protected function _getProduct()
if ($this->getApiUser()->getType() != Mage_Api2_Model_Auth_User_Admin::USER_TYPE) {
// check if product assigned to any website and can be shown
if ((!Mage::app()->isSingleStoreMode() && !count($product->getWebsiteIds()))
- || !$productHelper->canShow($product)) {
+ || !$productHelper->canShow($product)
+ ) {
$this->_critical(self::RESOURCE_NOT_FOUND);
}
}
@@ -254,8 +255,9 @@ protected function _getCategoryById($categoryId)
* @see Mage_Tax_Helper_Data::getPrice()
*/
protected function _getPrice($price, $includingTax = null, $shippingAddress = null,
- $billingAddress = null, $ctc = null, $priceIncludesTax = null
- ) {
+ $billingAddress = null, $ctc = null, $priceIncludesTax = null
+ )
+ {
$product = $this->_getProduct();
$store = $this->_getStore();
diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php
index 8d2dffa3b4..03e48edf18 100644
--- a/app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php
+++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php
@@ -160,6 +160,11 @@ protected function _create(array $data)
->setTypeId($type)
->setSku($sku);
+ foreach ($product->getMediaAttributes() as $mediaAttribute) {
+ $mediaAttrCode = $mediaAttribute->getAttributeCode();
+ $product->setData($mediaAttrCode, 'no_selection');
+ }
+
$this->_prepareDataForSave($product, $data);
try {
$product->validate();
@@ -201,6 +206,9 @@ protected function _update(array $data)
if (isset($data['sku'])) {
$product->setSku($data['sku']);
}
+ // attribute set and product type cannot be updated
+ unset($data['attribute_set_id']);
+ unset($data['type_id']);
$this->_prepareDataForSave($product, $data);
try {
$product->validate();
@@ -276,13 +284,13 @@ protected function _prepareDataForSave($product, $productData)
}
}
if (isset($productData['use_config_gift_wrapping_available'])) {
- $product->setData('use_config_gift_wrapping_available',
- $productData['use_config_gift_wrapping_available']);
+ $product->setData('use_config_gift_wrapping_available', $productData['use_config_gift_wrapping_available']);
if (!$productData['use_config_gift_wrapping_available']
&& ($product->getData('gift_wrapping_available') === null)
) {
- $product->setData('gift_wrapping_available', (int) Mage::getStoreConfig(
- Enterprise_GiftWrapping_Helper_Data::XML_PATH_ALLOWED_FOR_ITEMS, $product->getStoreId()));
+ $xmlPathGiftWrappingAvailable = 'sales/gift_options/wrapping_allow_items';
+ $product->setData('gift_wrapping_available', (int)Mage::getStoreConfig(
+ $xmlPathGiftWrappingAvailable, $product->getStoreId()));
}
}
diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Validator/Product.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Validator/Product.php
index 3dbbcd67ba..869d42dd6d 100644
--- a/app/code/core/Mage/Catalog/Model/Api2/Product/Validator/Product.php
+++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Validator/Product.php
@@ -178,10 +178,17 @@ protected function _validateAttributes($data, $productEntity)
// skip check when field will be validated later as a required one
&& !(empty($value) && $attribute->getIsRequired())) {
$allowedValues = $this->_getAttributeAllowedValues($attribute->getSource()->getAllOptions());
- $useStrictMode = !is_numeric($value);
- if (!in_array($value, $allowedValues, $useStrictMode)
- && !$this->_isConfigValueUsed($data, $attributeCode)) {
- $this->_addError(sprintf('Invalid value for attribute "%s".', $attributeCode));
+ if (!is_array($value)) {
+ // make validation of select and multiselect identical
+ $value = array($value);
+ }
+ foreach ($value as $selectValue) {
+ $useStrictMode = !is_numeric($selectValue);
+ if (!in_array($selectValue, $allowedValues, $useStrictMode)
+ && !$this->_isConfigValueUsed($data, $attributeCode)) {
+ $this->_addError(sprintf('Invalid value "%s" for attribute "%s".',
+ $selectValue, $attributeCode));
+ }
}
}
// Validate datetime attributes
@@ -341,8 +348,9 @@ protected function _validateWebsiteIdForGroupPrice($data, $fieldSet)
/** @var $catalogHelper Mage_Catalog_Helper_Data */
$catalogHelper = Mage::helper('catalog');
$website = Mage::getModel('core/website')->load($data['website_id']);
- if (is_null($website->getId()) || ($data['website_id'] !== 0
- && $catalogHelper->getPriceScope() == Mage_Catalog_Helper_Data::PRICE_SCOPE_GLOBAL)) {
+ $isAllWebsitesValue = is_numeric($data['website_id']) && ($data['website_id'] == 0);
+ $isGlobalPriceScope = (int)$catalogHelper->getPriceScope() == Mage_Catalog_Helper_Data::PRICE_SCOPE_GLOBAL;
+ if (is_null($website->getId()) || ($isGlobalPriceScope && !$isAllWebsitesValue)) {
$this->_addError(sprintf('Invalid "website_id" value in the "%s" set.', $fieldSet));
}
}
@@ -371,7 +379,7 @@ protected function _validateStockData($data)
}
$this->_validateBoolean($stockData, $fieldSet, 'enable_qty_increments', true);
if (isset($stockData['enable_qty_increments']) && (bool) $stockData['enable_qty_increments'] == true) {
- $this->_validatePositiveInteger($stockData, $fieldSet, 'qty_increments', false, true);
+ $this->_validatePositiveNumeric($stockData, $fieldSet, 'qty_increments', false, true);
}
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
$this->_validateSource($stockData, $fieldSet, 'backorders',
@@ -380,8 +388,8 @@ protected function _validateStockData($data)
}
}
- $this->_validatePositiveInteger($stockData, $fieldSet, 'min_sale_qty', false, true);
- $this->_validatePositiveInteger($stockData, $fieldSet, 'max_sale_qty', false, true);
+ $this->_validatePositiveNumeric($stockData, $fieldSet, 'min_sale_qty', false, true);
+ $this->_validatePositiveNumeric($stockData, $fieldSet, 'max_sale_qty', false, true);
}
}
@@ -456,7 +464,7 @@ protected function _validatePositiveNumber($data, $fieldSet, $field, $required =
}
/**
- * Validate field to be a positive integer
+ * Validate field to be a positive number
*
* @param array $data
* @param string $fieldSet
@@ -464,7 +472,7 @@ protected function _validatePositiveNumber($data, $fieldSet, $field, $required =
* @param bool $required
* @param bool $skipIfConfigValueUsed
*/
- protected function _validatePositiveInteger($data, $fieldSet, $field, $required = false,
+ protected function _validatePositiveNumeric($data, $fieldSet, $field, $required = false,
$skipIfConfigValueUsed = false)
{
// in case when 'Use Config Settings' is selected no validation needed
@@ -473,9 +481,9 @@ protected function _validatePositiveInteger($data, $fieldSet, $field, $required
$this->_addError(sprintf('The "%s" value in the "%s" set is a required field.',$field, $fieldSet));
}
- if (isset($data[$field]) && (!is_int($data[$field]) || $data[$field] < 0)) {
+ if (isset($data[$field]) && (!is_numeric($data[$field]) || $data[$field] < 0)) {
$this->_addError(sprintf('Please use numbers only in the "%s" field in the "%s" set. ' .
- 'Please avoid spaces or other characters such as dots or commas.', $field, $fieldSet));
+ 'Please avoid spaces or other non numeric characters.', $field, $fieldSet));
}
}
}
@@ -521,7 +529,8 @@ protected function _validateSource($data, $fieldSet, $field, $sourceModelName, $
$sourceModel = Mage::getSingleton($sourceModelName);
if ($sourceModel) {
$allowedValues = $this->_getAttributeAllowedValues($sourceModel->toOptionArray());
- if (!in_array($data[$field], $allowedValues, true)) {
+ $useStrictMode = !is_numeric($data[$field]);
+ if (!in_array($data[$field], $allowedValues, $useStrictMode)) {
$this->_addError(sprintf('Invalid "%s" value in the "%s" set.', $field, $fieldSet));
}
}
@@ -544,7 +553,8 @@ protected function _validateBoolean($data, $fieldSet, $field, $skipIfConfigValue
if (isset($data[$field])) {
$allowedValues = $this->_getAttributeAllowedValues(
Mage::getSingleton('eav/entity_attribute_source_boolean')->getAllOptions());
- if (!in_array($data[$field], $allowedValues, true)) {
+ $useStrictMode = !is_numeric($data[$field]);
+ if (!in_array($data[$field], $allowedValues, $useStrictMode)) {
$this->_addError(sprintf('Invalid "%s" value in the "%s" set.', $field, $fieldSet));
}
}
diff --git a/app/code/core/Mage/Catalog/Model/Category.php b/app/code/core/Mage/Catalog/Model/Category.php
index 90baa36883..835eca27e5 100644
--- a/app/code/core/Mage/Catalog/Model/Category.php
+++ b/app/code/core/Mage/Catalog/Model/Category.php
@@ -737,7 +737,7 @@ public function getRequestPath()
}
/**
- * Retrieve Name data wraper
+ * Retrieve Name data wrapper
*
* @return string
*/
diff --git a/app/code/core/Mage/Catalog/Model/Category/Api.php b/app/code/core/Mage/Catalog/Model/Category/Api.php
index 1ca5775e5e..673ce88e50 100644
--- a/app/code/core/Mage/Catalog/Model/Category/Api.php
+++ b/app/code/core/Mage/Catalog/Model/Category/Api.php
@@ -394,6 +394,10 @@ public function move($categoryId, $parentId, $afterId = null)
*/
public function delete($categoryId)
{
+ if (Mage_Catalog_Model_Category::TREE_ROOT_ID == $categoryId) {
+ $this->_fault('not_deleted', 'Cannot remove the system category.');
+ }
+
$category = $this->_initCategory($categoryId);
try {
diff --git a/app/code/core/Mage/Catalog/Model/Product.php b/app/code/core/Mage/Catalog/Model/Product.php
index 418c502fad..2b6cecb7e6 100644
--- a/app/code/core/Mage/Catalog/Model/Product.php
+++ b/app/code/core/Mage/Catalog/Model/Product.php
@@ -1337,7 +1337,7 @@ public function getIsSalable()
/**
* Check is a virtual product
- * Data helper wraper
+ * Data helper wrapper
*
* @return bool
*/
diff --git a/app/code/core/Mage/Catalog/Model/Product/Api.php b/app/code/core/Mage/Catalog/Model/Product/Api.php
index 39dcdd1c24..43afdf4a49 100644
--- a/app/code/core/Mage/Catalog/Model/Product/Api.php
+++ b/app/code/core/Mage/Catalog/Model/Product/Api.php
@@ -187,6 +187,11 @@ public function create($type, $set, $sku, $productData, $store = null)
$product->setStockData(array('use_config_manage_stock' => 0));
}
+ foreach ($product->getMediaAttributes() as $mediaAttribute) {
+ $mediaAttrCode = $mediaAttribute->getAttributeCode();
+ $product->setData($mediaAttrCode, 'no_selection');
+ }
+
$this->_prepareDataForSave($product, $productData);
try {
diff --git a/app/code/core/Mage/Catalog/Model/Product/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Api/V2.php
index acdd0ca01b..239ccf724a 100644
--- a/app/code/core/Mage/Catalog/Model/Product/Api/V2.php
+++ b/app/code/core/Mage/Catalog/Model/Product/Api/V2.php
@@ -182,6 +182,11 @@ public function create($type, $set, $sku, $productData, $store = null)
$product->setStockData($_stockData);
}
+ foreach ($product->getMediaAttributes() as $mediaAttribute) {
+ $mediaAttrCode = $mediaAttribute->getAttributeCode();
+ $product->setData($mediaAttrCode, 'no_selection');
+ }
+
$this->_prepareDataForSave($product, $productData);
try {
diff --git a/app/code/core/Mage/Catalog/Model/Product/Status.php b/app/code/core/Mage/Catalog/Model/Product/Status.php
index 04fac9bdbe..a2f6175383 100644
--- a/app/code/core/Mage/Catalog/Model/Product/Status.php
+++ b/app/code/core/Mage/Catalog/Model/Product/Status.php
@@ -63,7 +63,7 @@ protected function _construct()
}
/**
- * Retrieve resource model wraper
+ * Retrieve resource model wrapper
*
* @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Status
*/
diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php b/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php
index 5c9c4b06c4..329edc44cc 100644
--- a/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php
+++ b/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php
@@ -863,16 +863,6 @@ public function getForceChildItemQtyChanges($product = null)
return false;
}
- /**
- * Force apply discount for parent item
- *
- * @return bool
- */
- public function getForceApplyDiscountToParentItem()
- {
- return false;
- }
-
/**
* Prepare Quote Item Quantity
*
diff --git a/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php b/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php
index 5de20a0f03..544c5494f8 100755
--- a/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php
+++ b/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php
@@ -285,7 +285,8 @@ public function getCount($filter, $range)
*/
public function applyFilterToCollection($filter, $range, $index)
{
- $priceExpr = $this->_getPriceExpression($filter);
+ $select = $filter->getLayer()->getProductCollection()->getSelect();
+ $priceExpr = $this->_getPriceExpression($filter, $select);
$filter->getLayer()->getProductCollection()
->getSelect()
->where($priceExpr . ' >= ' . $this->_getComparingValue(($range * ($index - 1)), $filter))
diff --git a/app/code/core/Mage/Catalog/controllers/Product/CompareController.php b/app/code/core/Mage/Catalog/controllers/Product/CompareController.php
index 9354b2c2cc..5855daab76 100644
--- a/app/code/core/Mage/Catalog/controllers/Product/CompareController.php
+++ b/app/code/core/Mage/Catalog/controllers/Product/CompareController.php
@@ -74,7 +74,10 @@ public function indexAction()
*/
public function addAction()
{
- if ($productId = (int) $this->getRequest()->getParam('product')) {
+ $productId = (int) $this->getRequest()->getParam('product');
+ if ($productId
+ && (Mage::getSingleton('log/visitor')->getId() || Mage::getSingleton('customer/session')->isLoggedIn())
+ ) {
$product = Mage::getModel('catalog/product')
->setStoreId(Mage::app()->getStore()->getId())
->load($productId);
diff --git a/app/code/core/Mage/Catalog/etc/api2.xml b/app/code/core/Mage/Catalog/etc/api2.xml
index 950da09805..87d549a968 100644
--- a/app/code/core/Mage/Catalog/etc/api2.xml
+++ b/app/code/core/Mage/Catalog/etc/api2.xml
@@ -40,7 +40,7 @@
-
+ catalog_productcatalog/api2_productcatalog/product
@@ -60,7 +60,7 @@
1
-
+ Product IDProduct TypeAttribute Set
@@ -210,7 +210,7 @@
1
-
+ catalog_productcatalog/api2_product_categorycatalog/category
@@ -229,7 +229,7 @@
1
-
+ Category ID
@@ -246,7 +246,7 @@
1
-
+ IntPlease use numbers only in "category_id" field.
@@ -255,7 +255,7 @@
1
-
+ catalog_productcatalog/api2_product_imageProduct Image
@@ -274,7 +274,7 @@
1
-
+ IDFile NameFile Content
@@ -334,7 +334,7 @@
1
-
+ catalog_productcatalog/api2_product_websitecatalog/product_website
diff --git a/app/code/core/Mage/CatalogInventory/Block/Qtyincrements.php b/app/code/core/Mage/CatalogInventory/Block/Qtyincrements.php
index 9b31c74fb9..4fca1e8423 100644
--- a/app/code/core/Mage/CatalogInventory/Block/Qtyincrements.php
+++ b/app/code/core/Mage/CatalogInventory/Block/Qtyincrements.php
@@ -70,9 +70,6 @@ public function getProductQtyIncrements()
{
if ($this->_qtyIncrements === null) {
$this->_qtyIncrements = $this->_getProduct()->getStockItem()->getQtyIncrements();
- if (!$this->_qtyIncrements) {
- $this->_qtyIncrements = $this->_getProduct()->getStockItem()->getDefaultQtyIncrements();
- }
if (!$this->_getProduct()->isSaleable()) {
$this->_qtyIncrements = false;
}
diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php
index 5ed9d1cac0..0b7d017412 100644
--- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php
+++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php
@@ -170,7 +170,7 @@ public function getStockId()
}
/**
- * Retrieve Product Id data wraper
+ * Retrieve Product Id data wrapper
*
* @return int
*/
@@ -365,47 +365,44 @@ public function getNotifyStockQty()
*/
public function getEnableQtyIncrements()
{
- if ($this->getUseConfigEnableQtyIncrements()) {
- return Mage::getStoreConfigFlag(self::XML_PATH_ENABLE_QTY_INCREMENTS);
- }
- return (bool) $this->getData('enable_qty_increments');
+ return $this->getUseConfigEnableQtyIncrements()
+ ? Mage::getStoreConfigFlag(self::XML_PATH_ENABLE_QTY_INCREMENTS)
+ : (bool)$this->getData('enable_qty_increments');
}
/**
- * Retrieve Quantity Increments data wraper
+ * Retrieve Quantity Increments data wrapper
*
* @return float|false
*/
public function getQtyIncrements()
{
if ($this->_qtyIncrements === null) {
- $this->_qtyIncrements = false;
if ($this->getEnableQtyIncrements()) {
- if ($this->getUseConfigQtyIncrements()) {
- $this->_qtyIncrements = Mage::getStoreConfig(self::XML_PATH_QTY_INCREMENTS);
- } else {
- $this->_qtyIncrements = $this->getData('qty_increments');
- }
- $this->_qtyIncrements = (float)$this->_qtyIncrements;
+ $this->_qtyIncrements = (float)($this->getUseConfigQtyIncrements()
+ ? Mage::getStoreConfig(self::XML_PATH_QTY_INCREMENTS)
+ : $this->getData('qty_increments'));
if ($this->_qtyIncrements <= 0) {
$this->_qtyIncrements = false;
}
+ } else {
+ $this->_qtyIncrements = false;
}
}
return $this->_qtyIncrements;
}
/**
- * Retrieve Default Quantity Increments data wraper
+ * Retrieve Default Quantity Increments data wrapper
*
+ * @deprecated since 1.7.0.0
* @return int|false
*/
public function getDefaultQtyIncrements()
{
- if (Mage::getStoreConfigFlag(self::XML_PATH_ENABLE_QTY_INCREMENTS)) {
- return (int) Mage::getStoreConfig(self::XML_PATH_QTY_INCREMENTS);
- }
- return false;
+ return Mage::getStoreConfigFlag(self::XML_PATH_ENABLE_QTY_INCREMENTS)
+ ? (int)Mage::getStoreConfig(self::XML_PATH_QTY_INCREMENTS)
+ : false;
}
/**
@@ -422,7 +419,7 @@ public function getBackorders()
}
/**
- * Retrieve Manage Stock data wraper
+ * Retrieve Manage Stock data wrapper
*
* @return int
*/
@@ -572,7 +569,6 @@ public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0)
}
$result->addData($this->checkQtyIncrements($qty)->getData());
-
if ($result->getHasError()) {
return $result;
}
@@ -639,7 +635,6 @@ public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0)
$this->setOrderedItems($qty + (int)$this->getOrderedItems());
}
}
- // no return intentionally
}
return $result;
@@ -659,10 +654,6 @@ public function checkQtyIncrements($qty)
}
$qtyIncrements = $this->getQtyIncrements();
- if (!$qtyIncrements){
- $qtyIncrements = $this->getDefaultQtyIncrements();
- }
-
if ($qtyIncrements && (Mage::helper('core')->getExactDivision($qty, $qtyIncrements) != 0)) {
$result->setHasError(true)
->setQuoteMessage(
diff --git a/app/code/core/Mage/Checkout/Block/Cart/Shipping.php b/app/code/core/Mage/Checkout/Block/Cart/Shipping.php
index ddf32624e0..51d2ee226a 100644
--- a/app/code/core/Mage/Checkout/Block/Cart/Shipping.php
+++ b/app/code/core/Mage/Checkout/Block/Cart/Shipping.php
@@ -257,7 +257,7 @@ public function isCityRequired()
public function isZipCodeRequired()
{
foreach ($this->getCarriers() as $carrier) {
- if ($carrier->isZipCodeRequired()) {
+ if ($carrier->isZipCodeRequired($this->getEstimateCountryId())) {
return true;
}
}
diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Abstract.php b/app/code/core/Mage/Checkout/Block/Onepage/Abstract.php
index 0ff811b2f3..c463b3254d 100644
--- a/app/code/core/Mage/Checkout/Block/Onepage/Abstract.php
+++ b/app/code/core/Mage/Checkout/Block/Onepage/Abstract.php
@@ -159,7 +159,7 @@ public function getCountryHtmlSelect($type)
->setValue($countryId)
->setOptions($this->getCountryOptions());
if ($type === 'shipping') {
- $select->setExtraParams('onchange="shipping.setSameAsBilling(false);"');
+ $select->setExtraParams('onchange="if(window.shipping)shipping.setSameAsBilling(false);"');
}
return $select->getHtml();
diff --git a/app/code/core/Mage/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php b/app/code/core/Mage/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
index be88e876e5..32588aebdc 100644
--- a/app/code/core/Mage/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
+++ b/app/code/core/Mage/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
@@ -26,11 +26,9 @@
$pageContent = <<
-
- Please replace this text with you Privacy Policy.
- Please add any additional cookies your website uses below (e.g., Google Analytics)
-
+
+ Please replace this text with you Privacy Policy.
+ Please add any additional cookies your website uses below (e.g., Google Analytics)
This privacy policy sets out how {{config path="general/store_information/name"}} uses and protects any information
@@ -170,6 +168,10 @@
CUSTOMER_INFO
An encrypted version of the customer group you belong to.
+
+
CUSTOMER_SEGMENT_IDS
+
Stores the Customer Segment ID
+
EXTERNAL_NO_CACHE
A flag, which indicates whether caching is disabled or not.
diff --git a/app/code/core/Mage/Core/Controller/Varien/Front.php b/app/code/core/Mage/Core/Controller/Varien/Front.php
index a3c9fe933c..0bddf590e9 100644
--- a/app/code/core/Mage/Core/Controller/Varien/Front.php
+++ b/app/code/core/Mage/Core/Controller/Varien/Front.php
@@ -310,7 +310,7 @@ protected function _checkBaseUrl($request)
$baseUrl = Mage::getBaseUrl(
Mage_Core_Model_Store::URL_TYPE_WEB,
- Mage::getConfig()->shouldUrlBeSecure($request->getPathInfo())
+ Mage::app()->getStore()->isCurrentlySecure()
);
if (!$baseUrl) {
return;
@@ -322,12 +322,8 @@ protected function _checkBaseUrl($request)
|| isset($uri['host']) && $uri['host'] != $request->getHttpHost()
|| isset($uri['path']) && strpos($requestUri, $uri['path']) === false
) {
- $redirectUrl = Mage::getSingleton('core/url')->getRedirectUrl(
- Mage::getUrl(ltrim($request->getPathInfo(), '/'), array('_nosid' => true))
- );
-
Mage::app()->getFrontController()->getResponse()
- ->setRedirect($redirectUrl, $redirectCode)
+ ->setRedirect($baseUrl, $redirectCode)
->sendResponse();
exit;
}
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 11b587bbfa..54f7a59a4b 100644
--- a/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php
+++ b/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php
@@ -95,11 +95,9 @@ protected function _noRouteShouldBeApplied()
*/
protected function _shouldBeSecure($path)
{
- $xmlPath = Mage::getStoreConfigFlag(
- Mage_Core_Model_Store::XML_PATH_SECURE_IN_ADMINHTML,
- Mage_Core_Model_App::ADMIN_STORE_ID
- ) ? 'default/web/secure/base_url' : 'default/web/unsecure/base_url';
- return substr((string)Mage::getConfig()->getNode($xmlPath), 0, 5) === 'https';
+ return substr((string)Mage::getConfig()->getNode('default/web/unsecure/base_url'), 0, 5) === 'https'
+ || Mage::getStoreConfigFlag('web/secure/use_in_adminhtml', Mage_Core_Model_App::ADMIN_STORE_ID)
+ && substr((string)Mage::getConfig()->getNode('default/web/secure/base_url'), 0, 5) === 'https';
}
/**
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 d201d77382..99b98d415b 100644
--- a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
+++ b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
@@ -460,9 +460,9 @@ protected function _getCurrentSecureUrl($request)
*/
protected function _shouldBeSecure($path)
{
- $xmlPath = Mage::getConfig()->shouldUrlBeSecure($path)
- ? Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL
- : Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL;
- return substr(Mage::getStoreConfig($xmlPath), 0, 5) === 'https';
+ return substr(Mage::getStoreConfig('web/unsecure/base_url'), 0, 5) === 'https'
+ || Mage::getStoreConfigFlag('web/secure/use_in_frontend')
+ && substr(Mage::getStoreConfig('web/secure/base_url'), 0, 5) == 'https'
+ && Mage::getConfig()->shouldUrlBeSecure($path);
}
}
diff --git a/app/code/core/Mage/Core/Helper/Cookie.php b/app/code/core/Mage/Core/Helper/Cookie.php
index cd28cea07f..17d5020a81 100644
--- a/app/code/core/Mage/Core/Helper/Cookie.php
+++ b/app/code/core/Mage/Core/Helper/Cookie.php
@@ -43,6 +43,11 @@ class Mage_Core_Helper_Cookie extends Mage_Core_Helper_Abstract
*/
const XML_PATH_COOKIE_RESTRICTION = 'web/cookie/cookie_restriction';
+ /**
+ * Cookie restriction lifetime configuration path
+ */
+ const XML_PATH_COOKIE_RESTRICTION_LIFETIME = 'web/cookie/cookie_restriction_lifetime';
+
/**
* Check if cookie restriction notice should be displayed
*
@@ -78,4 +83,14 @@ protected function _getAcceptedSaveCookiesWebsites()
$unSerializedList = unserialize($serializedList);
return is_array($unSerializedList) ? $unSerializedList : array();
}
+
+ /**
+ * Get cookie restriction lifetime (in seconds)
+ *
+ * @return int
+ */
+ public function getCookieRestrictionLifetime()
+ {
+ return (int)Mage::getStoreConfig(self::XML_PATH_COOKIE_RESTRICTION_LIFETIME);
+ }
}
diff --git a/app/code/core/Mage/Core/Model/File/Storage/Database.php b/app/code/core/Mage/Core/Model/File/Storage/Database.php
index 9804c1ff68..415ebeaed9 100644
--- a/app/code/core/Mage/Core/Model/File/Storage/Database.php
+++ b/app/code/core/Mage/Core/Model/File/Storage/Database.php
@@ -289,6 +289,18 @@ public function renameFile($oldFilePath, $newFilePath)
dirname($newFilePath)
);
+ $newPath = dirname($newFilePath);
+ $directory = Mage::getModel('core/file_storage_directory_database')->loadByPath($newPath);
+
+ if (!$directory->getId()) {
+ $directory = $this->getDirectoryModel()->createRecursive($newPath);
+ }
+
+ $this->loadByFilename($newFilePath);
+ if ($this->getId()) {
+ $this->setDirectoryId($directory->getId())->save();
+ }
+
return $this;
}
diff --git a/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php
index 06d061229d..93d5aff68d 100644
--- a/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php
+++ b/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php
@@ -624,7 +624,7 @@ protected function _prepareValueForSave($value, $type)
/**
* Check for unique values existence
*
- * @param Varien_Object $object
+ * @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract
* @throws Mage_Core_Exception
*/
@@ -656,7 +656,7 @@ protected function _checkUnique(Mage_Core_Model_Abstract $object)
$select->where($unique['field'] . '=?', trim($data->getData($unique['field'])));
}
- if ($object->getId()) {
+ if ($object->getId() || $object->getId() === '0') {
$select->where($this->getIdFieldName() . '!=?', $object->getId());
}
diff --git a/app/code/core/Mage/Core/Model/Translate/Inline.php b/app/code/core/Mage/Core/Model/Translate/Inline.php
index bdfe8e15a3..c5ebb2e8be 100644
--- a/app/code/core/Mage/Core/Model/Translate/Inline.php
+++ b/app/code/core/Mage/Core/Model/Translate/Inline.php
@@ -358,6 +358,16 @@ protected function _getTranslateData($regexp, &$text, $locationCallback, $option
*
*/
protected function _tagAttributes()
+ {
+ $this->_prepareTagAttributesForContent($this->_content);
+ }
+
+ /**
+ * Prepare tags inline translates for the content
+ *
+ * @param string $content
+ */
+ protected function _prepareTagAttributesForContent(&$content)
{
if ($this->getIsJson()) {
$quoteHtml = '\"';
@@ -368,7 +378,7 @@ protected function _tagAttributes()
$tagMatch = array();
$nextTag = 0;
$tagRegExp = '#<([a-z]+)\s*?[^>]+?((' . $this->_tokenRegex . ')[^>]*?)+/?>#i';
- while (preg_match($tagRegExp, $this->_content, $tagMatch, PREG_OFFSET_CAPTURE, $nextTag)) {
+ while (preg_match($tagRegExp, $content, $tagMatch, PREG_OFFSET_CAPTURE, $nextTag)) {
$next = 0;
$tagHtml = $tagMatch[0][0];
$m = array();
@@ -384,7 +394,7 @@ protected function _tagAttributes()
$trAttr = ' translate=' . $quoteHtml
. htmlspecialchars('[' . join(',', $trArr) . ']') . $quoteHtml;
}
- $this->_content = substr_replace($this->_content, $tagHtml, $tagMatch[0][1], strlen($tagMatch[0][0]));
+ $content = substr_replace($content, $tagHtml, $tagMatch[0][1], strlen($tagMatch[0][0]));
}
$nextTag = $tagMatch[0][1] + strlen($tagHtml);
}
@@ -492,7 +502,7 @@ protected function _translateTags(&$body, $tagsList, $formatCallback, $isNeedTra
}
if ($isNeedTranslateAttributes) {
- $this->_tagAttributes($tagEnd);
+ $this->_prepareTagAttributesForContent($tagEnd);
}
$tagHtml .= $tagEnd;
diff --git a/app/code/core/Mage/Core/etc/system.xml b/app/code/core/Mage/Core/etc/system.xml
index aaadb7a248..37b31d4331 100644
--- a/app/code/core/Mage/Core/etc/system.xml
+++ b/app/code/core/Mage/Core/etc/system.xml
@@ -1149,7 +1149,7 @@
11
-
+ selectadminhtml/system_config_source_yesno
@@ -1158,6 +1158,7 @@
100
+ Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).]]>
diff --git a/app/code/core/Mage/Customer/Model/Api2/Customer/Address.php b/app/code/core/Mage/Customer/Model/Api2/Customer/Address.php
index e37c4936f0..582bf60f4c 100644
--- a/app/code/core/Mage/Customer/Model/Api2/Customer/Address.php
+++ b/app/code/core/Mage/Customer/Model/Api2/Customer/Address.php
@@ -80,15 +80,24 @@ protected function _isDefaultShippingAddress(Mage_Customer_Model_Address $addres
* If id is not found then return passed $region
*
* @param string $region
+ * @param string $countryId
* @return int|string
*/
- protected function _getRegionIdByNameOrCode($region)
+ protected function _getRegionIdByNameOrCode($region, $countryId)
{
- $id = Mage::getResourceModel('directory/region_collection')
- ->addFieldToFilter(array('default_name', 'code'), array($region, $region))
- ->getFirstItem()
- ->getId();
- return $id ? $id : $region;
+ /** @var $collection Mage_Directory_Model_Resource_Region_Collection */
+ $collection = Mage::getResourceModel('directory/region_collection');
+
+ $collection->getSelect()
+ ->reset() // to avoid locale usage
+ ->from(array('main_table' => $collection->getMainTable()), 'region_id');
+
+ $collection->addCountryFilter($countryId)
+ ->addFieldToFilter(array('default_name', 'code'), array($region, $region));
+
+ $id = $collection->getResource()->getReadConnection()->fetchOne($collection->getSelect());
+
+ return $id ? (int)$id : $region;
}
/**
diff --git a/app/code/core/Mage/Customer/Model/Api2/Customer/Address/Rest.php b/app/code/core/Mage/Customer/Model/Api2/Customer/Address/Rest.php
index bbb54bfb4d..605de7eda6 100644
--- a/app/code/core/Mage/Customer/Model/Api2/Customer/Address/Rest.php
+++ b/app/code/core/Mage/Customer/Model/Api2/Customer/Address/Rest.php
@@ -54,7 +54,9 @@ protected function _create(array $data)
$this->_critical(self::RESOURCE_DATA_PRE_VALIDATION_ERROR);
}
- $data['region'] = $this->_getRegionIdByNameOrCode($data['region']);
+ if (isset($data['region']) && isset($data['country_id'])) {
+ $data['region'] = $this->_getRegionIdByNameOrCode($data['region'], $data['country_id']);
+ }
/* @var $address Mage_Customer_Model_Address */
$address = Mage::getModel('customer/address');
@@ -154,8 +156,12 @@ protected function _update(array $data)
}
$this->_critical(self::RESOURCE_DATA_PRE_VALIDATION_ERROR);
}
-
- $data['region'] = isset($data['region']) ? $this->_getRegionIdByNameOrCode($data['region']) : null;
+ if (isset($data['region'])) {
+ $data['region'] = $this->_getRegionIdByNameOrCode(
+ $data['region'], isset($data['country_id']) ? $data['country_id'] : $address->getCountryId()
+ );
+ $data['region_id'] = null; // to avoid overwrite region during update in address model _beforeSave()
+ }
$address->addData($data);
try {
diff --git a/app/code/core/Mage/Customer/Model/Api2/Customer/Address/Validator.php b/app/code/core/Mage/Customer/Model/Api2/Customer/Address/Validator.php
index c86db50d53..982ff09683 100644
--- a/app/code/core/Mage/Customer/Model/Api2/Customer/Address/Validator.php
+++ b/app/code/core/Mage/Customer/Model/Api2/Customer/Address/Validator.php
@@ -46,16 +46,22 @@ class Mage_Customer_Model_Api2_Customer_Address_Validator extends Mage_Api2_Mode
*/
public function filter(array $data)
{
- $data = parent::filter($data);
+ $filteredData = parent::filter($data);
// If the array contains more than two elements, then combine the extra elements in a string
- if (isset($data['street']) && is_array($data['street']) && count($data['street']) > 2) {
- $data['street'][1] .= self::STREET_SEPARATOR
- . implode(self::STREET_SEPARATOR, array_slice($data['street'], 2));
- $filteredData['street'] = array_slice($data['street'], 0, 2);
+ if (isset($filteredData['street']) && is_array($filteredData['street']) && count($filteredData['street']) > 2) {
+ $filteredData['street'][1] .= self::STREET_SEPARATOR
+ . implode(self::STREET_SEPARATOR, array_slice($filteredData['street'], 2));
+ $filteredData['street'] = array_slice($filteredData['street'], 0, 2);
}
-
- return $data;
+ // pass default addresses info
+ if (isset($data['is_default_billing'])) {
+ $filteredData['is_default_billing'] = $data['is_default_billing'];
+ }
+ if (isset($data['is_default_shipping'])) {
+ $filteredData['is_default_shipping'] = $data['is_default_shipping'];
+ }
+ return $filteredData;
}
/**
@@ -66,15 +72,7 @@ public function filter(array $data)
*/
public function isValidDataForCreateAssociationWithCountry(array $data)
{
- // Check the country
- $country = $this->_checkCountry($data);
- if (false == $country) {
- // break the validation if the country is not valid
- return false;
- }
-
- // Check the region
- return $this->_checkRegion($data, $country);
+ return $this->_checkRegion($data, Mage::getModel('directory/country')->loadByCode($data['country_id']));
}
/**
@@ -89,62 +87,15 @@ public function isValidDataForChangeAssociationWithCountry(Mage_Customer_Model_A
if (!isset($data['country_id']) && !isset($data['region'])) {
return true;
}
-
- // Check the country
- if (array_key_exists('country_id', $data)) {
- $country = $this->_checkCountry($data);
- if (false == $country) {
- // break the validation if the country is not valid
- return false;
- }
+ // If country is in data - it has been already validated. If no - load current country.
+ if (isset($data['country_id'])) {
+ $country = Mage::getModel('directory/country')->loadByCode($data['country_id']);
} else {
- // if the country is not passed load the current country
$country = $address->getCountryModel();
}
-
- // Check the region
return $this->_checkRegion($data, $country);
}
- /**
- * Check country
- *
- * @param array $data
- * @return bool|Mage_Directory_Model_Country
- */
- protected function _checkCountry($data)
- {
- if (!array_key_exists('country_id', $data)) {
- $this->_addError('"Country" is required.');
- return false;
- }
-
- if (!is_string($data['country_id'])) {
- $this->_addError('Invalid country identifier type.');
- return false;
- }
-
- if ('' == trim($data['country_id'])) {
- $this->_addError('"Country" is required.');
- return false;
- }
-
- $validator = new Zend_Validate_StringLength(array('min' => 2, 'max' => 3));
- if (!$validator->isValid($data['country_id'])) {
- $this->_addError("Country is not between '2' and '3' inclusively.");
- return false;
- }
-
- /* @var $country Mage_Directory_Model_Country */
- $country = Mage::getModel('directory/country')->loadByCode($data['country_id']);
- if (!$country->getId()) {
- $this->_addError('Country does not exist.');
- return false;
- }
-
- return $country;
- }
-
/**
* Check region
*
diff --git a/app/code/core/Mage/Customer/Model/Api2/Customer/Rest.php b/app/code/core/Mage/Customer/Model/Api2/Customer/Rest.php
index 772bb38c66..f6e971c4b4 100644
--- a/app/code/core/Mage/Customer/Model/Api2/Customer/Rest.php
+++ b/app/code/core/Mage/Customer/Model/Api2/Customer/Rest.php
@@ -42,10 +42,7 @@ abstract class Mage_Customer_Model_Api2_Customer_Rest extends Mage_Customer_Mode
protected function _create(array $data)
{
/** @var $validator Mage_Api2_Model_Resource_Validator_Eav */
- $validator = Mage::getResourceModel('api2/validator_eav', array(
- 'resource' => $this,
- 'operation' => self::OPERATION_CREATE
- ));
+ $validator = Mage::getResourceModel('api2/validator_eav', array('resource' => $this));
$data = $validator->filter($data);
if (!$validator->isValidData($data)) {
@@ -104,15 +101,14 @@ protected function _update(array $data)
{
/** @var $customer Mage_Customer_Model_Customer */
$customer = $this->_loadCustomerById($this->getRequest()->getParam('id'));
-
/** @var $validator Mage_Api2_Model_Resource_Validator_Eav */
- $validator = Mage::getResourceModel('api2/validator_eav', array(
- 'resource' => $this,
- 'operation' => self::OPERATION_UPDATE
- ));
+ $validator = Mage::getResourceModel('api2/validator_eav', array('resource' => $this));
$data = $validator->filter($data);
- if (!$validator->isValidData($data)) {
+
+ unset($data['website_id']); // website is not allowed to change
+
+ if (!$validator->isValidData($data, true)) {
foreach ($validator->getErrors() as $error) {
$this->_error($error, Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
}
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
index 40001be7e8..5a7263e14f 100644
--- 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
@@ -47,86 +47,57 @@ public function draw()
$page = $this->getPage();
$lines = array();
- $leftBound = 35;
- $rightBound = 565;
-
- $x = $leftBound;
// draw Product name
$lines[0] = array(array(
- 'text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true),
- 'feed' => $x,
+ 'text' => Mage::helper('core/string')->str_split($item->getName(), 35, true, true),
+ 'feed' => 35,
));
- $x += 220;
// draw SKU
$lines[0][] = array(
- 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
- 'feed' => $x
+ 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 17),
+ 'feed' => 255,
+ 'align' => 'right'
);
- $x += 100;
// draw Total (ex)
- $i = 0;
- $prices = $this->getItemPricesForDisplay();
- foreach ($prices as $priceData){
- if (isset($priceData['label'])) {
- // draw Subtotal label
- $lines[$i][] = array(
- 'text' => $priceData['label'],
- 'feed' => $x,
- 'align' => 'right',
- 'width' => 50,
- );
- $i++;
- }
- // draw Subtotal
- $lines[$i][] = array(
- 'text' => $priceData['subtotal'],
- 'feed' => $x,
- 'font' => 'bold',
- 'align' => 'right',
- 'width' => 50,
- );
- $i++;
- }
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt($item->getRowTotal()),
+ 'feed' => 330,
+ 'font' => 'bold',
+ 'align' => 'right',
+ );
- $x += 50;
// draw Discount
$lines[0][] = array(
'text' => $order->formatPriceTxt(-$item->getDiscountAmount()),
- 'feed' => $x,
+ 'feed' => 380,
'font' => 'bold',
- 'align' => 'right',
- 'width' => 50,
+ 'align' => 'right'
);
- $x += 50;
// draw QTY
$lines[0][] = array(
- 'text' => $item->getQty()*1,
- 'feed' => $x,
+ 'text' => $item->getQty() * 1,
+ 'feed' => 445,
'font' => 'bold',
- 'align' => 'center',
- 'width' => 30,
+ 'align' => 'right',
);
- $x += 30;
// draw Tax
$lines[0][] = array(
'text' => $order->formatPriceTxt($item->getTaxAmount()),
- 'feed' => $x,
+ 'feed' => 495,
'font' => 'bold',
- 'align' => 'right',
- 'width' => 45,
+ 'align' => 'right'
);
- $x += 45;
- // draw Subtotal
- $subtotal = $item->getRowTotal()
- + $item->getTaxAmount() + $item->getHiddenTaxAmount() - $item->getDiscountAmount();
+ // draw Total (inc)
+ $subtotal = $item->getRowTotal() + $item->getTaxAmount() + $item->getHiddenTaxAmount()
+ - $item->getDiscountAmount();
$lines[0][] = array(
'text' => $order->formatPriceTxt($subtotal),
- 'feed' => $rightBound,
+ 'feed' => 565,
'font' => 'bold',
'align' => 'right'
);
@@ -137,18 +108,16 @@ public function draw()
foreach ($options as $option) {
// draw options label
$lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, true, true),
'font' => 'italic',
- 'feed' => $leftBound
+ 'feed' => 35
);
// draw options value
- $_printValue = isset($option['print_value'])
- ? $option['print_value']
- : strip_tags($option['value']);
+ $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
$lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split($_printValue, 50, true, true),
- 'feed' => $leftBound + 5
+ 'text' => Mage::helper('core/string')->str_split($_printValue, 30, true, true),
+ 'feed' => 40
);
}
}
@@ -173,7 +142,7 @@ public function draw()
$lineBlock = array(
'lines' => $lines,
- 'height' => 10
+ 'height' => 20
);
$page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
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
index ea6190d212..f31bd27421 100644
--- 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
@@ -49,37 +49,41 @@ public function draw()
// draw Product name
$lines[0] = array(array(
- 'text' => Mage::helper('core/string')->str_split($item->getName(), 64, true, true),
+ 'text' => Mage::helper('core/string')->str_split($item->getName(), 35, true, true),
'feed' => 35,
));
// draw SKU
$lines[0][] = array(
- 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
- 'feed' => 255
+ 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 17),
+ 'feed' => 290,
+ 'align' => 'right'
);
// draw QTY
$lines[0][] = array(
- 'text' => $item->getQty()*1,
- 'feed' => 435
+ 'text' => $item->getQty() * 1,
+ 'feed' => 435,
+ 'align' => 'right'
);
// draw item Prices
$i = 0;
$prices = $this->getItemPricesForDisplay();
+ $feedPrice = 395;
+ $feedSubtotal = $feedPrice + 170;
foreach ($prices as $priceData){
if (isset($priceData['label'])) {
// draw Price label
$lines[$i][] = array(
'text' => $priceData['label'],
- 'feed' => 395,
+ 'feed' => $feedPrice,
'align' => 'right'
);
// draw Subtotal label
$lines[$i][] = array(
'text' => $priceData['label'],
- 'feed' => 565,
+ 'feed' => $feedSubtotal,
'align' => 'right'
);
$i++;
@@ -87,14 +91,14 @@ public function draw()
// draw Price
$lines[$i][] = array(
'text' => $priceData['price'],
- 'feed' => 395,
+ 'feed' => $feedPrice,
'font' => 'bold',
'align' => 'right'
);
// draw Subtotal
$lines[$i][] = array(
'text' => $priceData['subtotal'],
- 'feed' => 565,
+ 'feed' => $feedSubtotal,
'font' => 'bold',
'align' => 'right'
);
@@ -115,7 +119,7 @@ public function draw()
foreach ($options as $option) {
// draw options label
$lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true),
+ 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, true, true),
'font' => 'italic',
'feed' => 35
);
@@ -129,7 +133,7 @@ public function draw()
$values = explode(', ', $_printValue);
foreach ($values as $value) {
$lines[][] = array(
- 'text' => Mage::helper('core/string')->str_split($value, 50, true, true),
+ 'text' => Mage::helper('core/string')->str_split($value, 30, true, true),
'feed' => 40
);
}
@@ -157,7 +161,7 @@ public function draw()
$lineBlock = array(
'lines' => $lines,
- 'height' => 10
+ 'height' => 20
);
$page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
diff --git a/app/code/core/Mage/OAuth/Block/Authorize/Style.php b/app/code/core/Mage/OAuth/Block/Authorize/Style.php
deleted file mode 100644
index 0f166479a1..0000000000
--- a/app/code/core/Mage/OAuth/Block/Authorize/Style.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
- */
-class Mage_OAuth_Block_Authorize_Style extends Mage_OAuth_Block_Authorize_Abstract
-{
- /**
- * Set default data
- */
- public function __construct()
- {
- parent::__construct();
-
- //default load template from admin package
- $this->setIsSimple(true);
- }
-
-}
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Admin/Token.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Admin/Token.php
similarity index 88%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Admin/Token.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Admin/Token.php
index 8bbcee994a..39e4cd54c8 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Admin/Token.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Admin/Token.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth consumers grid container block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_Admin_Token extends Mage_Adminhtml_Block_Widget_Grid_Container
+class Mage_Oauth_Block_Adminhtml_Oauth_Admin_Token extends Mage_Adminhtml_Block_Widget_Grid_Container
{
/**
* Construct grid container
@@ -41,7 +41,7 @@ public function __construct()
parent::__construct();
$this->_blockGroup = 'oauth';
- $this->_controller = 'adminhtml_oAuth_admin_token';
+ $this->_controller = 'adminhtml_oauth_admin_token';
$this->_headerText = Mage::helper('adminhtml')->__('My Applications');
$this->_removeButton('add');
}
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Admin/Token/Grid.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Admin/Token/Grid.php
similarity index 90%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Admin/Token/Grid.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Admin/Token/Grid.php
index c7bfbc6b19..5b31968f30 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Admin/Token/Grid.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Admin/Token/Grid.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth My Application grid block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_Admin_Token_Grid extends Mage_Adminhtml_Block_Widget_Grid
+class Mage_Oauth_Block_Adminhtml_Oauth_Admin_Token_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
/**
* Construct grid block
@@ -49,17 +49,17 @@ public function __construct()
/**
* Prepare collection
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_Admin_Token_Grid
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_Admin_Token_Grid
*/
protected function _prepareCollection()
{
/** @var $user Mage_Admin_Model_User */
$user = Mage::getSingleton('admin/session')->getData('user');
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS)
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)
->addFilterByAdminId($user->getId());
$this->setCollection($collection);
@@ -70,7 +70,7 @@ protected function _prepareCollection()
/**
* Prepare columns
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_Admin_Token_Grid
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_Admin_Token_Grid
*/
protected function _prepareColumns()
{
@@ -105,7 +105,7 @@ protected function _prepareColumns()
/**
* Add mass-actions to grid
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_Admin_Token_Grid
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_Admin_Token_Grid
*/
protected function _prepareMassaction()
{
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Authorize.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Authorize.php
similarity index 81%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Authorize.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Authorize.php
index e3174c6e1e..6f1856d56c 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Authorize.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Authorize.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,11 +28,21 @@
* OAuth admin authorization block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_Authorize extends Mage_OAuth_Block_AuthorizeBaseAbstract
+class Mage_Oauth_Block_Adminhtml_Oauth_Authorize extends Mage_Oauth_Block_AuthorizeBaseAbstract
{
+ /**
+ * Retrieve Session Form Key
+ *
+ * @return string
+ */
+ public function getFormKey()
+ {
+ return Mage::getSingleton('core/session')->getFormKey();
+ }
+
/**
* Retrieve admin form posting url
*
@@ -40,11 +50,7 @@ class Mage_OAuth_Block_Adminhtml_OAuth_Authorize extends Mage_OAuth_Block_Author
*/
public function getPostActionUrl()
{
- $params = array();
- if ($this->getIsSimple()) {
- $params['simple'] = 1;
- }
- return $this->getUrl('adminhtml/index/login', $params);
+ return $this->getUrl('*/*/*');
}
/**
@@ -74,6 +80,6 @@ public function getFormTitle()
*/
public function getRejectUrlPath()
{
- return 'adminhtml/oAuth_authorize/reject';
+ return 'adminhtml/oauth_authorize/reject';
}
}
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Authorize/Button.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Authorize/Button.php
similarity index 83%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Authorize/Button.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Authorize/Button.php
index aa6e23537a..9a669327a3 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Authorize/Button.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Authorize/Button.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth authorization block with auth buttons
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_Authorize_Button extends Mage_OAuth_Block_Authorize_ButtonBaseAbstract
+class Mage_Oauth_Block_Adminhtml_Oauth_Authorize_Button extends Mage_Oauth_Block_Authorize_ButtonBaseAbstract
{
/**
* Retrieve confirm authorization url path
@@ -40,7 +40,7 @@ class Mage_OAuth_Block_Adminhtml_OAuth_Authorize_Button extends Mage_OAuth_Block
*/
public function getConfirmUrlPath()
{
- return 'adminhtml/oAuth_authorize/confirm';
+ return 'adminhtml/oauth_authorize/confirm';
}
/**
@@ -50,6 +50,6 @@ public function getConfirmUrlPath()
*/
public function getRejectUrlPath()
{
- return 'adminhtml/oAuth_authorize/reject';
+ return 'adminhtml/oauth_authorize/reject';
}
}
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/AuthorizedTokens.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens.php
similarity index 88%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/AuthorizedTokens.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens.php
index b307a59af9..24fcf69305 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/AuthorizedTokens.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth authorized tokens grid container block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_AuthorizedTokens extends Mage_Adminhtml_Block_Widget_Grid_Container
+class Mage_Oauth_Block_Adminhtml_Oauth_AuthorizedTokens extends Mage_Adminhtml_Block_Widget_Grid_Container
{
/**
* Construct grid container
@@ -41,7 +41,7 @@ public function __construct()
parent::__construct();
$this->_blockGroup = 'oauth';
- $this->_controller = 'adminhtml_oAuth_authorizedTokens';
+ $this->_controller = 'adminhtml_oauth_authorizedTokens';
$this->_headerText = Mage::helper('adminhtml')->__('Authorized OAuth Tokens');
$this->_removeButton('add');
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/AuthorizedTokens/Grid.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens/Grid.php
similarity index 90%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/AuthorizedTokens/Grid.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens/Grid.php
index 69e3d948ac..354b89b9e6 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/AuthorizedTokens/Grid.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens/Grid.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth authorized tokens grid block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_AuthorizedTokens_Grid extends Mage_Adminhtml_Block_Widget_Grid
+class Mage_Oauth_Block_Adminhtml_Oauth_AuthorizedTokens_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
/**
* Construct grid block
@@ -49,14 +49,14 @@ public function __construct()
/**
* Prepare collection
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_AuthorizedTokens_Grid
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_AuthorizedTokens_Grid
*/
protected function _prepareCollection()
{
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS);
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS);
$this->setCollection($collection);
parent::_prepareCollection();
@@ -66,7 +66,7 @@ protected function _prepareCollection()
/**
* Prepare columns
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_AuthorizedTokens_Grid
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_AuthorizedTokens_Grid
*/
protected function _prepareColumns()
{
@@ -125,7 +125,7 @@ public function getGridUrl()
/**
* Get revoke URL
*
- * @param Mage_OAuth_Model_Token $row
+ * @param Mage_Oauth_Model_Token $row
* @return string|null
*/
public function getRevokeUrl($row)
@@ -136,7 +136,7 @@ public function getRevokeUrl($row)
/**
* Get delete URL
*
- * @param Mage_OAuth_Model_Token $row
+ * @param Mage_Oauth_Model_Token $row
* @return string|null
*/
public function getDeleteUrl($row)
@@ -147,7 +147,7 @@ public function getDeleteUrl($row)
/**
* Add mass-actions to grid
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_AuthorizedTokens_Grid
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_AuthorizedTokens_Grid
*/
protected function _prepareMassaction()
{
@@ -179,7 +179,7 @@ protected function _prepareMassaction()
* Decorate user type column
*
* @param string $value
- * @param Mage_OAuth_Model_Token $row
+ * @param Mage_Oauth_Model_Token $row
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
* @param bool $isExport
* @return mixed
@@ -198,7 +198,7 @@ public function decorateUserType($value, $row, $column, $isExport)
* Decorate user type column
*
* @param string $value
- * @param Mage_OAuth_Model_Token $row
+ * @param Mage_Oauth_Model_Token $row
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
* @param bool $isExport
* @return mixed
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer.php
similarity index 90%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer.php
index b4c9dca891..a862047a64 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth consumers grid container block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_Consumer extends Mage_Adminhtml_Block_Widget_Grid_Container
+class Mage_Oauth_Block_Adminhtml_Oauth_Consumer extends Mage_Adminhtml_Block_Widget_Grid_Container
{
/**
* Construct grid container
@@ -41,7 +41,7 @@ public function __construct()
parent::__construct();
$this->_blockGroup = 'oauth';
- $this->_controller = 'adminhtml_oAuth_consumer';
+ $this->_controller = 'adminhtml_oauth_consumer';
$this->_headerText = Mage::helper('adminhtml')->__('OAuth Consumers');
//check allow edit
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Edit.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Edit.php
similarity index 91%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Edit.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Edit.php
index de7eb17b4b..e57262b304 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Edit.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Edit.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -29,22 +29,22 @@
* OAuth Consumer Edit Block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_Consumer_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
+class Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
/**
* Consumer model
*
- * @var Mage_OAuth_Model_Consumer
+ * @var Mage_Oauth_Model_Consumer
*/
protected $_model;
/**
* Get consumer model
*
- * @return Mage_OAuth_Model_Consumer
+ * @return Mage_Oauth_Model_Consumer
*/
public function getModel()
{
@@ -61,7 +61,7 @@ public function __construct()
{
parent::__construct();
$this->_blockGroup = 'oauth';
- $this->_controller = 'adminhtml_oAuth_consumer';
+ $this->_controller = 'adminhtml_oauth_consumer';
$this->_mode = 'edit';
$this->_addButton('save_and_continue', array(
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Edit/Form.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Edit/Form.php
similarity index 93%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Edit/Form.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Edit/Form.php
index 8d27f2a1c4..79283044aa 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Edit/Form.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Edit/Form.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -29,22 +29,22 @@
* OAuth consumer edit form block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_Consumer_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
+class Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
/**
* Consumer model
*
- * @var Mage_OAuth_Model_Consumer
+ * @var Mage_Oauth_Model_Consumer
*/
protected $_model;
/**
* Get consumer model
*
- * @return Mage_OAuth_Model_Consumer
+ * @return Mage_Oauth_Model_Consumer
*/
public function getModel()
{
@@ -57,7 +57,7 @@ public function getModel()
/**
* Prepare form before rendering HTML
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_Consumer_Edit_Form
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Edit_Form
*/
protected function _prepareForm()
{
diff --git a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Grid.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Grid.php
similarity index 91%
rename from app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Grid.php
rename to app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Grid.php
index b97e0aee5b..f27d8b18c1 100644
--- a/app/code/core/Mage/OAuth/Block/Adminhtml/OAuth/Consumer/Grid.php
+++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Grid.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth Consumer grid block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Adminhtml_OAuth_Consumer_Grid extends Mage_Adminhtml_Block_Widget_Grid
+class Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
/**
* Allow edit status
@@ -60,7 +60,7 @@ public function __construct()
/**
* Prepare collection
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_Consumer_Grid
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Grid
*/
protected function _prepareCollection()
{
@@ -73,7 +73,7 @@ protected function _prepareCollection()
/**
* Prepare columns
*
- * @return Mage_OAuth_Block_Adminhtml_OAuth_Consumer_Grid
+ * @return Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Grid
*/
protected function _prepareColumns()
{
@@ -105,7 +105,7 @@ public function getGridUrl()
/**
* Get row URL
*
- * @param Mage_OAuth_Model_Consumer $row
+ * @param Mage_Oauth_Model_Consumer $row
* @return string|null
*/
public function getRowUrl($row)
diff --git a/app/code/core/Mage/OAuth/Block/Authorize.php b/app/code/core/Mage/Oauth/Block/Authorize.php
similarity index 87%
rename from app/code/core/Mage/OAuth/Block/Authorize.php
rename to app/code/core/Mage/Oauth/Block/Authorize.php
index 5aa0c78fd4..b22b4ad7fe 100644
--- a/app/code/core/Mage/OAuth/Block/Authorize.php
+++ b/app/code/core/Mage/Oauth/Block/Authorize.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth authorization block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Authorize extends Mage_OAuth_Block_AuthorizeBaseAbstract
+class Mage_Oauth_Block_Authorize extends Mage_Oauth_Block_AuthorizeBaseAbstract
{
/**
* Retrieve customer form posting url
@@ -44,7 +44,11 @@ public function getPostActionUrl()
$helper = $this->helper('customer');
$url = $helper->getLoginPostUrl();
if ($this->getIsSimple()) {
- $url = rtrim($url, '/') . '/simple/1';
+ if (strstr($url, '?')) {
+ $url .= '&simple=1';
+ } else {
+ $url = rtrim($url, '/') . '/simple/1';
+ }
}
return $url;
}
diff --git a/app/code/core/Mage/OAuth/Block/Authorize/Abstract.php b/app/code/core/Mage/Oauth/Block/Authorize/Abstract.php
similarity index 81%
rename from app/code/core/Mage/OAuth/Block/Authorize/Abstract.php
rename to app/code/core/Mage/Oauth/Block/Authorize/Abstract.php
index 96ec2e751a..632077b585 100644
--- a/app/code/core/Mage/OAuth/Block/Authorize/Abstract.php
+++ b/app/code/core/Mage/Oauth/Block/Authorize/Abstract.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,32 +28,32 @@
* OAuth abstract authorization block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
* @method string getToken()
- * @method Mage_OAuth_Block_AuthorizeBaseAbstract setToken() setToken(string $token)
+ * @method Mage_Oauth_Block_AuthorizeBaseAbstract setToken() setToken(string $token)
* @method boolean getIsSimple()
- * @method Mage_OAuth_Block_Authorize_Button setIsSimple() setIsSimple(boolean $flag)
+ * @method Mage_Oauth_Block_Authorize_Button setIsSimple() setIsSimple(boolean $flag)
* @method boolean getHasException()
- * @method Mage_OAuth_Block_AuthorizeBaseAbstract setIsException() setHasException(boolean $flag)
+ * @method Mage_Oauth_Block_AuthorizeBaseAbstract setIsException() setHasException(boolean $flag)
* @method boolean getVerifier()
- * @method Mage_OAuth_Block_AuthorizeBaseAbstract setVerifier() setVerifier(string $verifier)
+ * @method Mage_Oauth_Block_AuthorizeBaseAbstract setVerifier() setVerifier(string $verifier)
* @method boolean getIsLogged()
- * @method Mage_OAuth_Block_AuthorizeBaseAbstract setIsLogged() setIsLogged(boolean $flag)
+ * @method Mage_Oauth_Block_AuthorizeBaseAbstract setIsLogged() setIsLogged(boolean $flag)
*/
-abstract class Mage_OAuth_Block_Authorize_Abstract extends Mage_Core_Block_Template
+abstract class Mage_Oauth_Block_Authorize_Abstract extends Mage_Core_Block_Template
{
/**
* Helper
*
- * @var Mage_OAuth_Helper_Data
+ * @var Mage_Oauth_Helper_Data
*/
protected $_helper;
/**
* Consumer model
*
- * @var Mage_OAuth_Model_Consumer
+ * @var Mage_Oauth_Model_Consumer
*/
protected $_consumer;
@@ -69,12 +69,12 @@ public function __construct()
/**
* Get consumer instance by token value
*
- * @return Mage_OAuth_Model_Consumer
+ * @return Mage_Oauth_Model_Consumer
*/
public function getConsumer()
{
if (null === $this->_consumer) {
- /** @var $token Mage_OAuth_Model_Token */
+ /** @var $token Mage_Oauth_Model_Token */
$token = Mage::getModel('oauth/token');
$token->load($this->getToken(), 'token');
$this->_consumer = $token->getConsumer();
diff --git a/app/code/core/Mage/OAuth/Block/Authorize/Button.php b/app/code/core/Mage/Oauth/Block/Authorize/Button.php
similarity index 92%
rename from app/code/core/Mage/OAuth/Block/Authorize/Button.php
rename to app/code/core/Mage/Oauth/Block/Authorize/Button.php
index 82eda40c7d..41838886c7 100644
--- a/app/code/core/Mage/OAuth/Block/Authorize/Button.php
+++ b/app/code/core/Mage/Oauth/Block/Authorize/Button.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth authorization block with auth buttons
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Authorize_Button extends Mage_OAuth_Block_Authorize_ButtonBaseAbstract
+class Mage_Oauth_Block_Authorize_Button extends Mage_Oauth_Block_Authorize_ButtonBaseAbstract
{
/**
* Retrieve confirm authorization url path
diff --git a/app/code/core/Mage/OAuth/Block/Authorize/ButtonBaseAbstract.php b/app/code/core/Mage/Oauth/Block/Authorize/ButtonBaseAbstract.php
similarity index 91%
rename from app/code/core/Mage/OAuth/Block/Authorize/ButtonBaseAbstract.php
rename to app/code/core/Mage/Oauth/Block/Authorize/ButtonBaseAbstract.php
index 27199bed54..84efda93a0 100644
--- a/app/code/core/Mage/OAuth/Block/Authorize/ButtonBaseAbstract.php
+++ b/app/code/core/Mage/Oauth/Block/Authorize/ButtonBaseAbstract.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth authorization base abstract block with auth buttons
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-abstract class Mage_OAuth_Block_Authorize_ButtonBaseAbstract extends Mage_OAuth_Block_Authorize_Abstract
+abstract class Mage_Oauth_Block_Authorize_ButtonBaseAbstract extends Mage_Oauth_Block_Authorize_Abstract
{
/**
* Get confirm url path
diff --git a/app/code/core/Mage/OAuth/Block/AuthorizeBaseAbstract.php b/app/code/core/Mage/Oauth/Block/AuthorizeBaseAbstract.php
similarity index 92%
rename from app/code/core/Mage/OAuth/Block/AuthorizeBaseAbstract.php
rename to app/code/core/Mage/Oauth/Block/AuthorizeBaseAbstract.php
index 44d9e60b5a..926dcf2239 100644
--- a/app/code/core/Mage/OAuth/Block/AuthorizeBaseAbstract.php
+++ b/app/code/core/Mage/Oauth/Block/AuthorizeBaseAbstract.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth authorization block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-abstract class Mage_OAuth_Block_AuthorizeBaseAbstract extends Mage_OAuth_Block_Authorize_Abstract
+abstract class Mage_Oauth_Block_AuthorizeBaseAbstract extends Mage_Oauth_Block_Authorize_Abstract
{
/**
* Retrieve user authorize form posting url
diff --git a/app/code/core/Mage/OAuth/Block/Customer/Token/List.php b/app/code/core/Mage/Oauth/Block/Customer/Token/List.php
similarity index 86%
rename from app/code/core/Mage/OAuth/Block/Customer/Token/List.php
rename to app/code/core/Mage/Oauth/Block/Customer/Token/List.php
index d1cc4f04da..9f56424f9a 100644
--- a/app/code/core/Mage/OAuth/Block/Customer/Token/List.php
+++ b/app/code/core/Mage/Oauth/Block/Customer/Token/List.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -29,15 +29,15 @@
* Customer My Applications list block
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Block_Customer_Token_List extends Mage_Customer_Block_Account_Dashboard
+class Mage_Oauth_Block_Customer_Token_List extends Mage_Customer_Block_Account_Dashboard
{
/**
* Collection model
*
- * @var Mage_OAuth_Model_Resource_Token_Collection
+ * @var Mage_Oauth_Model_Resource_Token_Collection
*/
protected $_collection;
@@ -49,10 +49,10 @@ protected function _construct()
/** @var $session Mage_Customer_Model_Session */
$session = Mage::getSingleton('customer/session');
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS)
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)
->addFilterByCustomerId($session->getCustomerId());
$this->_collection = $collection;
}
@@ -80,7 +80,7 @@ public function getToolbarHtml()
/**
* Prepare layout
*
- * @return Mage_OAuth_Block_Customer_Token_List
+ * @return Mage_Oauth_Block_Customer_Token_List
*/
protected function _prepareLayout()
{
@@ -95,7 +95,7 @@ protected function _prepareLayout()
/**
* Get collection
*
- * @return Mage_OAuth_Model_Resource_Token_Collection
+ * @return Mage_Oauth_Model_Resource_Token_Collection
*/
public function getCollection()
{
@@ -105,10 +105,10 @@ public function getCollection()
/**
* Get link for update revoke status
*
- * @param Mage_OAuth_Model_Token $model
+ * @param Mage_Oauth_Model_Token $model
* @return string
*/
- public function getUpdateRevokeLink(Mage_OAuth_Model_Token $model)
+ public function getUpdateRevokeLink(Mage_Oauth_Model_Token $model)
{
return Mage::getUrl('oauth/customer_token/revoke/',
array('id' => $model->getId(), 'status' => (int) !$model->getRevoked()));
@@ -117,10 +117,10 @@ public function getUpdateRevokeLink(Mage_OAuth_Model_Token $model)
/**
* Get delete link
*
- * @param Mage_OAuth_Model_Token $model
+ * @param Mage_Oauth_Model_Token $model
* @return string
*/
- public function getDeleteLink(Mage_OAuth_Model_Token $model)
+ public function getDeleteLink(Mage_Oauth_Model_Token $model)
{
return Mage::getUrl('oauth/customer_token/delete/', array('id' => $model->getId()));
}
diff --git a/app/code/core/Mage/OAuth/Exception.php b/app/code/core/Mage/Oauth/Exception.php
similarity index 90%
rename from app/code/core/Mage/OAuth/Exception.php
rename to app/code/core/Mage/Oauth/Exception.php
index 972d05bc52..ebbfb6eeb3 100644
--- a/app/code/core/Mage/OAuth/Exception.php
+++ b/app/code/core/Mage/Oauth/Exception.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,9 +28,9 @@
* oAuth Exception
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Exception extends Zend_Exception
+class Mage_Oauth_Exception extends Zend_Exception
{
}
diff --git a/app/code/core/Mage/OAuth/Helper/Data.php b/app/code/core/Mage/Oauth/Helper/Data.php
similarity index 74%
rename from app/code/core/Mage/OAuth/Helper/Data.php
rename to app/code/core/Mage/Oauth/Helper/Data.php
index 6443d9156a..fa6b71aab7 100644
--- a/app/code/core/Mage/OAuth/Helper/Data.php
+++ b/app/code/core/Mage/Oauth/Helper/Data.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,18 +28,18 @@
* OAuth Helper
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Helper_Data extends Mage_Core_Helper_Abstract
+class Mage_Oauth_Helper_Data extends Mage_Core_Helper_Abstract
{
/**#@+
* Endpoint types with appropriate routes
*/
const ENDPOINT_AUTHORIZE_CUSTOMER = 'oauth/authorize';
- const ENDPOINT_AUTHORIZE_ADMIN = 'adminhtml/oAuth_authorize';
+ const ENDPOINT_AUTHORIZE_ADMIN = 'adminhtml/oauth_authorize';
const ENDPOINT_AUTHORIZE_CUSTOMER_SIMPLE = 'oauth/authorize/simple';
- const ENDPOINT_AUTHORIZE_ADMIN_SIMPLE = 'adminhtml/oAuth_authorize/simple';
+ const ENDPOINT_AUTHORIZE_ADMIN_SIMPLE = 'adminhtml/oauth_authorize/simple';
const ENDPOINT_INITIATE = 'oauth/initiate';
const ENDPOINT_TOKEN = 'oauth/token';
/**#@-*/
@@ -88,6 +88,7 @@ class Mage_OAuth_Helper_Data extends Mage_Core_Helper_Abstract
*/
protected function _generateRandomString($length)
{
+
/** @var $helper Mage_Core_Helper_Data */
$helper = Mage::helper('core');
@@ -103,7 +104,7 @@ protected function _generateRandomString($length)
*/
public function generateToken()
{
- return $this->_generateRandomString(Mage_OAuth_Model_Token::LENGTH_TOKEN);
+ return $this->_generateRandomString(Mage_Oauth_Model_Token::LENGTH_TOKEN);
}
/**
@@ -113,7 +114,7 @@ public function generateToken()
*/
public function generateTokenSecret()
{
- return $this->_generateRandomString(Mage_OAuth_Model_Token::LENGTH_SECRET);
+ return $this->_generateRandomString(Mage_Oauth_Model_Token::LENGTH_SECRET);
}
/**
@@ -123,7 +124,7 @@ public function generateTokenSecret()
*/
public function generateVerifier()
{
- return $this->_generateRandomString(Mage_OAuth_Model_Token::LENGTH_VERIFIER);
+ return $this->_generateRandomString(Mage_Oauth_Model_Token::LENGTH_VERIFIER);
}
/**
@@ -133,7 +134,7 @@ public function generateVerifier()
*/
public function generateConsumerKey()
{
- return $this->_generateRandomString(Mage_OAuth_Model_Consumer::KEY_LENGTH);
+ return $this->_generateRandomString(Mage_Oauth_Model_Consumer::KEY_LENGTH);
}
/**
@@ -143,25 +144,25 @@ public function generateConsumerKey()
*/
public function generateConsumerSecret()
{
- return $this->_generateRandomString(Mage_OAuth_Model_Consumer::SECRET_LENGTH);
+ return $this->_generateRandomString(Mage_Oauth_Model_Consumer::SECRET_LENGTH);
}
/**
* Return complete callback URL or boolean FALSE if no callback provided
*
- * @param Mage_OAuth_Model_Token $token Token object
+ * @param Mage_Oauth_Model_Token $token Token object
* @param bool $rejected OPTIONAL Add user reject sign
* @return bool|string
*/
- public function getFullCallbackUrl(Mage_OAuth_Model_Token $token, $rejected = false)
+ public function getFullCallbackUrl(Mage_Oauth_Model_Token $token, $rejected = false)
{
$callbackUrl = $token->getCallbackUrl();
- if (Mage_OAuth_Model_Server::CALLBACK_ESTABLISHED == $callbackUrl) {
+ if (Mage_Oauth_Model_Server::CALLBACK_ESTABLISHED == $callbackUrl) {
return false;
}
if ($rejected) {
- /** @var $consumer Mage_OAuth_Model_Consumer */
+ /** @var $consumer Mage_Oauth_Model_Consumer */
$consumer = Mage::getModel('oauth/consumer')->load($token->getConsumerId());
if ($consumer->getId() && $consumer->getRejectedCallbackUrl()) {
@@ -242,4 +243,60 @@ public function sendNotificationOnTokenStatusChange($userEmail, $userName, $appl
)
);
}
+
+ /**
+ * Is current authorize page is simple
+ *
+ * @return boolean
+ */
+ protected function _getIsSimple()
+ {
+ $simple = false;
+ if (stristr($this->_getRequest()->getActionName(), 'simple')
+ || !is_null($this->_getRequest()->getParam('simple', null))
+ ) {
+ $simple = true;
+ }
+
+ return $simple;
+ }
+
+ /**
+ * Get authorize endpoint url
+ *
+ * @param string $userType
+ * @return string
+ */
+ public function getAuthorizeUrl($userType)
+ {
+ $simple = $this->_getIsSimple();
+
+ if (Mage_Oauth_Model_Token::USER_TYPE_CUSTOMER == $userType) {
+ if ($simple) {
+ $route = self::ENDPOINT_AUTHORIZE_CUSTOMER_SIMPLE;
+ } else {
+ $route = self::ENDPOINT_AUTHORIZE_CUSTOMER;
+ }
+ } elseif (Mage_Oauth_Model_Token::USER_TYPE_ADMIN == $userType) {
+ if ($simple) {
+ $route = self::ENDPOINT_AUTHORIZE_ADMIN_SIMPLE;
+ } else {
+ $route = self::ENDPOINT_AUTHORIZE_ADMIN;
+ }
+ } else {
+ throw new Exception('Invalid user type.');
+ }
+
+ return $this->_getUrl($route, array('_query' => array('oauth_token' => $this->getOauthToken())));
+ }
+
+ /**
+ * Retrieve oauth_token param from request
+ *
+ * @return string|null
+ */
+ public function getOauthToken()
+ {
+ return $this->_getRequest()->getParam('oauth_token', null);
+ }
}
diff --git a/app/code/core/Mage/OAuth/Model/Consumer.php b/app/code/core/Mage/Oauth/Model/Consumer.php
similarity index 76%
rename from app/code/core/Mage/OAuth/Model/Consumer.php
rename to app/code/core/Mage/Oauth/Model/Consumer.php
index c67a336ef1..7fce3a9589 100644
--- a/app/code/core/Mage/OAuth/Model/Consumer.php
+++ b/app/code/core/Mage/Oauth/Model/Consumer.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,28 +28,28 @@
* Application model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
- * @method Mage_OAuth_Model_Resource_Consumer _getResource()
- * @method Mage_OAuth_Model_Resource_Consumer getResource()
- * @method Mage_OAuth_Model_Resource_Consumer_Collection getCollection()
- * @method Mage_OAuth_Model_Resource_Consumer_Collection getResourceCollection()
+ * @method Mage_Oauth_Model_Resource_Consumer _getResource()
+ * @method Mage_Oauth_Model_Resource_Consumer getResource()
+ * @method Mage_Oauth_Model_Resource_Consumer_Collection getCollection()
+ * @method Mage_Oauth_Model_Resource_Consumer_Collection getResourceCollection()
* @method string getName()
- * @method Mage_OAuth_Model_Consumer setName() setName(string $name)
+ * @method Mage_Oauth_Model_Consumer setName() setName(string $name)
* @method string getKey()
- * @method Mage_OAuth_Model_Consumer setKey() setKey(string $key)
+ * @method Mage_Oauth_Model_Consumer setKey() setKey(string $key)
* @method string getSecret()
- * @method Mage_OAuth_Model_Consumer setSecret() setSecret(string $secret)
+ * @method Mage_Oauth_Model_Consumer setSecret() setSecret(string $secret)
* @method string getCallbackUrl()
- * @method Mage_OAuth_Model_Consumer setCallbackUrl() setCallbackUrl(string $url)
+ * @method Mage_Oauth_Model_Consumer setCallbackUrl() setCallbackUrl(string $url)
* @method string getCreatedAt()
- * @method Mage_OAuth_Model_Consumer setCreatedAt() setCreatedAt(string $date)
+ * @method Mage_Oauth_Model_Consumer setCreatedAt() setCreatedAt(string $date)
* @method string getUpdatedAt()
- * @method Mage_OAuth_Model_Consumer setUpdatedAt() setUpdatedAt(string $date)
+ * @method Mage_Oauth_Model_Consumer setUpdatedAt() setUpdatedAt(string $date)
* @method string getRejectedCallbackUrl()
- * @method Mage_OAuth_Model_Consumer setRejectedCallbackUrl() setRejectedCallbackUrl(string $rejectedCallbackUrl)
+ * @method Mage_Oauth_Model_Consumer setRejectedCallbackUrl() setRejectedCallbackUrl(string $rejectedCallbackUrl)
*/
-class Mage_OAuth_Model_Consumer extends Mage_Core_Model_Abstract
+class Mage_Oauth_Model_Consumer extends Mage_Core_Model_Abstract
{
/**
* Key hash length
@@ -74,7 +74,7 @@ protected function _construct()
/**
* BeforeSave actions
*
- * @return Mage_OAuth_Model_Consumer
+ * @return Mage_Oauth_Model_Consumer
*/
protected function _beforeSave()
{
@@ -109,10 +109,8 @@ public function validate()
}
}
- /** @var $validatorLength Mage_OAuth_Model_Consumer_Validator_KeyLength */
- $validatorLength = Mage::getModel(
- 'oauth/consumer_validator_keyLength',
- array('length' => self::KEY_LENGTH));
+ /** @var $validatorLength Mage_Oauth_Model_Consumer_Validator_KeyLength */
+ $validatorLength = Mage::getModel('oauth/consumer_validator_keyLength', array('length' => self::KEY_LENGTH));
$validatorLength->setName('Consumer Key');
if (!$validatorLength->isValid($this->getKey())) {
diff --git a/app/code/core/Mage/OAuth/Model/Consumer/Validator/KeyLength.php b/app/code/core/Mage/Oauth/Model/Consumer/Validator/KeyLength.php
similarity index 92%
rename from app/code/core/Mage/OAuth/Model/Consumer/Validator/KeyLength.php
rename to app/code/core/Mage/Oauth/Model/Consumer/Validator/KeyLength.php
index bee2243f84..b1fc2345d0 100644
--- a/app/code/core/Mage/OAuth/Model/Consumer/Validator/KeyLength.php
+++ b/app/code/core/Mage/Oauth/Model/Consumer/Validator/KeyLength.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* Validate OAuth keys
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Consumer_Validator_KeyLength extends Zend_Validate_StringLength
+class Mage_Oauth_Model_Consumer_Validator_KeyLength extends Zend_Validate_StringLength
{
/**
* Key name
@@ -69,7 +69,7 @@ public function __construct($options = array())
/**
* Init validation failure message template definitions
*
- * @return Mage_OAuth_Model_Consumer_Validator_KeyLength
+ * @return Mage_Oauth_Model_Consumer_Validator_KeyLength
*/
protected function _initMessageTemplates()
{
@@ -96,7 +96,7 @@ protected function _initMessageTemplates()
* Set length
*
* @param $length
- * @return Mage_OAuth_Model_Consumer_Validator_KeyLength
+ * @return Mage_Oauth_Model_Consumer_Validator_KeyLength
*/
public function setLength($length)
{
@@ -137,7 +137,7 @@ public function isValid($value)
* Set key name
*
* @param string $name
- * @return Mage_OAuth_Model_Consumer_Validator_KeyLength
+ * @return Mage_Oauth_Model_Consumer_Validator_KeyLength
*/
public function setName($name)
{
diff --git a/app/code/core/Mage/OAuth/Model/Nonce.php b/app/code/core/Mage/Oauth/Model/Nonce.php
similarity index 78%
rename from app/code/core/Mage/OAuth/Model/Nonce.php
rename to app/code/core/Mage/Oauth/Model/Nonce.php
index ce92f848c3..7bb84d2b59 100644
--- a/app/code/core/Mage/OAuth/Model/Nonce.php
+++ b/app/code/core/Mage/Oauth/Model/Nonce.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -29,16 +29,16 @@
* oAuth nonce model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
* @method string getNonce()
- * @method Mage_OAuth_Model_Nonce setNonce() setNonce(string $nonce)
+ * @method Mage_Oauth_Model_Nonce setNonce() setNonce(string $nonce)
* @method string getTimestamp()
- * @method Mage_OAuth_Model_Nonce setTimestamp() setTimestamp(string $timestamp)
- * @method Mage_OAuth_Model_Resource_Nonce getResource()
- * @method Mage_OAuth_Model_Resource_Nonce _getResource()
+ * @method Mage_Oauth_Model_Nonce setTimestamp() setTimestamp(string $timestamp)
+ * @method Mage_Oauth_Model_Resource_Nonce getResource()
+ * @method Mage_Oauth_Model_Resource_Nonce _getResource()
*/
-class Mage_OAuth_Model_Nonce extends Mage_Core_Model_Abstract
+class Mage_Oauth_Model_Nonce extends Mage_Core_Model_Abstract
{
/**
* Initialize resource model
@@ -53,14 +53,14 @@ protected function _construct()
/**
* "After save" actions
*
- * @return Mage_OAuth_Model_Nonce
+ * @return Mage_Oauth_Model_Nonce
*/
protected function _afterSave()
{
parent::_afterSave();
//Cleanup old entries
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
if ($helper->isCleanupProbability()) {
$this->_getResource()->deleteOldEntries($helper->getCleanupExpirationPeriod());
diff --git a/app/code/core/Mage/OAuth/Model/Observer.php b/app/code/core/Mage/Oauth/Model/Observer.php
similarity index 53%
rename from app/code/core/Mage/OAuth/Model/Observer.php
rename to app/code/core/Mage/Oauth/Model/Observer.php
index 6232a69b2c..05ae5c2195 100644
--- a/app/code/core/Mage/OAuth/Model/Observer.php
+++ b/app/code/core/Mage/Oauth/Model/Observer.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,40 +28,11 @@
* OAuth observer
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Observer
+class Mage_Oauth_Model_Observer
{
- /**
- * Get callback url
- *
- * @param string $userType
- * @return string
- */
- protected function _getAfterAuthUrl($userType)
- {
- $simple = Mage::app()->getRequest()->getParam('simple');
-
- if (Mage_OAuth_Model_Token::USER_TYPE_CUSTOMER == $userType) {
- if ($simple) {
- $route = Mage_OAuth_Helper_Data::ENDPOINT_AUTHORIZE_CUSTOMER_SIMPLE;
- } else {
- $route = Mage_OAuth_Helper_Data::ENDPOINT_AUTHORIZE_CUSTOMER;
- }
- } elseif (Mage_OAuth_Model_Token::USER_TYPE_ADMIN == $userType) {
- if ($simple) {
- $route = Mage_OAuth_Helper_Data::ENDPOINT_AUTHORIZE_ADMIN_SIMPLE;
- } else {
- $route = Mage_OAuth_Helper_Data::ENDPOINT_AUTHORIZE_ADMIN;
- }
- } else {
- throw new Exception('Invalid user type.');
- }
-
- return Mage::getUrl($route, array('_query' => array('oauth_token' => $this->_getOauthToken())));
- }
-
/**
* Retrieve oauth_token param from request
*
@@ -69,21 +40,24 @@ protected function _getAfterAuthUrl($userType)
*/
protected function _getOauthToken()
{
- return Mage::app()->getRequest()->getParam('oauth_token', null);
+ return Mage::helper('oauth')->getOauthToken();
}
/**
- * Redirect customer to callback page after login success
+ * Redirect customer to callback page after login
*
* @param Varien_Event_Observer $observer
- * @return void
*/
public function afterCustomerLogin(Varien_Event_Observer $observer)
{
if (null !== $this->_getOauthToken()) {
- /** @var $session Mage_Customer_Model_Session */
- $session = Mage::getSingleton('customer/session');
- $session->setAfterAuthUrl($this->_getAfterAuthUrl(Mage_OAuth_Model_Token::USER_TYPE_CUSTOMER));
+ $userType = Mage_Oauth_Model_Token::USER_TYPE_CUSTOMER;
+ $url = Mage::helper('oauth')->getAuthorizeUrl($userType);
+ Mage::app()->getResponse()
+ ->setRedirect($url)
+ ->sendHeaders()
+ ->sendResponse();
+ exit();
}
}
@@ -91,21 +65,25 @@ public function afterCustomerLogin(Varien_Event_Observer $observer)
* Redirect admin to authorize controller after login success
*
* @param Varien_Event_Observer $observer
- * @return void
*/
public function afterAdminLogin(Varien_Event_Observer $observer)
{
if (null !== $this->_getOauthToken()) {
- $userType = Mage_OAuth_Model_Token::USER_TYPE_ADMIN;
-
- $url = $this->_getAfterAuthUrl($userType);
+ $userType = Mage_Oauth_Model_Token::USER_TYPE_ADMIN;
+ $url = Mage::helper('oauth')->getAuthorizeUrl($userType);
Mage::app()->getResponse()
->setRedirect($url)
->sendHeaders()
->sendResponse();
+ exit();
}
}
+ /**
+ * Redirect admin to authorize controller after login fail
+ *
+ * @param Varien_Event_Observer $observer
+ */
public function afterAdminLoginFailed(Varien_Event_Observer $observer)
{
if (null !== $this->_getOauthToken()) {
@@ -113,19 +91,13 @@ public function afterAdminLoginFailed(Varien_Event_Observer $observer)
$session = Mage::getSingleton('admin/session');
$session->addError($observer->getException()->getMessage());
- $params = array('oauth_token' => $this->_getOauthToken());
-
- if (Mage::app()->getRequest()->getParam('simple')) {
- $route = Mage_OAuth_Helper_Data::ENDPOINT_AUTHORIZE_ADMIN_SIMPLE;
- } else {
- $route = Mage_OAuth_Helper_Data::ENDPOINT_AUTHORIZE_ADMIN;
- }
- $url = Mage::getUrl($route, array('_query' => $params));
-
+ $userType = Mage_Oauth_Model_Token::USER_TYPE_ADMIN;
+ $url = Mage::helper('oauth')->getAuthorizeUrl($userType);
Mage::app()->getResponse()
->setRedirect($url)
->sendHeaders()
->sendResponse();
+ exit();
}
}
}
diff --git a/app/code/core/Mage/OAuth/Model/Resource/Consumer.php b/app/code/core/Mage/Oauth/Model/Resource/Consumer.php
similarity index 91%
rename from app/code/core/Mage/OAuth/Model/Resource/Consumer.php
rename to app/code/core/Mage/Oauth/Model/Resource/Consumer.php
index ade3cad2af..0327282a98 100644
--- a/app/code/core/Mage/OAuth/Model/Resource/Consumer.php
+++ b/app/code/core/Mage/Oauth/Model/Resource/Consumer.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth Application resource model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Resource_Consumer extends Mage_Core_Model_Resource_Db_Abstract
+class Mage_Oauth_Model_Resource_Consumer extends Mage_Core_Model_Resource_Db_Abstract
{
/**
* Initialize resource model
diff --git a/app/code/core/Mage/OAuth/Model/Resource/Consumer/Collection.php b/app/code/core/Mage/Oauth/Model/Resource/Consumer/Collection.php
similarity index 91%
rename from app/code/core/Mage/OAuth/Model/Resource/Consumer/Collection.php
rename to app/code/core/Mage/Oauth/Model/Resource/Consumer/Collection.php
index b9e5859e86..7f08303b98 100644
--- a/app/code/core/Mage/OAuth/Model/Resource/Consumer/Collection.php
+++ b/app/code/core/Mage/Oauth/Model/Resource/Consumer/Collection.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth Application resource collection model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Resource_Consumer_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
+class Mage_Oauth_Model_Resource_Consumer_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
/**
* Initialize collection model
diff --git a/app/code/core/Mage/OAuth/Model/Resource/Nonce.php b/app/code/core/Mage/Oauth/Model/Resource/Nonce.php
similarity index 93%
rename from app/code/core/Mage/OAuth/Model/Resource/Nonce.php
rename to app/code/core/Mage/Oauth/Model/Resource/Nonce.php
index eaa744df57..d3b2051eb9 100644
--- a/app/code/core/Mage/OAuth/Model/Resource/Nonce.php
+++ b/app/code/core/Mage/Oauth/Model/Resource/Nonce.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* oAuth nonce resource model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Resource_Nonce extends Mage_Core_Model_Resource_Db_Abstract
+class Mage_Oauth_Model_Resource_Nonce extends Mage_Core_Model_Resource_Db_Abstract
{
/**
* Initialize resource model
diff --git a/app/code/core/Mage/OAuth/Model/Resource/Nonce/Collection.php b/app/code/core/Mage/Oauth/Model/Resource/Nonce/Collection.php
similarity index 91%
rename from app/code/core/Mage/OAuth/Model/Resource/Nonce/Collection.php
rename to app/code/core/Mage/Oauth/Model/Resource/Nonce/Collection.php
index 542e113448..02ff3da628 100644
--- a/app/code/core/Mage/OAuth/Model/Resource/Nonce/Collection.php
+++ b/app/code/core/Mage/Oauth/Model/Resource/Nonce/Collection.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth nonce resource collection model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Resource_Nonce_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
+class Mage_Oauth_Model_Resource_Nonce_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
/**
* Initialize collection model
diff --git a/app/code/core/Mage/OAuth/Model/Resource/Setup.php b/app/code/core/Mage/Oauth/Model/Resource/Setup.php
similarity index 90%
rename from app/code/core/Mage/OAuth/Model/Resource/Setup.php
rename to app/code/core/Mage/Oauth/Model/Resource/Setup.php
index facf382388..4c74e7cf15 100644
--- a/app/code/core/Mage/OAuth/Model/Resource/Setup.php
+++ b/app/code/core/Mage/Oauth/Model/Resource/Setup.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,9 +28,9 @@
* OAuth setup model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
+class Mage_Oauth_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{
}
diff --git a/app/code/core/Mage/OAuth/Model/Resource/Token.php b/app/code/core/Mage/Oauth/Model/Resource/Token.php
similarity index 90%
rename from app/code/core/Mage/OAuth/Model/Resource/Token.php
rename to app/code/core/Mage/Oauth/Model/Resource/Token.php
index 9c16fcfc98..1afeb5a7b0 100644
--- a/app/code/core/Mage/OAuth/Model/Resource/Token.php
+++ b/app/code/core/Mage/Oauth/Model/Resource/Token.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth token resource model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Resource_Token extends Mage_Core_Model_Resource_Db_Abstract
+class Mage_Oauth_Model_Resource_Token extends Mage_Core_Model_Resource_Db_Abstract
{
/**
* Initialize resource model
@@ -46,10 +46,10 @@ protected function _construct()
/**
* Clean up old authorized tokens for specified consumer-user pairs
*
- * @param Mage_OAuth_Model_Token $exceptToken Token just created to exclude from delete
+ * @param Mage_Oauth_Model_Token $exceptToken Token just created to exclude from delete
* @return int The number of affected rows
*/
- public function cleanOldAuthorizedTokensExcept(Mage_OAuth_Model_Token $exceptToken)
+ public function cleanOldAuthorizedTokensExcept(Mage_Oauth_Model_Token $exceptToken)
{
if (!$exceptToken->getId() || !$exceptToken->getAuthorized()) {
Mage::throwException('Invalid token to except');
@@ -84,7 +84,7 @@ public function deleteOldEntries($minutes)
return $adapter->delete(
$this->getMainTable(),
$adapter->quoteInto(
- 'type = "' . Mage_OAuth_Model_Token::TYPE_REQUEST . '" AND created_at <= ?',
+ 'type = "' . Mage_Oauth_Model_Token::TYPE_REQUEST . '" AND created_at <= ?',
Varien_Date::formatDate(time() - $minutes * 60)
)
);
diff --git a/app/code/core/Mage/OAuth/Model/Resource/Token/Collection.php b/app/code/core/Mage/Oauth/Model/Resource/Token/Collection.php
similarity index 85%
rename from app/code/core/Mage/OAuth/Model/Resource/Token/Collection.php
rename to app/code/core/Mage/Oauth/Model/Resource/Token/Collection.php
index 418941f8e6..67974a1866 100644
--- a/app/code/core/Mage/OAuth/Model/Resource/Token/Collection.php
+++ b/app/code/core/Mage/Oauth/Model/Resource/Token/Collection.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* OAuth token resource collection model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Resource_Token_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
+class Mage_Oauth_Model_Resource_Token_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
/**
* Initialize collection model
@@ -48,7 +48,7 @@ protected function _construct()
*
* Method use for show applications list (token-consumer)
*
- * @return Mage_OAuth_Model_Resource_Token_Collection
+ * @return Mage_Oauth_Model_Resource_Token_Collection
*/
public function joinConsumerAsApplication()
{
@@ -66,7 +66,7 @@ public function joinConsumerAsApplication()
* Add filter by admin ID
*
* @param int $adminId
- * @return Mage_OAuth_Model_Resource_Token_Collection
+ * @return Mage_Oauth_Model_Resource_Token_Collection
*/
public function addFilterByAdminId($adminId)
{
@@ -78,7 +78,7 @@ public function addFilterByAdminId($adminId)
* Add filter by customer ID
*
* @param int $customerId
- * @return Mage_OAuth_Model_Resource_Token_Collection
+ * @return Mage_Oauth_Model_Resource_Token_Collection
*/
public function addFilterByCustomerId($customerId)
{
@@ -90,7 +90,7 @@ public function addFilterByCustomerId($customerId)
* Add filter by consumer ID
*
* @param int $consumerId
- * @return Mage_OAuth_Model_Resource_Token_Collection
+ * @return Mage_Oauth_Model_Resource_Token_Collection
*/
public function addFilterByConsumerId($consumerId)
{
@@ -102,7 +102,7 @@ public function addFilterByConsumerId($consumerId)
* Add filter by type
*
* @param string $type
- * @return Mage_OAuth_Model_Resource_Token_Collection
+ * @return Mage_Oauth_Model_Resource_Token_Collection
*/
public function addFilterByType($type)
{
@@ -114,7 +114,7 @@ public function addFilterByType($type)
* Add filter by ID
*
* @param array|int $id
- * @return Mage_OAuth_Model_Resource_Token_Collection
+ * @return Mage_Oauth_Model_Resource_Token_Collection
*/
public function addFilterById($id)
{
@@ -126,7 +126,7 @@ public function addFilterById($id)
* Add filter by "Is Revoked" status
*
* @param bool|int $flag
- * @return Mage_OAuth_Model_Resource_Token_Collection
+ * @return Mage_Oauth_Model_Resource_Token_Collection
*/
public function addFilterByRevoked($flag)
{
diff --git a/app/code/core/Mage/OAuth/Model/Server.php b/app/code/core/Mage/Oauth/Model/Server.php
similarity index 95%
rename from app/code/core/Mage/OAuth/Model/Server.php
rename to app/code/core/Mage/Oauth/Model/Server.php
index 892260ad37..b5fdb2c2f1 100644
--- a/app/code/core/Mage/OAuth/Model/Server.php
+++ b/app/code/core/Mage/Oauth/Model/Server.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* oAuth Server
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Model_Server
+class Mage_Oauth_Model_Server
{
/**#@+
* OAuth result statuses
@@ -95,7 +95,7 @@ class Mage_OAuth_Model_Server
/**
* Consumer object
*
- * @var Mage_OAuth_Model_Consumer
+ * @var Mage_Oauth_Model_Consumer
*/
protected $_consumer;
@@ -183,7 +183,7 @@ class Mage_OAuth_Model_Server
/**
* Token object
*
- * @var Mage_OAuth_Model_Token
+ * @var Mage_Oauth_Model_Token
*/
protected $_token;
@@ -209,7 +209,7 @@ public function __construct($request = null)
* Retrieve protocol and request parameters from request object
*
* @link http://tools.ietf.org/html/rfc5849#section-3.5
- * @return Mage_OAuth_Model_Server
+ * @return Mage_Oauth_Model_Server
*/
protected function _fetchParams()
{
@@ -266,7 +266,7 @@ protected function _fetchParams()
/**
* Retrieve protocol parameters from query string
*
- * @return Mage_OAuth_Model_Server
+ * @return Mage_Oauth_Model_Server
*/
protected function _fetchProtocolParamsFromQuery()
{
@@ -294,7 +294,7 @@ protected function _getResponse()
/**
* Initialize consumer
*
- * @throws Mage_OAuth_Exception
+ * @throws Mage_Oauth_Exception
*/
protected function _initConsumer()
{
@@ -310,8 +310,8 @@ protected function _initConsumer()
/**
* Load token object, validate it depending on request type, set access data and save
*
- * @return Mage_OAuth_Model_Server
- * @throws Mage_OAuth_Exception
+ * @return Mage_Oauth_Model_Server
+ * @throws Mage_Oauth_Exception
*/
protected function _initToken()
{
@@ -334,7 +334,7 @@ protected function _initToken()
if ($this->_token->getConsumerId() != $this->_consumer->getId()) {
$this->_throwException('', self::ERR_TOKEN_REJECTED);
}
- if (Mage_OAuth_Model_Token::TYPE_REQUEST != $this->_token->getType()) {
+ if (Mage_Oauth_Model_Token::TYPE_REQUEST != $this->_token->getType()) {
$this->_throwException('', self::ERR_TOKEN_USED);
}
} elseif (self::REQUEST_AUTHORIZE == $this->_requestType) {
@@ -342,7 +342,7 @@ protected function _initToken()
$this->_throwException('', self::ERR_TOKEN_USED);
}
} elseif (self::REQUEST_RESOURCE == $this->_requestType) {
- if (Mage_OAuth_Model_Token::TYPE_ACCESS != $this->_token->getType()) {
+ if (Mage_Oauth_Model_Token::TYPE_ACCESS != $this->_token->getType()) {
$this->_throwException('', self::ERR_TOKEN_REJECTED);
}
if ($this->_token->getRevoked()) {
@@ -371,7 +371,7 @@ protected function _isProtocolParameter($attrName)
* Extract parameters from sources (GET, FormBody, Authorization header), decode them and validate
*
* @param string $requestType Request type - one of REQUEST_... class constant
- * @return Mage_OAuth_Model_Server
+ * @return Mage_Oauth_Model_Server
* @throws Mage_Core_Exception
*/
protected function _processRequest($requestType)
@@ -429,11 +429,11 @@ protected function _saveToken()
*
* @param string $message Exception message
* @param int $code Exception code
- * @throws Mage_OAuth_Exception
+ * @throws Mage_Oauth_Exception
*/
protected function _throwException($message = '', $code = 0)
{
- throw Mage::exception('Mage_OAuth', $message, $code);
+ throw Mage::exception('Mage_Oauth', $message, $code);
}
/**
@@ -467,7 +467,7 @@ protected function _validateNonce($nonce, $timestamp)
if ($timestamp <= 0 || $timestamp > (time() + self::TIME_DEVIATION)) {
$this->_throwException('', self::ERR_TIMESTAMP_REFUSED);
}
- /** @var $nonceObj Mage_OAuth_Model_Nonce */
+ /** @var $nonceObj Mage_Oauth_Model_Nonce */
$nonceObj = Mage::getModel('oauth/nonce');
$nonceObj->load($nonce, 'nonce');
@@ -483,7 +483,7 @@ protected function _validateNonce($nonce, $timestamp)
/**
* Validate protocol parameters
*
- * @throws Mage_OAuth_Exception
+ * @throws Mage_Oauth_Exception
*/
protected function _validateProtocolParams()
{
@@ -504,7 +504,7 @@ protected function _validateProtocolParams()
}
}
// validate consumer key length
- if (strlen($this->_protocolParams['oauth_consumer_key']) != Mage_OAuth_Model_Consumer::KEY_LENGTH) {
+ if (strlen($this->_protocolParams['oauth_consumer_key']) != Mage_Oauth_Model_Consumer::KEY_LENGTH) {
$this->_throwException('', self::ERR_CONSUMER_KEY_REJECTED);
}
// validate signature method
@@ -526,7 +526,7 @@ protected function _validateProtocolParams()
/**
* Validate signature
*
- * @throws Mage_OAuth_Exception
+ * @throws Mage_Oauth_Exception
*/
protected function _validateSignature()
{
@@ -557,7 +557,7 @@ protected function _validateTokenParam()
if (!is_string($this->_protocolParams['oauth_token'])) {
$this->_throwException('', self::ERR_TOKEN_REJECTED);
}
- if (strlen($this->_protocolParams['oauth_token']) != Mage_OAuth_Model_Token::LENGTH_TOKEN) {
+ if (strlen($this->_protocolParams['oauth_token']) != Mage_Oauth_Model_Token::LENGTH_TOKEN) {
$this->_throwException('', self::ERR_TOKEN_REJECTED);
}
}
@@ -573,7 +573,7 @@ protected function _validateVerifierParam()
if (!is_string($this->_protocolParams['oauth_verifier'])) {
$this->_throwException('', self::ERR_VERIFIER_INVALID);
}
- if (strlen($this->_protocolParams['oauth_verifier']) != Mage_OAuth_Model_Token::LENGTH_VERIFIER) {
+ if (strlen($this->_protocolParams['oauth_verifier']) != Mage_Oauth_Model_Token::LENGTH_VERIFIER) {
$this->_throwException('', self::ERR_VERIFIER_INVALID);
}
}
@@ -598,7 +598,7 @@ public function accessToken()
*
* @param int $userId Authorization user identifier
* @param string $userType Authorization user type
- * @return Mage_OAuth_Model_Token
+ * @return Mage_Oauth_Model_Token
*/
public function authorizeToken($userId, $userType)
{
@@ -612,7 +612,7 @@ public function authorizeToken($userId, $userType)
/**
* Validate request with access token for specified URL
*
- * @return Mage_OAuth_Model_Token
+ * @return Mage_Oauth_Model_Token
*/
public function checkAccessRequest()
{
@@ -624,7 +624,7 @@ public function checkAccessRequest()
/**
* Check authorize request for validity and return token
*
- * @return Mage_OAuth_Model_Token
+ * @return Mage_Oauth_Model_Token
*/
public function checkAuthorizeRequest()
{
@@ -675,7 +675,7 @@ public function reportProblem(Exception $e, Zend_Controller_Response_Http $respo
{
$eMsg = $e->getMessage();
- if ($e instanceof Mage_OAuth_Exception) {
+ if ($e instanceof Mage_Oauth_Exception) {
$eCode = $e->getCode();
if (isset($this->_errors[$eCode])) {
@@ -708,7 +708,7 @@ public function reportProblem(Exception $e, Zend_Controller_Response_Http $respo
* Set response object
*
* @param Zend_Controller_Response_Http $response
- * @return Mage_OAuth_Model_Server
+ * @return Mage_Oauth_Model_Server
*/
public function setResponse(Zend_Controller_Response_Http $response)
{
diff --git a/app/code/core/Mage/OAuth/Model/Token.php b/app/code/core/Mage/Oauth/Model/Token.php
similarity index 81%
rename from app/code/core/Mage/OAuth/Model/Token.php
rename to app/code/core/Mage/Oauth/Model/Token.php
index 404e9cb00a..4f190eb0f5 100644
--- a/app/code/core/Mage/OAuth/Model/Token.php
+++ b/app/code/core/Mage/Oauth/Model/Token.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,37 +28,37 @@
* oAuth token model
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
* @method string getName() Consumer name (joined from consumer table)
- * @method Mage_OAuth_Model_Resource_Token_Collection getCollection()
- * @method Mage_OAuth_Model_Resource_Token_Collection getResourceCollection()
- * @method Mage_OAuth_Model_Resource_Token getResource()
- * @method Mage_OAuth_Model_Resource_Token _getResource()
+ * @method Mage_Oauth_Model_Resource_Token_Collection getCollection()
+ * @method Mage_Oauth_Model_Resource_Token_Collection getResourceCollection()
+ * @method Mage_Oauth_Model_Resource_Token getResource()
+ * @method Mage_Oauth_Model_Resource_Token _getResource()
* @method int getConsumerId()
- * @method Mage_OAuth_Model_Token setConsumerId() setConsumerId(int $consumerId)
+ * @method Mage_Oauth_Model_Token setConsumerId() setConsumerId(int $consumerId)
* @method int getAdminId()
- * @method Mage_OAuth_Model_Token setAdminId() setAdminId(int $adminId)
+ * @method Mage_Oauth_Model_Token setAdminId() setAdminId(int $adminId)
* @method int getCustomerId()
- * @method Mage_OAuth_Model_Token setCustomerId() setCustomerId(int $customerId)
+ * @method Mage_Oauth_Model_Token setCustomerId() setCustomerId(int $customerId)
* @method string getType()
- * @method Mage_OAuth_Model_Token setType() setType(string $type)
+ * @method Mage_Oauth_Model_Token setType() setType(string $type)
* @method string getVerifier()
- * @method Mage_OAuth_Model_Token setVerifier() setVerifier(string $verifier)
+ * @method Mage_Oauth_Model_Token setVerifier() setVerifier(string $verifier)
* @method string getCallbackUrl()
- * @method Mage_OAuth_Model_Token setCallbackUrl() setCallbackUrl(string $callbackUrl)
+ * @method Mage_Oauth_Model_Token setCallbackUrl() setCallbackUrl(string $callbackUrl)
* @method string getCreatedAt()
- * @method Mage_OAuth_Model_Token setCreatedAt() setCreatedAt(string $createdAt)
+ * @method Mage_Oauth_Model_Token setCreatedAt() setCreatedAt(string $createdAt)
* @method string getToken()
- * @method Mage_OAuth_Model_Token setToken() setToken(string $token)
+ * @method Mage_Oauth_Model_Token setToken() setToken(string $token)
* @method string getSecret()
- * @method Mage_OAuth_Model_Token setSecret() setSecret(string $tokenSecret)
+ * @method Mage_Oauth_Model_Token setSecret() setSecret(string $tokenSecret)
* @method int getRevoked()
- * @method Mage_OAuth_Model_Token setRevoked() setRevoked(int $revoked)
+ * @method Mage_Oauth_Model_Token setRevoked() setRevoked(int $revoked)
* @method int getAuthorized()
- * @method Mage_OAuth_Model_Token setAuthorized() setAuthorized(int $authorized)
+ * @method Mage_Oauth_Model_Token setAuthorized() setAuthorized(int $authorized)
*/
-class Mage_OAuth_Model_Token extends Mage_Core_Model_Abstract
+class Mage_Oauth_Model_Token extends Mage_Core_Model_Abstract
{
/**#@+
* Token types
@@ -95,14 +95,14 @@ protected function _construct()
/**
* "After save" actions
*
- * @return Mage_OAuth_Model_Token
+ * @return Mage_Oauth_Model_Token
*/
protected function _afterSave()
{
parent::_afterSave();
//Cleanup old entries
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
if ($helper->isCleanupProbability()) {
$this->_getResource()->deleteOldEntries($helper->getCleanupExpirationPeriod());
@@ -115,7 +115,7 @@ protected function _afterSave()
*
* @param int $userId Authorization user identifier
* @param string $userType Authorization user type
- * @return Mage_OAuth_Model_Token
+ * @return Mage_Oauth_Model_Token
*/
public function authorize($userId, $userType)
{
@@ -132,7 +132,7 @@ public function authorize($userId, $userType)
} else {
Mage::throwException('User type is unknown');
}
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
$this->setVerifier($helper->generateVerifier());
@@ -147,14 +147,14 @@ public function authorize($userId, $userType)
/**
* Convert token to access type
*
- * @return Mage_OAuth_Model_Token
+ * @return Mage_Oauth_Model_Token
*/
public function convertToAccess()
{
- if (Mage_OAuth_Model_Token::TYPE_REQUEST != $this->getType()) {
+ if (Mage_Oauth_Model_Token::TYPE_REQUEST != $this->getType()) {
Mage::throwException('Can not convert due to token is not request type');
}
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
$this->setType(self::TYPE_ACCESS);
@@ -170,11 +170,11 @@ public function convertToAccess()
*
* @param int $consumerId Consumer identifier
* @param string $callbackUrl Callback URL
- * @return Mage_OAuth_Model_Token
+ * @return Mage_Oauth_Model_Token
*/
public function createRequestToken($consumerId, $callbackUrl)
{
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
$this->setData(array(
@@ -220,7 +220,7 @@ public function toString($format = '')
/**
* Before save actions
*
- * @return Mage_OAuth_Model_Consumer
+ * @return Mage_Oauth_Model_Consumer
*/
protected function _beforeSave()
{
@@ -243,14 +243,14 @@ public function validate()
{
/** @var $validatorUrl Mage_Core_Model_Url_Validator */
$validatorUrl = Mage::getSingleton('core/url_validator');
- if (Mage_OAuth_Model_Server::CALLBACK_ESTABLISHED != $this->getCallbackUrl()
+ if (Mage_Oauth_Model_Server::CALLBACK_ESTABLISHED != $this->getCallbackUrl()
&& !$validatorUrl->isValid($this->getCallbackUrl())
) {
$messages = $validatorUrl->getMessages();
Mage::throwException(array_shift($messages));
}
- /** @var $validatorLength Mage_OAuth_Model_Consumer_Validator_KeyLength */
+ /** @var $validatorLength Mage_Oauth_Model_Consumer_Validator_KeyLength */
$validatorLength = Mage::getModel(
'oauth/consumer_validator_keyLength');
$validatorLength->setLength(self::LENGTH_SECRET);
@@ -281,12 +281,12 @@ public function validate()
/**
* Get Token Consumer
*
- * @return Mage_OAuth_Model_Consumer
+ * @return Mage_Oauth_Model_Consumer
*/
public function getConsumer()
{
if (!$this->getData('consumer')) {
- /** @var $consumer Mage_OAuth_Model_Consumer */
+ /** @var $consumer Mage_Oauth_Model_Consumer */
$consumer = Mage::getModel('oauth/consumer');
$consumer->load($this->getConsumerId());
$this->setData('consumer', $consumer);
diff --git a/app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/Admin/TokenController.php b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/Admin/TokenController.php
similarity index 90%
rename from app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/Admin/TokenController.php
rename to app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/Admin/TokenController.php
index 4e6a080454..3d1ddbf811 100644
--- a/app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/Admin/TokenController.php
+++ b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/Admin/TokenController.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -30,15 +30,15 @@
* Applications for logged admin user
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Adminhtml_OAuth_Admin_TokenController extends Mage_Adminhtml_Controller_Action
+class Mage_Oauth_Adminhtml_Oauth_Admin_TokenController extends Mage_Adminhtml_Controller_Action
{
/**
* Init titles
*
- * @return Mage_OAuth_Adminhtml_OAuth_Admin_TokenController
+ * @return Mage_Oauth_Adminhtml_Oauth_Admin_TokenController
*/
public function preDispatch()
{
@@ -93,15 +93,15 @@ public function revokeAction()
/** @var $user Mage_Admin_Model_User */
$user = Mage::getSingleton('admin/session')->getData('user');
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
->addFilterByAdminId($user->getId())
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS)
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)
->addFilterById($ids)
->addFilterByRevoked(!$status);
- /** @var $item Mage_OAuth_Model_Token */
+ /** @var $item Mage_Oauth_Model_Token */
foreach ($collection as $item) {
$item->load($item->getId());
$item->setRevoked($status)->save();
@@ -139,14 +139,14 @@ public function deleteAction()
/** @var $user Mage_Admin_Model_User */
$user = Mage::getSingleton('admin/session')->getData('user');
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
->addFilterByAdminId($user->getId())
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS)
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)
->addFilterById($ids);
- /** @var $item Mage_OAuth_Model_Token */
+ /** @var $item Mage_Oauth_Model_Token */
foreach ($collection as $item) {
$item->delete();
}
diff --git a/app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/AuthorizeController.php b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizeController.php
similarity index 69%
rename from app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/AuthorizeController.php
rename to app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizeController.php
index 0fad0ac13e..833ab13eca 100644
--- a/app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/AuthorizeController.php
+++ b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizeController.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* oAuth authorize controller
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Adminhtml_OAuth_AuthorizeController extends Mage_Adminhtml_Controller_Action
+class Mage_Oauth_Adminhtml_Oauth_AuthorizeController extends Mage_Adminhtml_Controller_Action
{
/**
* Session name
@@ -56,7 +56,22 @@ class Mage_OAuth_Adminhtml_OAuth_AuthorizeController extends Mage_Adminhtml_Cont
public function preDispatch()
{
$this->getRequest()->setParam('forwarded', true);
+
+ // check login data before it set null in Mage_Admin_Model_Observer::actionPreDispatchAdmin
+ $loginError = $this->_checkLoginIsEmpty();
+
parent::preDispatch();
+
+ // call after parent::preDispatch(); to get session started
+ if ($loginError) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError(Mage::helper('adminhtml')->__('Invalid User Name or Password.'));
+ $params = array('_query' => array('oauth_token' => $this->getRequest()->getParam('oauth_token', null)));
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
+ $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
+ $params = array('_query' => array('oauth_token' => $this->getRequest()->getParam('oauth_token', null)));
+ $this->_redirect('*/*/*', $params);
+ }
}
/**
@@ -88,11 +103,11 @@ public function simpleAction()
* Init authorize page
*
* @param bool $simple
- * @return Mage_OAuth_Adminhtml_OAuth_AuthorizeController
+ * @return Mage_Oauth_Adminhtml_Oauth_AuthorizeController
*/
protected function _initForm($simple = false)
{
- /** @var $server Mage_OAuth_Model_Server */
+ /** @var $server Mage_Oauth_Model_Server */
$server = Mage::getModel('oauth/server');
/** @var $session Mage_Admin_Model_Session */
$session = Mage::getSingleton($this->_sessionName);
@@ -102,7 +117,7 @@ protected function _initForm($simple = false)
$server->checkAuthorizeRequest();
} catch (Mage_Core_Exception $e) {
$session->addError($e->getMessage());
- } catch (Mage_OAuth_Exception $e) {
+ } catch (Mage_Oauth_Exception $e) {
$isException = true;
$session->addException($e, $this->__('An error occurred. Your authorization request is invalid.'));
} catch (Exception $e) {
@@ -117,20 +132,14 @@ protected function _initForm($simple = false)
$contentBlock = $layout->getBlock('content');
if ($logged) {
$contentBlock->unsetChild('oauth.authorize.form');
- /** @var $block Mage_OAuth_Block_Adminhtml_OAuth_Authorize_Button */
+ /** @var $block Mage_Oauth_Block_Adminhtml_Oauth_Authorize_Button */
$block = $contentBlock->getChild('oauth.authorize.button');
} else {
$contentBlock->unsetChild('oauth.authorize.button');
- /** @var $block Mage_OAuth_Block_Adminhtml_OAuth_Authorize */
+ /** @var $block Mage_Oauth_Block_Adminhtml_Oauth_Authorize */
$block = $contentBlock->getChild('oauth.authorize.form');
}
- if ($simple) {
- /** @var $style Mage_OAuth_Block_Authorize_Style */
- $style = $layout->getBlock('oauth.authorize.style');
- $style->setIsLogged($logged);
- }
-
$block->setIsSimple($simple)
->setToken($this->getRequest()->getQuery('oauth_token'))
->setHasException($isException);
@@ -141,36 +150,43 @@ protected function _initForm($simple = false)
* Init confirm page
*
* @param bool $simple
- * @return Mage_OAuth_Adminhtml_OAuth_AuthorizeController
+ * @return Mage_Oauth_Adminhtml_Oauth_AuthorizeController
*/
protected function _initConfirmPage($simple = false)
{
+ /** @var $helper Mage_Oauth_Helper_Data */
+ $helper = Mage::helper('oauth');
+
/** @var $session Mage_Admin_Model_Session */
$session = Mage::getSingleton($this->_sessionName);
- /** @var $server Mage_OAuth_Model_Server */
- $server = Mage::getModel('oauth/server');
+ /** @var $user Mage_Admin_Model_User */
+ $user = $session->getData('user');
+ if (!$user) {
+ $session->addError($this->__('Please login to proceed authorization.'));
+ $url = $helper->getAuthorizeUrl(Mage_Oauth_Model_Token::USER_TYPE_ADMIN);
+ $this->_redirectUrl($url);
+ return $this;
+ }
$this->loadLayout();
- /** @var $block Mage_OAuth_Block_Adminhtml_OAuth_Authorize */
+ /** @var $block Mage_Oauth_Block_Adminhtml_Oauth_Authorize */
$block = $this->getLayout()->getBlock('content')->getChild('oauth.authorize.confirm');
$block->setIsSimple($simple);
try {
- /** @var $user Mage_Admin_Model_User */
- $user = $session->getData('user');
- $token = $server->authorizeToken($user->getId(), Mage_OAuth_Model_Token::USER_TYPE_ADMIN);
+ /** @var $server Mage_Oauth_Model_Server */
+ $server = Mage::getModel('oauth/server');
- /** @var $helper Mage_OAuth_Helper_Data */
- $helper = Mage::helper('oauth');
+ $token = $server->authorizeToken($user->getId(), Mage_Oauth_Model_Token::USER_TYPE_ADMIN);
if (($callback = $helper->getFullCallbackUrl($token))) { //false in case of OOB
$this->getResponse()->setRedirect($callback . ($simple ? '&simple=1' : ''));
return $this;
} else {
- $session->addSuccess($this->__('Authorization confirmed.'));
$block->setVerifier($token->getVerifier());
+ $session->addSuccess($this->__('Authorization confirmed.'));
}
} catch (Mage_Core_Exception $e) {
$block->setHasException(true);
@@ -190,11 +206,11 @@ protected function _initConfirmPage($simple = false)
* Init reject page
*
* @param bool $simple
- * @return Mage_OAuth_AuthorizeController
+ * @return Mage_Oauth_AuthorizeController
*/
protected function _initRejectPage($simple = false)
{
- /** @var $server Mage_OAuth_Model_Server */
+ /** @var $server Mage_Oauth_Model_Server */
$server = Mage::getModel('oauth/server');
/** @var $session Mage_Admin_Model_Session */
@@ -202,13 +218,13 @@ protected function _initRejectPage($simple = false)
$this->loadLayout();
- /** @var $block Mage_OAuth_Block_Authorize */
+ /** @var $block Mage_Oauth_Block_Authorize */
$block = $this->getLayout()->getBlock('oauth.authorize.reject');
$block->setIsSimple($simple);
try {
$token = $server->checkAuthorizeRequest();
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
if (($callback = $helper->getFullCallbackUrl($token, true))) {
@@ -230,6 +246,27 @@ protected function _initRejectPage($simple = false)
return $this;
}
+ /**
+ * Check is login data has empty login or pass
+ * See Mage_Admin_Model_Session: there is no any error message if login or password is empty
+ *
+ * @return boolean
+ */
+ protected function _checkLoginIsEmpty()
+ {
+ $error = false;
+ $action = $this->getRequest()->getActionName();
+ if (($action == 'index' || $action == 'simple') && $this->getRequest()->getPost('login')) {
+ $postLogin = $this->getRequest()->getPost('login');
+ $username = isset($postLogin['username']) ? $postLogin['username'] : '';
+ $password = isset($postLogin['password']) ? $postLogin['password'] : '';
+ if (empty($username) || empty($password)) {
+ $error = true;
+ }
+ }
+ return $error;
+ }
+
/**
* Confirm token authorization action
*/
diff --git a/app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/AuthorizedTokensController.php b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizedTokensController.php
similarity index 90%
rename from app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/AuthorizedTokensController.php
rename to app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizedTokensController.php
index 3252bf0ddd..04f32c2b9a 100644
--- a/app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/AuthorizedTokensController.php
+++ b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizedTokensController.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,15 +28,15 @@
* Manage authorized tokens controller
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Adminhtml_OAuth_AuthorizedTokensController extends Mage_Adminhtml_Controller_Action
+class Mage_Oauth_Adminhtml_Oauth_AuthorizedTokensController extends Mage_Adminhtml_Controller_Action
{
/**
* Init titles
*
- * @return Mage_OAuth_Adminhtml_OAuth_AuthorizedTokensController
+ * @return Mage_Oauth_Adminhtml_Oauth_AuthorizedTokensController
*/
public function preDispatch()
{
@@ -88,14 +88,14 @@ public function revokeAction()
}
try {
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS)
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)
->addFilterById($ids)
->addFilterByRevoked(!$status);
- /** @var $item Mage_OAuth_Model_Token */
+ /** @var $item Mage_Oauth_Model_Token */
foreach ($collection as $item) {
$item->load($item->getId());
$item->setRevoked($status)->save();
@@ -132,13 +132,13 @@ public function deleteAction()
}
try {
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS)
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)
->addFilterById($ids);
- /** @var $item Mage_OAuth_Model_Token */
+ /** @var $item Mage_Oauth_Model_Token */
foreach ($collection as $item) {
$item->delete();
@@ -169,7 +169,7 @@ protected function _isAllowed()
/**
* Send email notification to user about token status change
*
- * @param Mage_OAuth_Model_Token $token Token object
+ * @param Mage_Oauth_Model_Token $token Token object
* @param string $newStatus Name of new token status
*/
protected function _sendTokenStatusChangeNotification($token, $newStatus)
@@ -195,7 +195,7 @@ protected function _sendTokenStatusChangeNotification($token, $newStatus)
$email = $customer->getEmail();
$name = $customer->getName();
}
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
$helper->sendNotificationOnTokenStatusChange($email, $name, $token->getConsumer()->getName(), $newStatus);
diff --git a/app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/ConsumerController.php b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/ConsumerController.php
similarity index 93%
rename from app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/ConsumerController.php
rename to app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/ConsumerController.php
index f1760c205f..31fa0e2b0d 100644
--- a/app/code/core/Mage/OAuth/controllers/Adminhtml/OAuth/ConsumerController.php
+++ b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/ConsumerController.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* Manage consumers controller
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Adminhtml_OAuth_ConsumerController extends Mage_Adminhtml_Controller_Action
+class Mage_Oauth_Adminhtml_Oauth_ConsumerController extends Mage_Adminhtml_Controller_Action
{
/**
* Unset unused data from request
@@ -53,7 +53,7 @@ protected function _filter(array $data)
/**
* Init titles
*
- * @return Mage_OAuth_Adminhtml_OAuth_ConsumerController
+ * @return Mage_Oauth_Adminhtml_Oauth_ConsumerController
*/
public function preDispatch()
{
@@ -87,7 +87,7 @@ public function gridAction()
*/
public function newAction()
{
- /** @var $model Mage_OAuth_Model_Consumer */
+ /** @var $model Mage_Oauth_Model_Consumer */
$model = Mage::getModel('oauth/consumer');
$formData = $this->_getFormData();
@@ -95,7 +95,7 @@ public function newAction()
$this->_setFormData($formData);
$model->addData($formData);
} else {
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
$model->setKey($helper->generateConsumerKey());
$model->setSecret($helper->generateConsumerSecret());
@@ -121,7 +121,7 @@ public function editAction()
return;
}
- /** @var $model Mage_OAuth_Model_Consumer */
+ /** @var $model Mage_Oauth_Model_Consumer */
$model = Mage::getModel('oauth/consumer');
$model->load($id);
@@ -155,7 +155,7 @@ public function saveAction()
$data = $this->_filter($this->getRequest()->getParams());
- /** @var $model Mage_OAuth_Model_Consumer */
+ /** @var $model Mage_Oauth_Model_Consumer */
$model = Mage::getModel('oauth/consumer');
if ($id) {
@@ -181,7 +181,7 @@ public function saveAction()
} else {
// If an admin was started create a new consumer and at this moment he has been edited an existing
// consumer, we save the new consumer with a new key-secret pair
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
$data['key'] = $helper->generateConsumerKey();
@@ -250,7 +250,7 @@ protected function _getFormData()
* Set form data
*
* @param $data
- * @return Mage_OAuth_Adminhtml_OAuth_ConsumerController
+ * @return Mage_Oauth_Adminhtml_Oauth_ConsumerController
*/
protected function _setFormData($data)
{
@@ -266,7 +266,7 @@ public function deleteAction()
$consumerId = (int) $this->getRequest()->getParam('id');
if ($consumerId) {
try {
- /** @var $consumer Mage_OAuth_Model_Consumer */
+ /** @var $consumer Mage_Oauth_Model_Consumer */
$consumer = Mage::getModel('oauth/consumer')->load($consumerId);
if (!$consumer->getId()) {
Mage::throwException(Mage::helper('oauth')->__('Unable to find a consumer.'));
diff --git a/app/code/core/Mage/OAuth/controllers/AuthorizeController.php b/app/code/core/Mage/Oauth/controllers/AuthorizeController.php
similarity index 80%
rename from app/code/core/Mage/OAuth/controllers/AuthorizeController.php
rename to app/code/core/Mage/Oauth/controllers/AuthorizeController.php
index 955a8f5f40..9c4ee558d7 100644
--- a/app/code/core/Mage/OAuth/controllers/AuthorizeController.php
+++ b/app/code/core/Mage/Oauth/controllers/AuthorizeController.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* oAuth authorize controller
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_AuthorizeController extends Mage_Core_Controller_Front_Action
+class Mage_Oauth_AuthorizeController extends Mage_Core_Controller_Front_Action
{
/**
* Session name
@@ -44,11 +44,11 @@ class Mage_OAuth_AuthorizeController extends Mage_Core_Controller_Front_Action
* Init authorize page
*
* @param bool $simple Is simple page?
- * @return Mage_OAuth_AuthorizeController
+ * @return Mage_Oauth_AuthorizeController
*/
protected function _initForm($simple = false)
{
- /** @var $server Mage_OAuth_Model_Server */
+ /** @var $server Mage_Oauth_Model_Server */
$server = Mage::getModel('oauth/server');
/** @var $session Mage_Customer_Model_Session */
$session = Mage::getSingleton($this->_sessionName);
@@ -58,7 +58,7 @@ protected function _initForm($simple = false)
$server->checkAuthorizeRequest();
} catch (Mage_Core_Exception $e) {
$session->addError($e->getMessage());
- } catch (Mage_OAuth_Exception $e) {
+ } catch (Mage_Oauth_Exception $e) {
$isException = true;
$session->addException($e, $this->__('An error occurred. Your authorization request is invalid.'));
} catch (Exception $e) {
@@ -73,18 +73,14 @@ protected function _initForm($simple = false)
$contentBlock = $layout->getBlock('content');
if ($logged) {
$contentBlock->unsetChild('oauth.authorize.form');
- /** @var $block Mage_OAuth_Block_Authorize_Button */
+ /** @var $block Mage_Oauth_Block_Authorize_Button */
$block = $contentBlock->getChild('oauth.authorize.button');
} else {
$contentBlock->unsetChild('oauth.authorize.button');
- /** @var $block Mage_OAuth_Block_Authorize */
+ /** @var $block Mage_Oauth_Block_Authorize */
$block = $contentBlock->getChild('oauth.authorize.form');
}
- if ($simple) {
- $layout->getBlock('oauth.authorize.style')->setData('is_logged', $logged);
- }
-
/** @var $helper Mage_Core_Helper_Url */
$helper = Mage::helper('core/url');
$session->setAfterAuthUrl(Mage::getUrl('customer/account/login', array('_nosid' => true)))
@@ -100,26 +96,34 @@ protected function _initForm($simple = false)
* Init confirm page
*
* @param bool $simple Is simple page?
- * @return Mage_OAuth_AuthorizeController
+ * @return Mage_Oauth_AuthorizeController
*/
protected function _initConfirmPage($simple = false)
{
+ /** @var $helper Mage_Oauth_Helper_Data */
+ $helper = Mage::helper('oauth');
+
+ /** @var $session Mage_Customer_Model_Session */
+ $session = Mage::getSingleton($this->_sessionName);
+ if (!$session->getCustomerId()) {
+ $session->addError($this->__('Please login to proceed authorization.'));
+ $url = $helper->getAuthorizeUrl(Mage_Oauth_Model_Token::USER_TYPE_CUSTOMER);
+ $this->_redirectUrl($url);
+ return $this;
+ }
+
$this->loadLayout();
- try {
- /** @var $session Mage_Customer_Model_Session */
- $session = Mage::getSingleton($this->_sessionName);
- /** @var $server Mage_OAuth_Model_Server */
- $server = Mage::getModel('oauth/server');
- /** @var $block Mage_OAuth_Block_Authorize */
- $block = $this->getLayout()->getBlock('oauth.authorize.confirm');
- $block->setIsSimple($simple);
+ /** @var $block Mage_Oauth_Block_Authorize */
+ $block = $this->getLayout()->getBlock('oauth.authorize.confirm');
+ $block->setIsSimple($simple);
- /** @var $token Mage_OAuth_Model_Token */
- $token = $server->authorizeToken($session->getCustomerId(), Mage_OAuth_Model_Token::USER_TYPE_CUSTOMER);
+ try {
+ /** @var $server Mage_Oauth_Model_Server */
+ $server = Mage::getModel('oauth/server');
- /** @var $helper Mage_OAuth_Helper_Data */
- $helper = Mage::helper('oauth');
+ /** @var $token Mage_Oauth_Model_Token */
+ $token = $server->authorizeToken($session->getCustomerId(), Mage_Oauth_Model_Token::USER_TYPE_CUSTOMER);
if (($callback = $helper->getFullCallbackUrl($token))) { //false in case of OOB
$this->_redirectUrl($callback . ($simple ? '&simple=1' : ''));
@@ -130,7 +134,7 @@ protected function _initConfirmPage($simple = false)
}
} catch (Mage_Core_Exception $e) {
$session->addError($e->getMessage());
- } catch (Mage_OAuth_Exception $e) {
+ } catch (Mage_Oauth_Exception $e) {
$session->addException($e, $this->__('An error occurred. Your authorization request is invalid.'));
} catch (Exception $e) {
$session->addException($e, $this->__('An error occurred on confirm authorize.'));
@@ -146,7 +150,7 @@ protected function _initConfirmPage($simple = false)
* Init reject page
*
* @param bool $simple Is simple page?
- * @return Mage_OAuth_AuthorizeController
+ * @return Mage_Oauth_AuthorizeController
*/
protected function _initRejectPage($simple = false)
{
@@ -155,16 +159,16 @@ protected function _initRejectPage($simple = false)
/** @var $session Mage_Customer_Model_Session */
$session = Mage::getSingleton($this->_sessionName);
try {
- /** @var $server Mage_OAuth_Model_Server */
+ /** @var $server Mage_Oauth_Model_Server */
$server = Mage::getModel('oauth/server');
- /** @var $block Mage_OAuth_Block_Authorize */
+ /** @var $block Mage_Oauth_Block_Authorize */
$block = $this->getLayout()->getBlock('oauth.authorize.reject');
- $block->setIsSimple($simple . ($simple ? '&simple=1' : ''));
+ $block->setIsSimple($simple);
- /** @var $token Mage_OAuth_Model_Token */
+ /** @var $token Mage_Oauth_Model_Token */
$token = $server->checkAuthorizeRequest();
- /** @var $helper Mage_OAuth_Helper_Data */
+ /** @var $helper Mage_Oauth_Helper_Data */
$helper = Mage::helper('oauth');
if (($callback = $helper->getFullCallbackUrl($token, true))) {
diff --git a/app/code/core/Mage/OAuth/controllers/Customer/TokenController.php b/app/code/core/Mage/Oauth/controllers/Customer/TokenController.php
similarity index 91%
rename from app/code/core/Mage/OAuth/controllers/Customer/TokenController.php
rename to app/code/core/Mage/Oauth/controllers/Customer/TokenController.php
index bf12802a6c..e729e041ab 100644
--- a/app/code/core/Mage/OAuth/controllers/Customer/TokenController.php
+++ b/app/code/core/Mage/Oauth/controllers/Customer/TokenController.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -30,10 +30,10 @@
* Tab "My Applications" in the Customer Account
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_Customer_TokenController extends Mage_Core_Controller_Front_Action
+class Mage_Oauth_Customer_TokenController extends Mage_Core_Controller_Front_Action
{
/**
* Customer session model
@@ -77,7 +77,7 @@ public function indexAction()
/**
* Redirect to referrer URL or otherwise to index page without params
*
- * @return Mage_OAuth_Customer_TokenController
+ * @return Mage_Oauth_Customer_TokenController
*/
protected function _redirectBack()
{
@@ -112,16 +112,16 @@ public function revokeAction()
}
try {
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
->addFilterByCustomerId($this->_session->getCustomerId())
->addFilterById($id)
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS)
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)
->addFilterByRevoked(!$status);
//here is can be load from model, but used from collection for get consumer name
- /** @var $model Mage_OAuth_Model_Token */
+ /** @var $model Mage_Oauth_Model_Token */
$model = $collection->getFirstItem();
if ($model->getId()) {
$name = $model->getName();
@@ -160,14 +160,14 @@ public function deleteAction()
}
try {
- /** @var $collection Mage_OAuth_Model_Resource_Token_Collection */
+ /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
$collection = Mage::getModel('oauth/token')->getCollection();
$collection->joinConsumerAsApplication()
->addFilterByCustomerId($this->_session->getCustomerId())
- ->addFilterByType(Mage_OAuth_Model_Token::TYPE_ACCESS)
+ ->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)
->addFilterById($id);
- /** @var $model Mage_OAuth_Model_Token */
+ /** @var $model Mage_Oauth_Model_Token */
$model = $collection->getFirstItem();
if ($model->getId()) {
$name = $model->getName();
diff --git a/app/code/core/Mage/OAuth/controllers/InitiateController.php b/app/code/core/Mage/Oauth/controllers/InitiateController.php
similarity index 90%
rename from app/code/core/Mage/OAuth/controllers/InitiateController.php
rename to app/code/core/Mage/Oauth/controllers/InitiateController.php
index 58b6700eb7..53939598bd 100644
--- a/app/code/core/Mage/OAuth/controllers/InitiateController.php
+++ b/app/code/core/Mage/Oauth/controllers/InitiateController.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* oAuth initiate controller
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_InitiateController extends Mage_Core_Controller_Front_Action
+class Mage_Oauth_InitiateController extends Mage_Core_Controller_Front_Action
{
/**
* Dispatch event before action
@@ -53,7 +53,7 @@ public function preDispatch()
*/
public function indexAction()
{
- /** @var $server Mage_OAuth_Model_Server */
+ /** @var $server Mage_Oauth_Model_Server */
$server = Mage::getModel('oauth/server');
$server->initiateToken();
diff --git a/app/code/core/Mage/OAuth/controllers/TokenController.php b/app/code/core/Mage/Oauth/controllers/TokenController.php
similarity index 90%
rename from app/code/core/Mage/OAuth/controllers/TokenController.php
rename to app/code/core/Mage/Oauth/controllers/TokenController.php
index c85f979b2a..43e49a6026 100644
--- a/app/code/core/Mage/OAuth/controllers/TokenController.php
+++ b/app/code/core/Mage/Oauth/controllers/TokenController.php
@@ -19,7 +19,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -28,10 +28,10 @@
* oAuth token controller
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @author Magento Core Team
*/
-class Mage_OAuth_TokenController extends Mage_Core_Controller_Front_Action
+class Mage_Oauth_TokenController extends Mage_Core_Controller_Front_Action
{
/**
* Dispatch event before action
@@ -53,7 +53,7 @@ public function preDispatch()
*/
public function indexAction()
{
- /** @var $server Mage_OAuth_Model_Server */
+ /** @var $server Mage_Oauth_Model_Server */
$server = Mage::getModel('oauth/server');
$server->accessToken();
diff --git a/app/code/core/Mage/OAuth/etc/adminhtml.xml b/app/code/core/Mage/Oauth/etc/adminhtml.xml
similarity index 95%
rename from app/code/core/Mage/OAuth/etc/adminhtml.xml
rename to app/code/core/Mage/Oauth/etc/adminhtml.xml
index 3528286afc..ee47e8cd1d 100644
--- a/app/code/core/Mage/OAuth/etc/adminhtml.xml
+++ b/app/code/core/Mage/Oauth/etc/adminhtml.xml
@@ -20,7 +20,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
@@ -80,17 +80,17 @@
REST - OAuth Consumers50
- adminhtml/oAuth_consumer
+ adminhtml/oauth_consumerREST - OAuth Authorized Tokens60
- adminhtml/oAuth_authorizedTokens
+ adminhtml/oauth_authorizedTokensREST - My Apps70
- adminhtml/oAuth_admin_token
+ adminhtml/oauth_admin_token
diff --git a/app/code/core/Mage/OAuth/etc/config.xml b/app/code/core/Mage/Oauth/etc/config.xml
similarity index 85%
rename from app/code/core/Mage/OAuth/etc/config.xml
rename to app/code/core/Mage/Oauth/etc/config.xml
index 28f3a54870..e85a546c8e 100644
--- a/app/code/core/Mage/OAuth/etc/config.xml
+++ b/app/code/core/Mage/Oauth/etc/config.xml
@@ -20,25 +20,25 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-->
-
+ 1.0.0.0
-
+
- Mage_OAuth_Model
+ Mage_Oauth_Modeloauth_resource
- Mage_OAuth_Model_Resource
+ Mage_Oauth_Model_Resource
oauth_consumer
@@ -54,31 +54,31 @@
- Mage_OAuth_Block
+ Mage_Oauth_Block
- Mage_OAuth_Helper
+ Mage_Oauth_Helper
- Mage_OAuth
- Mage_OAuth_Model_Resource_Setup
+ Mage_Oauth
+ Mage_Oauth_Model_Resource_Setup
-
+ oauth/observerafterCustomerLogin
-
+
@@ -111,7 +111,7 @@
- Mage_OAuth_Adminhtml
+ Mage_Oauth_Adminhtml
@@ -120,11 +120,11 @@
-
+
- Mage_OAuth.csv
+ Mage_Oauth.csv
-
+
@@ -140,7 +140,7 @@
- Mage_OAuth
+ Mage_Oauthoauth
@@ -154,11 +154,11 @@
-
+
- Mage_OAuth.csv
+ Mage_Oauth.csv
-
+
diff --git a/app/code/core/Mage/OAuth/etc/system.xml b/app/code/core/Mage/Oauth/etc/system.xml
similarity index 99%
rename from app/code/core/Mage/OAuth/etc/system.xml
rename to app/code/core/Mage/Oauth/etc/system.xml
index 66e678d067..112690c73b 100644
--- a/app/code/core/Mage/OAuth/etc/system.xml
+++ b/app/code/core/Mage/Oauth/etc/system.xml
@@ -20,7 +20,7 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
diff --git a/app/code/core/Mage/OAuth/sql/oauth_setup/install-1.0.0.0.php b/app/code/core/Mage/Oauth/sql/oauth_setup/install-1.0.0.0.php
similarity index 96%
rename from app/code/core/Mage/OAuth/sql/oauth_setup/install-1.0.0.0.php
rename to app/code/core/Mage/Oauth/sql/oauth_setup/install-1.0.0.0.php
index 508beb3e4b..08d435fc39 100644
--- a/app/code/core/Mage/OAuth/sql/oauth_setup/install-1.0.0.0.php
+++ b/app/code/core/Mage/Oauth/sql/oauth_setup/install-1.0.0.0.php
@@ -19,14 +19,14 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_OAuth
+ * @package Mage_Oauth
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Installation of OAuth module tables
*/
-/** @var $install Mage_OAuth_Model_Resource_Setup */
+/** @var $install Mage_Oauth_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
@@ -54,10 +54,10 @@
->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
'nullable' => false
), 'Name of consumer')
- ->addColumn('key', Varien_Db_Ddl_Table::TYPE_VARCHAR, Mage_OAuth_Model_Consumer::KEY_LENGTH, array(
+ ->addColumn('key', Varien_Db_Ddl_Table::TYPE_VARCHAR, Mage_Oauth_Model_Consumer::KEY_LENGTH, array(
'nullable' => false
), 'Key code')
- ->addColumn('secret', Varien_Db_Ddl_Table::TYPE_VARCHAR, Mage_OAuth_Model_Consumer::SECRET_LENGTH, array(
+ ->addColumn('secret', Varien_Db_Ddl_Table::TYPE_VARCHAR, Mage_Oauth_Model_Consumer::SECRET_LENGTH, array(
'nullable' => false
), 'Secret code')
->addColumn('callback_url', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(), 'Callback URL')
@@ -107,13 +107,13 @@
->addColumn('type', Varien_Db_Ddl_Table::TYPE_TEXT, 16, array(
'nullable' => false
), 'Token Type')
- ->addColumn('token', Varien_Db_Ddl_Table::TYPE_TEXT, Mage_OAuth_Model_Token::LENGTH_TOKEN, array(
+ ->addColumn('token', Varien_Db_Ddl_Table::TYPE_TEXT, Mage_Oauth_Model_Token::LENGTH_TOKEN, array(
'nullable' => false
), 'Token')
- ->addColumn('secret', Varien_Db_Ddl_Table::TYPE_TEXT, Mage_OAuth_Model_Token::LENGTH_SECRET, array(
+ ->addColumn('secret', Varien_Db_Ddl_Table::TYPE_TEXT, Mage_Oauth_Model_Token::LENGTH_SECRET, array(
'nullable' => false
), 'Token Secret')
- ->addColumn('verifier', Varien_Db_Ddl_Table::TYPE_TEXT, Mage_OAuth_Model_Token::LENGTH_VERIFIER, array(
+ ->addColumn('verifier', Varien_Db_Ddl_Table::TYPE_TEXT, Mage_Oauth_Model_Token::LENGTH_VERIFIER, array(
'nullable' => true
), 'Token Verifier')
->addColumn('callback_url', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
diff --git a/app/code/core/Mage/Page/Block/Html/Notices.php b/app/code/core/Mage/Page/Block/Html/Notices.php
index 43207bbb4a..0ee78c2d25 100644
--- a/app/code/core/Mage/Page/Block/Html/Notices.php
+++ b/app/code/core/Mage/Page/Block/Html/Notices.php
@@ -33,13 +33,6 @@
*/
class Mage_Page_Block_Html_Notices extends Mage_Core_Block_Template
{
-
- /**
- * Cookie restriction lifetime configuration path
- */
- const XML_PATH_COOKIE_RESTRICTION_LIFETIME = 'web/cookie/cookie_restriction_lifetime';
-
-
/**
* Check if noscript notice should be displayed
*
@@ -60,28 +53,6 @@ public function displayDemoNotice()
return Mage::getStoreConfig('design/head/demonotice');
}
- /**
- * Get cookie restriction lifetime (in seconds)
- *
- * @return int
- */
- public function getCookieRestrictionLifetime()
- {
- return (int)Mage::getStoreConfig(self::XML_PATH_COOKIE_RESTRICTION_LIFETIME);
- }
-
- /**
- * Check if cookie restriction notice should be displayed
- *
- * @return bool
- */
- public function displayCookieRestrictionNotice()
- {
- $acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites();
- return Mage::getStoreConfig(self::XML_PATH_COOKIE_RESTRICTION) &&
- empty($acceptedSaveCookiesWebsites[Mage::app()->getWebsite()->getId()]);
- }
-
/**
* Get Link to cookie restriction privacy policy page
*
diff --git a/app/code/core/Mage/Page/Block/Template/Links.php b/app/code/core/Mage/Page/Block/Template/Links.php
index 5982224128..a7f4b09add 100644
--- a/app/code/core/Mage/Page/Block/Template/Links.php
+++ b/app/code/core/Mage/Page/Block/Template/Links.php
@@ -115,7 +115,9 @@ public function addLink($label, $url='', $title='', $prepare=false, $urlParams=a
public function addLinkBlock($blockName)
{
$block = $this->getLayout()->getBlock($blockName);
- $this->_links[$this->_getNewPosition((int)$block->getPosition())] = $block;
+ if ($block) {
+ $this->_links[$this->_getNewPosition((int)$block->getPosition())] = $block;
+ }
return $this;
}
diff --git a/app/code/core/Mage/Page/etc/config.xml b/app/code/core/Mage/Page/etc/config.xml
index 06bf6fd2ff..eb075a4fd8 100644
--- a/app/code/core/Mage/Page/etc/config.xml
+++ b/app/code/core/Mage/Page/etc/config.xml
@@ -129,7 +129,7 @@
Default welcome msg!
diff --git a/app/code/core/Mage/Paygate/Block/Authorizenet/Form/Cc.php b/app/code/core/Mage/Paygate/Block/Authorizenet/Form/Cc.php
index 2c78280062..db856895a5 100644
--- a/app/code/core/Mage/Paygate/Block/Authorizenet/Form/Cc.php
+++ b/app/code/core/Mage/Paygate/Block/Authorizenet/Form/Cc.php
@@ -67,7 +67,7 @@ public function getCardsBlock()
*/
public function getCancelUrl()
{
- return $this->getUrl('paygate/authorizenet_payment/cancel', array('_secure' => true));
+ return $this->getUrl('paygate/authorizenet_payment/cancel');
}
/**
diff --git a/app/code/core/Mage/Paygate/etc/config.xml b/app/code/core/Mage/Paygate/etc/config.xml
index 180e02b21d..7e244cd959 100644
--- a/app/code/core/Mage/Paygate/etc/config.xml
+++ b/app/code/core/Mage/Paygate/etc/config.xml
@@ -67,6 +67,9 @@
+
+ /paygate/authorizenet_payment
+
diff --git a/app/code/core/Mage/Payment/Block/Form/Container.php b/app/code/core/Mage/Payment/Block/Form/Container.php
index 665f092bb8..9d15385732 100644
--- a/app/code/core/Mage/Payment/Block/Form/Container.php
+++ b/app/code/core/Mage/Payment/Block/Form/Container.php
@@ -57,7 +57,7 @@ protected function _canUseMethod($method)
return false;
}
- if (!$method->canUseForCurrency(Mage::app()->getStore()->getBaseCurrencyCode())) {
+ if (!$method->canUseForCurrency($this->getQuote()->getStore()->getBaseCurrencyCode())) {
return false;
}
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order.php b/app/code/core/Mage/Sales/Model/Api2/Order.php
index 6fe913a042..590e1b8bb5 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order.php
@@ -117,9 +117,9 @@ protected function _getAddresses(array $orderIds)
{
$addresses = array();
- if ($this->_isSubCallAllowed('order_addresses')) {
+ if ($this->_isSubCallAllowed('order_address')) {
/** @var $addressesFilter Mage_Api2_Model_Acl_Filter */
- $addressesFilter = $this->_getSubModel('order_addresses', array())->getFilter();
+ $addressesFilter = $this->_getSubModel('order_address', array())->getFilter();
// do addresses request if at least one attribute allowed
if ($addressesFilter->getAllowedAttributes()) {
/* @var $collection Mage_Sales_Model_Resource_Order_Address_Collection */
@@ -174,9 +174,9 @@ protected function _getComments(array $orderIds)
{
$comments = array();
- if ($this->_isOrderCommentsAllowed() && $this->_isSubCallAllowed('order_comments')) {
+ if ($this->_isOrderCommentsAllowed() && $this->_isSubCallAllowed('order_comment')) {
/** @var $commentsFilter Mage_Api2_Model_Acl_Filter */
- $commentsFilter = $this->_getSubModel('order_comments', array())->getFilter();
+ $commentsFilter = $this->_getSubModel('order_comment', array())->getFilter();
// do comments request if at least one attribute allowed
if ($commentsFilter->getAllowedAttributes()) {
foreach ($this->_getCommentsCollection($orderIds)->getItems() as $item) {
@@ -212,9 +212,9 @@ protected function _getItems(array $orderIds)
{
$items = array();
- if ($this->_isSubCallAllowed('order_items')) {
+ if ($this->_isSubCallAllowed('order_item')) {
/** @var $itemsFilter Mage_Api2_Model_Acl_Filter */
- $itemsFilter = $this->_getSubModel('order_items', array())->getFilter();
+ $itemsFilter = $this->_getSubModel('order_item', array())->getFilter();
// do items request if at least one attribute allowed
if ($itemsFilter->getAllowedAttributes()) {
/* @var $collection Mage_Sales_Model_Resource_Order_Item_Collection */
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order/Comments.php b/app/code/core/Mage/Sales/Model/Api2/Order/Comment.php
similarity index 93%
rename from app/code/core/Mage/Sales/Model/Api2/Order/Comments.php
rename to app/code/core/Mage/Sales/Model/Api2/Order/Comment.php
index b7b1ddfd59..1aefe36b0c 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order/Comments.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order/Comment.php
@@ -31,6 +31,6 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-class Mage_Sales_Model_Api2_Order_Comments extends Mage_Api2_Model_Resource
+class Mage_Sales_Model_Api2_Order_Comment extends Mage_Api2_Model_Resource
{
}
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest.php b/app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest.php
similarity index 96%
rename from app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest.php
rename to app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest.php
index bfdf308cf4..d7149d12da 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest.php
@@ -31,7 +31,7 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-abstract class Mage_Sales_Model_Api2_Order_Comments_Rest extends Mage_Sales_Model_Api2_Order_Comments
+abstract class Mage_Sales_Model_Api2_Order_Comment_Rest extends Mage_Sales_Model_Api2_Order_Comment
{
/**#@+
* Parameters in request used in model (usually specified in route mask)
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest/Admin/V1.php b/app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Admin/V1.php
similarity index 91%
rename from app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest/Admin/V1.php
rename to app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Admin/V1.php
index e6e6b45aab..22656cb0a1 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest/Admin/V1.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Admin/V1.php
@@ -31,6 +31,6 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-class Mage_Sales_Model_Api2_Order_Comments_Rest_Admin_V1 extends Mage_Sales_Model_Api2_Order_Comments_Rest
+class Mage_Sales_Model_Api2_Order_Comment_Rest_Admin_V1 extends Mage_Sales_Model_Api2_Order_Comment_Rest
{
}
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest/Customer/V1.php b/app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Customer/V1.php
similarity index 94%
rename from app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest/Customer/V1.php
rename to app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Customer/V1.php
index 203d6614ae..4c4ede2df5 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order/Comments/Rest/Customer/V1.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Customer/V1.php
@@ -31,7 +31,7 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-class Mage_Sales_Model_Api2_Order_Comments_Rest_Customer_V1 extends Mage_Sales_Model_Api2_Order_Comments_Rest
+class Mage_Sales_Model_Api2_Order_Comment_Rest_Customer_V1 extends Mage_Sales_Model_Api2_Order_Comment_Rest
{
/**
* Load order by id
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order/Items.php b/app/code/core/Mage/Sales/Model/Api2/Order/Item.php
similarity index 93%
rename from app/code/core/Mage/Sales/Model/Api2/Order/Items.php
rename to app/code/core/Mage/Sales/Model/Api2/Order/Item.php
index 4497003ba3..25428ab0a5 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order/Items.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order/Item.php
@@ -31,6 +31,6 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-class Mage_Sales_Model_Api2_Order_Items extends Mage_Api2_Model_Resource
+class Mage_Sales_Model_Api2_Order_Item extends Mage_Api2_Model_Resource
{
}
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest.php b/app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest.php
similarity index 96%
rename from app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest.php
rename to app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest.php
index 24b3a18e04..724724aa67 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest.php
@@ -31,7 +31,7 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-abstract class Mage_Sales_Model_Api2_Order_Items_Rest extends Mage_Sales_Model_Api2_Order_Items
+abstract class Mage_Sales_Model_Api2_Order_Item_Rest extends Mage_Sales_Model_Api2_Order_Item
{
/**#@+
* Parameters in request used in model (usually specified in route)
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest/Admin/V1.php b/app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest/Admin/V1.php
similarity index 91%
rename from app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest/Admin/V1.php
rename to app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest/Admin/V1.php
index eb76e98c6b..5006d7cfa9 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest/Admin/V1.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest/Admin/V1.php
@@ -31,6 +31,6 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-class Mage_Sales_Model_Api2_Order_Items_Rest_Admin_V1 extends Mage_Sales_Model_Api2_Order_Items_Rest
+class Mage_Sales_Model_Api2_Order_Item_Rest_Admin_V1 extends Mage_Sales_Model_Api2_Order_Item_Rest
{
}
diff --git a/app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest/Customer/V1.php b/app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest/Customer/V1.php
similarity index 94%
rename from app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest/Customer/V1.php
rename to app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest/Customer/V1.php
index 87404efadd..765faec03a 100644
--- a/app/code/core/Mage/Sales/Model/Api2/Order/Items/Rest/Customer/V1.php
+++ b/app/code/core/Mage/Sales/Model/Api2/Order/Item/Rest/Customer/V1.php
@@ -31,7 +31,7 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-class Mage_Sales_Model_Api2_Order_Items_Rest_Customer_V1 extends Mage_Sales_Model_Api2_Order_Items_Rest
+class Mage_Sales_Model_Api2_Order_Item_Rest_Customer_V1 extends Mage_Sales_Model_Api2_Order_Item_Rest
{
/**
* Load order by id
diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Discount.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Discount.php
index da63378919..fafd10decb 100644
--- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Discount.php
+++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Discount.php
@@ -55,10 +55,7 @@ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
/** @var $item Mage_Sales_Model_Order_Invoice_Item */
foreach ($invoice->getAllItems() as $item) {
$orderItem = $item->getOrderItem();
- $parentOrderItem = $orderItem->getParentItem();
- if (($orderItem->isDummy() && !$orderItem->getForceApplyDiscountToParentItem())
- || ($parentOrderItem && $orderItem->getForceApplyDiscountToParentItem())
- ) {
+ if ($orderItem->isDummy()) {
continue;
}
diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php
index 8109869768..8fa03f39f8 100644
--- a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php
+++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php
@@ -58,28 +58,12 @@ public function draw()
);
// draw Total (ex)
- $i = 0;
- $prices = $this->getItemPricesForDisplay();
- foreach ($prices as $priceData){
- if (isset($priceData['label'])) {
- // draw Subtotal label
- $lines[$i][] = array(
- 'text' => $priceData['label'],
- 'feed' => 330,
- 'align' => 'right',
- 'width' => 50,
- );
- $i++;
- }
- // draw Subtotal
- $lines[$i][] = array(
- 'text' => $priceData['subtotal'],
- 'feed' => 330,
- 'font' => 'bold',
- 'align' => 'right',
- );
- $i++;
- }
+ $lines[0][] = array(
+ 'text' => $order->formatPriceTxt($item->getRowTotal()),
+ 'feed' => 330,
+ 'font' => 'bold',
+ 'align' => 'right',
+ );
// draw Discount
$lines[0][] = array(
@@ -105,9 +89,9 @@ public function draw()
'align' => 'right'
);
- // draw Subtotal
- $subtotal = $item->getRowTotal()
- + $item->getTaxAmount() + $item->getHiddenTaxAmount() - $item->getDiscountAmount();
+ // draw Total (inc)
+ $subtotal = $item->getRowTotal() + $item->getTaxAmount() + $item->getHiddenTaxAmount()
+ - $item->getDiscountAmount();
$lines[0][] = array(
'text' => $order->formatPriceTxt($subtotal),
'feed' => 565,
diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
index 54e94d14ae..4052f59e62 100644
--- a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
+++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
@@ -67,18 +67,20 @@ public function draw()
// draw item Prices
$i = 0;
$prices = $this->getItemPricesForDisplay();
+ $feedPrice = 395;
+ $feedSubtotal = $feedPrice + 170;
foreach ($prices as $priceData){
if (isset($priceData['label'])) {
// draw Price label
$lines[$i][] = array(
'text' => $priceData['label'],
- 'feed' => 360,
+ 'feed' => $feedPrice,
'align' => 'right'
);
// draw Subtotal label
$lines[$i][] = array(
'text' => $priceData['label'],
- 'feed' => 530,
+ 'feed' => $feedSubtotal,
'align' => 'right'
);
$i++;
@@ -86,14 +88,14 @@ public function draw()
// draw Price
$lines[$i][] = array(
'text' => $priceData['price'],
- 'feed' => 360,
+ 'feed' => $feedPrice,
'font' => 'bold',
'align' => 'right'
);
// draw Subtotal
$lines[$i][] = array(
'text' => $priceData['subtotal'],
- 'feed' => 530,
+ 'feed' => $feedSubtotal,
'font' => 'bold',
'align' => 'right'
);
diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php
index b60891b2dc..8325c20144 100644
--- a/app/code/core/Mage/Sales/Model/Quote.php
+++ b/app/code/core/Mage/Sales/Model/Quote.php
@@ -933,7 +933,7 @@ public function addProductAdvanced(Mage_Catalog_Model_Product $product, $request
if (!$parentItem) {
$parentItem = $item;
}
- if ($parentItem && $candidate->getParentProductId() && !$item->getId()) {
+ if ($parentItem && $candidate->getParentProductId()) {
$item->setParentItem($parentItem);
}
diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
index 4aa20f19e6..eeab9d5c41 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
@@ -559,22 +559,6 @@ public function isChildrenCalculated()
return false;
}
- /**
- * Check if force discount apply to parent item
- *
- * @return bool
- */
- public function getForceApplyDiscountToParentItem()
- {
- if ($this->getParentItem()) {
- $product = $this->getParentItem()->getProduct();
- } else {
- $product = $this->getProduct();
- }
-
- return $product->getTypeInstance()->getForceApplyDiscountToParentItem();
- }
-
/**
* Checking can we ship product separatelly (each child separately)
* or each parent product item can be shipped only like one item
diff --git a/app/code/core/Mage/Sales/etc/api2.xml b/app/code/core/Mage/Sales/etc/api2.xml
index 3fceda27f6..84c3458934 100644
--- a/app/code/core/Mage/Sales/etc/api2.xml
+++ b/app/code/core/Mage/Sales/etc/api2.xml
@@ -31,10 +31,16 @@
Sales130
+
+
+ Order
+ 150
+
+
-
+ sales10sales/api2_order
@@ -154,11 +160,11 @@
1
-
-
- orders
+
+
+ sales_order30
- sales/api2_order_items
+ sales/api2_order_itemsales/order_itemOrder Items
@@ -221,9 +227,9 @@
1
-
-
- orders
+
+
+ sales_order40sales/api2_order_addresssales/order_address
@@ -263,11 +269,11 @@
Address TypeEmail
-
-
- orders
+
+
+ sales_order60
- sales/api2_order_comments
+ sales/api2_order_commentsales/order_status_historyOrder Comments
@@ -298,7 +304,7 @@
1
-
+
diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php
index fb51963241..7b3f68eb1a 100644
--- a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php
+++ b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php
@@ -85,9 +85,7 @@ public function collect(Mage_Sales_Model_Quote_Address $address)
$eventArgs['item'] = $item;
Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
- if ($item->getHasChildren() && $item->isChildrenCalculated()
- && !$item->getForceApplyDiscountToParentItem()
- ) {
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
foreach ($item->getChildren() as $child) {
$this->_calculator->process($child);
$eventArgs['item'] = $child;
diff --git a/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php b/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php
index d69cf15f09..619b323fef 100644
--- a/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php
+++ b/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php
@@ -523,10 +523,10 @@ public function isCityRequired()
/**
* Determine whether zip-code is required for the country of destination
*
- * @param Mage_Shipping_Model_Rate_Request|null $request
+ * @param string|null $countryId
* @return bool
*/
- public function isZipCodeRequired(Mage_Shipping_Model_Rate_Request $request = null)
+ public function isZipCodeRequired($countryId = null)
{
return false;
}
diff --git a/app/code/core/Mage/Tax/Block/Checkout/Shipping.php b/app/code/core/Mage/Tax/Block/Checkout/Shipping.php
index d580fd9edc..9e5daabf44 100644
--- a/app/code/core/Mage/Tax/Block/Checkout/Shipping.php
+++ b/app/code/core/Mage/Tax/Block/Checkout/Shipping.php
@@ -35,7 +35,7 @@ class Mage_Tax_Block_Checkout_Shipping extends Mage_Checkout_Block_Total_Default
protected $_template = 'tax/checkout/shipping.phtml';
/**
- * Check if we need display shipping include and exlude tax
+ * Check if we need display shipping include and exclude tax
*
* @return bool
*/
@@ -81,7 +81,7 @@ public function getShippingExcludeTax()
*/
public function getIncludeTaxLabel()
{
- return $this->helper('tax')->__('Shipping Incl. Tax (%s)', $this->getTotal()->getAddress()->getShippingDescription());
+ return $this->helper('tax')->__('Shipping Incl. Tax (%s)', $this->escapeHtml($this->getTotal()->getAddress()->getShippingDescription()));
}
/**
@@ -91,6 +91,6 @@ public function getIncludeTaxLabel()
*/
public function getExcludeTaxLabel()
{
- return $this->helper('tax')->__('Shipping Excl. Tax (%s)', $this->getTotal()->getAddress()->getShippingDescription());
+ return $this->helper('tax')->__('Shipping Excl. Tax (%s)', $this->escapeHtml($this->getTotal()->getAddress()->getShippingDescription()));
}
}
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php
index fb202e190d..a6f3871b79 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php
@@ -110,13 +110,13 @@ public function isCityRequired()
/**
* Determine whether zip-code is required for the country of destination
*
- * @param Mage_Shipping_Model_Rate_Request|null $request
+ * @param string|null $countryId
* @return bool
*/
- public function isZipCodeRequired(Mage_Shipping_Model_Rate_Request $request = null)
+ public function isZipCodeRequired($countryId = null)
{
- if ($request instanceof Mage_Shipping_Model_Rate_Request) {
- return !Mage::helper('directory')->isZipCodeOptional($request->getDestCountryId());
+ if ($countryId != null) {
+ return !Mage::helper('directory')->isZipCodeOptional($countryId);
}
return true;
}
@@ -207,7 +207,7 @@ public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $r
}
}
- if (!$errorMsg && !$request->getDestPostcode() && $this->isZipCodeRequired($request)) {
+ if (!$errorMsg && !$request->getDestPostcode() && $this->isZipCodeRequired($request->getDestCountryId())) {
$errorMsg = Mage::helper('shipping')->__('This shipping method is not available, please specify ZIP-code');
}
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php
index 6aed24fbd4..06bf2f55c1 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php
@@ -101,13 +101,6 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl_International
*/
protected $_rates = array();
- /**
- * Store Id
- *
- * @var int|null
- */
- protected $_storeId = null;
-
/**
* Carrier's code
*
@@ -184,7 +177,7 @@ protected function _getDefaultValue($origValue, $pathToValue)
if (!$origValue) {
$origValue = Mage::getStoreConfig(
$pathToValue,
- $this->_storeId
+ $this->getStore()
);
}
@@ -204,7 +197,7 @@ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
}
$requestDhl = clone $request;
- $this->_storeId = $requestDhl->getStoreId();
+ $this->setStore($requestDhl->getStoreId());
$origCompanyName = $this->_getDefaultValue(
$requestDhl->getOrigCompanyName(),
@@ -290,7 +283,7 @@ protected function _addParams($requestObject)
public function setRequest(Varien_Object $request)
{
$this->_request = $request;
- $this->_storeId = $request->getStoreId();
+ $this->setStore($request->getStoreId());
$requestObject = new Varien_Object();
@@ -916,7 +909,10 @@ protected function _parseResponse($response)
$result->setTrackingNumber((string)$xml->AirwayBillNumber);
try {
/* @var $pdf Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf */
- $pdf = Mage::getModel('usa/shipping_carrier_dhl_label_pdf', array('info' => $xml));
+ $pdf = Mage::getModel(
+ 'usa/shipping_carrier_dhl_label_pdf',
+ array('info' => $xml, 'request' => $this->_request)
+ );
$result->setShippingLabelContent($pdf->render());
} catch (Exception $e) {
Mage::throwException(Mage::helper('usa')->__($e->getMessage()));
@@ -1105,7 +1101,7 @@ public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $r
}
$countryParams = $this->getCountryParams(
- Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $this->getStore())
+ Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId())
);
if (!$countryParams->getData()) {
$this->_errors[] = Mage::helper('usa')->__('Please, specify origin country');
@@ -1412,7 +1408,7 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
$i = 0;
foreach ($rawRequest->getPackages() as $package) {
$nodePiece = $nodePieces->addChild('Piece', '', '');
- $packageType = 'DC';
+ $packageType = 'EE';
if ($package['params']['container'] == self::DHL_CONTENT_TYPE_NON_DOC) {
$packageType = 'CP';
}
@@ -1447,7 +1443,7 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
$nodeShipmentDetails->addChild('LocalProductCode', $rawRequest->getShippingMethod());
$nodeShipmentDetails->addChild('Date', Mage::getModel('core/date')->date('Y-m-d'));
- $nodeShipmentDetails->addChild('Contents', 'DHL Parcel TEST');
+ $nodeShipmentDetails->addChild('Contents', 'DHL Parcel');
/*
* The DoorTo Element defines the type of delivery service that applies to the shipment.
* The valid values are DD (Door to Door), DA (Door to Airport) , AA and DC (Door to
@@ -1485,7 +1481,7 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
*/
$nodeShipmentDetails->addChild('DoorTo', 'DD');
$nodeShipmentDetails->addChild('Date', Mage::getModel('core/date')->date('Y-m-d'));
- $nodeShipmentDetails->addChild('Contents', 'DHL Parcel TEST');
+ $nodeShipmentDetails->addChild('Contents', 'DHL Parcel');
}
}
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php
index f4582b44bc..3157c1abf5 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php
@@ -34,10 +34,19 @@
class Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf
{
/**
+ * Label Information
+ *
* @var SimpleXMLElement
*/
protected $_info;
+ /**
+ * Shipment Request
+ *
+ * @var Mage_Shipping_Model_Shipment_Request
+ */
+ protected $_request;
+
/**
* Dhl International Label Creation Class constructor
*
@@ -45,7 +54,8 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf
*/
public function __construct(array $arguments)
{
- $this->_info = $arguments['info'];
+ $this->_info = $arguments['info'];
+ $this->_request = $arguments['request'];
}
/**
@@ -77,7 +87,7 @@ public function render()
)
->addServiceFeaturesCodes()
->addDeliveryDateCode()
- ->addShipmentInformation()
+ ->addShipmentInformation($this->_request->getOrderShipment())
->addDateInfo($this->_info->ShipmentDate)
->addWeightInfo((string)$this->_info->ChargeableWeight, (string)$this->_info->WeightUnit)
->addWaybillBarcode((string)$this->_info->AirwayBillNumber, (string)$this->_info->Barcodes->AWBBarCode)
@@ -88,16 +98,20 @@ public function render()
)
->addBorder();
+ $packages = array_values($this->_request->getPackages());
+ $i = 0;
foreach ($this->_info->Pieces->Piece as $piece) {
$page = new Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page($template);
$pdfBuilder->setPage($page)
->addPieceNumber((int)$piece->PieceNumber, (int)$this->_info->Piece)
+ ->addContentInfo($packages[$i])
->addPieceIdBarcode(
(string)$piece->DataIdentifier,
(string)$piece->LicensePlate,
(string)$piece->LicensePlateBarCode
);
array_push($pdf->pages, $page);
+ $i++;
}
return $pdf->render();
}
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php
index de9ca8bf1c..6c7c34a9c9 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php
@@ -190,7 +190,8 @@ public function addProductContentCode($code)
$this->_page->saveGS();
$codes = array(
'TDK' => 0, 'TDE' => 1, 'TDL' => 0, 'TDM' => 1, 'TDT' => 0,
- 'TDY' => 1, 'XPD' => 0, 'DOX' => 0, 'WPX' => 1, 'DOM' => 0
+ 'TDY' => 1, 'XPD' => 0, 'DOX' => 0, 'WPX' => 1, 'ECX' => 0,
+ 'DOM' => 0
);
if (!key_exists($code, $codes)) {
throw new InvalidArgumentException(Mage::helper('usa')->__('Product content code is invalid'));
@@ -454,12 +455,22 @@ public function addDeliveryDateCode()
/**
* Add Shipment Information
*
- * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder
+ * @param Mage_Sales_Model_Order_Shipment $data
+ * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page
+ * @throws Exception
*/
- public function addShipmentInformation()
+ public function addShipmentInformation($data)
{
$this->_page->saveGS();
+ $this->_page->setFont($this->_fontNormal, 6);
+ $refCode = $data->getOrder()->getIncrementId();
+ if (!$refCode) {
+ throw new InvalidArgumentException(Mage::helper('usa')->__('Reference code is missing'));
+ }
+ $this->_page->drawText('Ref Code: ' . Mage::helper('usa')->__('Order #%s', $refCode), $this->_x(8),
+ $this->_y(224)
+ );
$this->_page->restoreGS();
return $this;
}
@@ -510,6 +521,36 @@ public function addWeightInfo($weight, $unit)
return $this;
}
+ /**
+ * Add Content: Shipment Description
+ *
+ * @param array $package
+ * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder
+ * @throws Exception
+ */
+ public function addContentInfo($package)
+ {
+ $this->_page->saveGS();
+ $this->_page->setFont($this->_fontNormal, 6);
+ if (empty($package)) {
+ throw new InvalidArgumentException(Mage::helper('usa')->__('Package content is missing'));
+ }
+
+ $x = 225;
+ $y = 300;
+ $this->_page->drawText('Content: ', $this->_x($x), $this->_y($y));
+ $i = 0;
+ foreach ($package['items'] as $item) {
+ $i++;
+ $this->_page->drawText(substr($item['name'], 0, 20), $this->_x($x), $this->_y($y += 6));
+ if ($i == 12) {
+ break;
+ }
+ }
+ $this->_page->restoreGS();
+ return $this;
+ }
+
/**
* Add Waybill Barcode
*
diff --git a/app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php b/app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php
index 82918d606c..ef409e9d78 100644
--- a/app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php
+++ b/app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php
@@ -112,18 +112,18 @@ protected function _prepareForm()
$this->_addElementTypes($fieldset);
$fieldset->addField('type', 'select', array(
- 'name' => 'type',
- 'label' => Mage::helper('widget')->__('Type'),
- 'title' => Mage::helper('widget')->__('Type'),
- 'class' => '',
- 'values' => $this->getTypesOptionsArray()
+ 'name' => 'type',
+ 'label' => Mage::helper('widget')->__('Type'),
+ 'title' => Mage::helper('widget')->__('Type'),
+ 'required' => true,
+ 'values' => $this->getTypesOptionsArray()
));
$fieldset->addField('package_theme', 'select', array(
- 'name' => 'package_theme',
- 'label' => Mage::helper('widget')->__('Design Package/Theme'),
- 'title' => Mage::helper('widget')->__('Design Package/Theme'),
- 'required' => false,
+ 'name' => 'package_theme',
+ 'label' => Mage::helper('widget')->__('Design Package/Theme'),
+ 'title' => Mage::helper('widget')->__('Design Package/Theme'),
+ 'required' => true,
'values' => $this->getPackegeThemeOptionsArray()
));
$continueButton = $this->getLayout()
diff --git a/app/code/core/Mage/Wishlist/controllers/IndexController.php b/app/code/core/Mage/Wishlist/controllers/IndexController.php
index ca92d79e83..c750064633 100644
--- a/app/code/core/Mage/Wishlist/controllers/IndexController.php
+++ b/app/code/core/Mage/Wishlist/controllers/IndexController.php
@@ -212,7 +212,7 @@ public function addAction()
Mage::helper('wishlist')->calculate();
- $message = $this->__('%1$s has been added to your wishlist. Click here to continue shopping', $product->getName(), Mage::helper('core')->escapeUrl($referer));
+ $message = $this->__('%1$s has been added to your wishlist. Click here to continue shopping.', $product->getName(), Mage::helper('core')->escapeUrl($referer));
$session->addSuccess($message);
}
catch (Mage_Core_Exception $e) {
diff --git a/app/design/adminhtml/default/default/layout/oauth.xml b/app/design/adminhtml/default/default/layout/oauth.xml
index 652e9897ef..efd53a346c 100644
--- a/app/design/adminhtml/default/default/layout/oauth.xml
+++ b/app/design/adminhtml/default/default/layout/oauth.xml
@@ -29,27 +29,27 @@
-
+
-
+
-
-
+
+
-
-
+
+
@@ -58,112 +58,137 @@
-
+
-
+
-
-
-
-
-
+
+
+
+
- oauth/authorize/head-simple.phtml
+ empty.phtml
-
-
+
+ jsscriptaculous/controls.js
+ jsprototype/window.js
+ jsscriptaculous/builder.js
+ jsscriptaculous/dragdrop.js
+ jsscriptaculous/controls.js
+ jsscriptaculous/slider.js
+ jslib/ccard.js
+ jsvarien/js.js
+ jsmage/adminhtml/hash.js
+ jsmage/adminhtml/events.js
+ jsmage/adminhtml/loader.js
+ jsmage/adminhtml/grid.js
+ jsmage/adminhtml/tabs.js
+ jsmage/adminhtml/accordion.js
+
+ jsmage/adminhtml/uploader.js
+ jsmage/adminhtml/product.js
+ jsmage/adminhtml/rules.js
+ jsmage/adminhtml/wysiwyg/tiny_mce/setup.js
+ jslib/ds-sleight.js
+ jsvarien/iehover-fix.js
+
+ cssprint.css
+ js_csscalendar/calendar-win2k-1.css
+ js_cssextjs/resources/css/ext-all.css
+ js_cssextjs/resources/css/ytheme-magento.css
+ skin_cssmenu.css
+ jscalendar/calendar.js
+ jscalendar/calendar-setup.js
+ jsextjs/fix-defer-before.js
+ jsextjs/ext-tree.js
+ jsextjs/fix-defer.js
+ jsextjs/ext-tree-checkbox.js
+
+
+
+
+
+
+
+ oauth-simple.css
+
+
+
+
+
+
+
+
-
- empty.phtml
-
-
-
+
+
+
-
-
-
-
- oauth/authorize/form/login-simple.phtml
-
-
-
-
- oauth/authorize/button-simple.phtml
-
+
+
+
+
-
- empty.phtml
-
-
-
+
-
-
- oauth/authorize/confirm-simple.phtml
-
+
+
+
-
-
- empty.phtml
-
-
-
-
+
-
-
- oauth/authorize/reject-simple.phtml
-
+
+
-
+
-
+
diff --git a/app/design/adminhtml/default/default/template/bundle/sales/order/view/items/renderer.phtml b/app/design/adminhtml/default/default/template/bundle/sales/order/view/items/renderer.phtml
index eb36d73398..08392a4117 100644
--- a/app/design/adminhtml/default/default/template/bundle/sales/order/view/items/renderer.phtml
+++ b/app/design/adminhtml/default/default/template/bundle/sales/order/view/items/renderer.phtml
@@ -364,8 +364,8 @@