diff --git a/app/design/adminhtml/default/default/template/catalog/product/edit.phtml b/app/design/adminhtml/default/default/template/catalog/product/edit.phtml index c75ef6f0b48..0a37ed7f22a 100644 --- a/app/design/adminhtml/default/default/template/catalog/product/edit.phtml +++ b/app/design/adminhtml/default/default/template/catalog/product/edit.phtml @@ -87,7 +87,7 @@ if (productForm.validator.validate()) { var template = new Template(urlTemplate, productTemplateSyntax); var url = template.evaluate({ - attributes: encode_base64(attributes.join(',')).replace(new RegExp('/','g'),'%2F').replace(new RegExp('=','g'),'%3D') + attributes: btoa(attributes.join(',')).replace(new RegExp('/','g'),'%2F').replace(new RegExp('=','g'),'%3D') }); setLocation(url); } diff --git a/app/design/adminhtml/default/default/template/report/grid/container.phtml b/app/design/adminhtml/default/default/template/report/grid/container.phtml index 369ffc9f50a..b0ac8e779ab 100644 --- a/app/design/adminhtml/default/default/template/report/grid/container.phtml +++ b/app/design/adminhtml/default/default/template/report/grid/container.phtml @@ -40,7 +40,7 @@ } var validator = new Validation('filter_form'); if (validator.validate()) { - setLocation('getFilterUrl(); ?>filter/'+encode_base64(Form.serializeElements(elements))+'/'); + setLocation('getFilterUrl(); ?>filter/'+btoa(Form.serializeElements(elements))+'/'); } } //]]> diff --git a/js/mage/adminhtml/grid.js b/js/mage/adminhtml/grid.js index acdc44f4eca..b06e3594bce 100644 --- a/js/mage/adminhtml/grid.js +++ b/js/mage/adminhtml/grid.js @@ -273,7 +273,7 @@ varienGrid.prototype = { } if (!this.doFilterCallback || (this.doFilterCallback && this.doFilterCallback())) { this.addVarToUrl(this.pageVar, 1); - this.reload(this.addVarToUrl(this.filterVar, encode_base64(Form.serializeElements(elements)))); + this.reload(this.addVarToUrl(this.filterVar, btoa(Form.serializeElements(elements)))); } }, resetFilter : function(){ @@ -903,7 +903,7 @@ serializerController.prototype = { if(this.multidimensionalMode){ var clone = this.gridData.clone(); clone.each(function(pair) { - clone.set(pair.key, encode_base64(Object.toQueryString(pair.value))); + clone.set(pair.key, btoa(Object.toQueryString(pair.value))); }); return clone.toQueryString(); } diff --git a/js/mage/adminhtml/hash.js b/js/mage/adminhtml/hash.js index 74c341afd5a..e92856ec373 100644 --- a/js/mage/adminhtml/hash.js +++ b/js/mage/adminhtml/hash.js @@ -8,144 +8,22 @@ * @category Mage * @package Mage_Adminhtml * @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com) - * @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org) + * @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org) * @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -/* - * Caudium - An extensible World Wide Web server - * Copyright C 2002 The Caudium Group - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -/* - * base64.js - a JavaScript implementation of the base64 algorithm, - * (mostly) as defined in RFC 2045. - * - * This is a direct JavaScript reimplementation of the original C code - * as found in the Exim mail transport agent, by Philip Hazel. - * - * $Id: base64.js,v 1.7 2002/07/16 17:21:23 kazmer Exp $ - * +/** + * @deprecated */ - - -function encode_base64( what ) +function encode_base64(what) { - var base64_encodetable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var result = ""; - var len = what.length; - var x, y; - var ptr = 0; - - while( len-- > 0 ) - { - x = what.charCodeAt( ptr++ ); - result += base64_encodetable.charAt( ( x >> 2 ) & 63 ); - - if( len-- <= 0 ) - { - result += base64_encodetable.charAt( ( x << 4 ) & 63 ); - result += "=="; - break; - } - - y = what.charCodeAt( ptr++ ); - result += base64_encodetable.charAt( ( ( x << 4 ) | ( ( y >> 4 ) & 15 ) ) & 63 ); - - if ( len-- <= 0 ) - { - result += base64_encodetable.charAt( ( y << 2 ) & 63 ); - result += "="; - break; - } - - x = what.charCodeAt( ptr++ ); - result += base64_encodetable.charAt( ( ( y << 2 ) | ( ( x >> 6 ) & 3 ) ) & 63 ); - result += base64_encodetable.charAt( x & 63 ); - - } - - return result; -} - - -function decode_base64( what ) -{ - var base64_decodetable = new Array ( - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, 255, 255, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 255, 255, 255, - 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255, - 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 255, 255, 255, 255, 255 - ); - var result = ""; - var len = what.length; - var x, y; - var ptr = 0; - - while( !isNaN( x = what.charCodeAt( ptr++ ) ) ) - { - if( x == 13 || x == 10 ) - continue; - - if( ( x > 127 ) || (( x = base64_decodetable[x] ) == 255) ) - return false; - if( ( isNaN( y = what.charCodeAt( ptr++ ) ) ) || (( y = base64_decodetable[y] ) == 255) ) - return false; - - result += String.fromCharCode( (x << 2) | (y >> 4) ); - - if( (x = what.charCodeAt( ptr++ )) == 61 ) - { - if( (what.charCodeAt( ptr++ ) != 61) || (!isNaN(what.charCodeAt( ptr ) ) ) ) - return false; - } - else - { - if( ( x > 127 ) || (( x = base64_decodetable[x] ) == 255) ) - return false; - result += String.fromCharCode( (y << 4) | (x >> 2) ); - if( (y = what.charCodeAt( ptr++ )) == 61 ) - { - if( !isNaN(what.charCodeAt( ptr ) ) ) - return false; - } - else - { - if( (y > 127) || ((y = base64_decodetable[y]) == 255) ) - return false; - result += String.fromCharCode( (x << 6) | y ); - } - } - } - return result; + return btoa(what); } -function wrap76( what ) +/** + * @deprecated + */ +function decode_base64(what) { - var result = ""; - var i; - - for(i=0; i < what.length; i+=76) - { - result += what.substring(i, i+76) + String.fromCharCode(13) + String.fromCharCode(10); - } - return result; + return atob(what); }