diff --git a/Dockerfile b/Dockerfile index e6a0fc4c..5e89dc24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,9 +33,9 @@ RUN curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | apt-key add - \ > /etc/apt/sources.list.d/vn.list \ && apt-get update \ && apt-get install -y --no-install-recommends \ + php-apcu \ php-image-text \ php-text-captcha \ - php-apcu \ php-zip \ hedera-web \ cron diff --git a/debian/changelog b/debian/changelog index 87edd34d..389511fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (22.48.5) stable; urgency=low +hedera-web (22.48.10) stable; urgency=low * Initial Release. diff --git a/debian/control b/debian/control index 46b92b74..99dddf1b 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Vcs-Git: https://gitea.verdnatura.es/verdnatura/hedera-web Package: hedera-web Architecture: all Depends: apache2 | httpd, nodejs, php-cli, php-vn-lib, php-apcu, php-imap, php-soap, libphp-phpmailer, php-gd, php-pear -Suggests: php-text-captcha, php-zip, cron +Suggests: php-image-text, php-text-captcha, php-zip, cron Section: misc Priority: optional Description: Verdnatura's web page diff --git a/debian/cron.d b/debian/cron.d index 1037bb2c..846174c7 100755 --- a/debian/cron.d +++ b/debian/cron.d @@ -1,6 +1,5 @@ MAILTO=webmaster */1 * * * * root hedera-web.php -m misc/mail -*/4 * * * * root hedera-web.php -m tpv/confirm-mail */2 * * * * root hedera-web.php -m edi/load 0 23 * * * root hedera-web.php -m edi/clean 0 5 * * * root hedera-web.php -m edi/update diff --git a/forms/account/conf/index.js b/forms/account/conf/index.js index 1cd8855a..c603b618 100644 --- a/forms/account/conf/index.js +++ b/forms/account/conf/index.js @@ -28,45 +28,54 @@ export default new Class({ } ,async onPassModifyClick() { - var oldPassword = this.$.oldPassword.value; - var newPassword = this.$.newPassword.value; - var repeatedPassword = this.$.repeatPassword.value; - - if (newPassword == '' && repeatedPassword == '') - throw new Error(_('Passwords empty')); - if (newPassword !== repeatedPassword) - throw new Error(_('Passwords doesn\'t match')); - - var verificationToken = this.hash.$.verificationToken; - var params = {newPassword}; - - let err; + const form = this.$.changePassword.node; + Vn.Node.disableInputs(form); try { - if (verificationToken) { - params.verificationToken = verificationToken; - await this.conn.send('user/restore-password', params); - } else { - let userId = this.gui.user.id; - params.oldPassword = oldPassword; - await this.conn.patch( - `Accounts/${userId}/changePassword`, params); + const oldPassword = this.$.oldPassword.value; + const newPassword = this.$.newPassword.value; + const repeatedPassword = this.$.repeatPassword.value; + + try { + if (newPassword == '' && repeatedPassword == '') + throw new Error(_('Passwords empty')); + if (newPassword !== repeatedPassword) + throw new Error(_('Passwords doesn\'t match')); + } catch (err) { + return Htk.Toast.showError(err.message); } - } catch(e) { - err = e; - Htk.Toast.showError(err.message); + + const verificationToken = this.hash.$.verificationToken; + const params = {newPassword}; - if (this.hash.$.verificationToken) - this.$.newPassword.select(); - else - this.$.oldPassword.select(); + try { + if (verificationToken) { + params.verificationToken = verificationToken; + await this.conn.send('user/restore-password', params); + } else { + let userId = this.gui.user.id; + params.oldPassword = oldPassword; + await this.conn.patch( + `Accounts/${userId}/changePassword`, params); + } + } catch(err) { + Htk.Toast.showError(err.message); - return; + if (verificationToken) + this.$.newPassword.select(); + else + this.$.oldPassword.select(); + + return; + } + + this.hash.unset('verificationToken'); + await this.conn.open(this.gui.user.name, newPassword); + this.$.changePassword.hide(); + } finally { + Vn.Node.disableInputs(form, false); } - - this.$.changePassword.hide(); - this.hash.unset('verificationToken'); + Htk.Toast.showMessage(_('Password changed!')); - this.$.userForm.refresh(); } ,onPassInfoClick() { diff --git a/forms/account/conf/ui.xml b/forms/account/conf/ui.xml index cc60d89a..86d7c29b 100644 --- a/forms/account/conf/ui.xml +++ b/forms/account/conf/ui.xml @@ -89,11 +89,13 @@ + placeholder="_New password" + autocomplete="new-password"/> + placeholder="_Repeat password" + autocomplete="new-password"/>
-
+

diff --git a/forms/ecomerce/checkout/style.scss b/forms/ecomerce/checkout/style.scss index cb95cfab..84448043 100644 --- a/forms/ecomerce/checkout/style.scss +++ b/forms/ecomerce/checkout/style.scss @@ -1,54 +1,55 @@ -.checkout .bar { - margin-bottom: 16px; -} +.hedera-checkout { + .bar { + margin-bottom: 16px; + } -/* Step */ + /* Step */ -.answers button, -.answers p, -.radio > div { - font-size: 1.2rem; + .answers button, + .answers p, + .radio > div { + font-size: 1.2rem; + } + .answers .htk-select { + max-width: 15em; + margin: 0 auto; + font-size: 1.4rem; + } + .answers p { + margin: 0.3em 0; + } + .target { + max-width: 28em; + margin: 0 auto; + } + .address { + border-radius: 0.1em; + padding: 0.6em 1.4em; + } + .address.selected { + background-color: rgba(1, 1, 1, .1); + } + .address:hover { + cursor: pointer; + background-color: rgba(1, 1, 1, .05); + } + .address p.consignee { + font-weight: bold; + } + .radio { + max-width: 20em; + margin: 0 auto; + } + .radio > div { + padding: 0.5em; + } + .thin-calendar { + max-width: 24em; + margin: 0 auto; + box-shadow: none; + } + .htk-assistant .thin { + float: right; + } } -.answers .htk-select { - max-width: 15em; - margin: 0 auto; - font-size: 1.4rem; -} -.answers p { - margin: 0.3em 0; -} -.target { - max-width: 28em; - margin: 0 auto; -} -.address { - border-radius: 0.1em; - padding: 0.6em 1.4em; -} -.address.selected { - background-color: rgba(1, 1, 1, .1); -} -.address:hover { - cursor: pointer; - background-color: rgba(1, 1, 1, .05); -} -.address p.consignee { - font-weight: bold; -} -.radio { - max-width: 20em; - margin: 0 auto; -} -.radio > div { - padding: 0.5em; -} -.thin-calendar { - max-width: 24em; - margin: 0 auto; - box-shadow: none; -} -.htk-assistant .thin { - float: right; -} - diff --git a/forms/ecomerce/checkout/ui.xml b/forms/ecomerce/checkout/ui.xml index f9a32719..a62d37cc 100644 --- a/forms/ecomerce/checkout/ui.xml +++ b/forms/ecomerce/checkout/ui.xml @@ -54,7 +54,7 @@ tip="_Cancel" on-click="onCancelClick"/>

-
+
table { - border-collapse: collapse; -} -.confirm td { - padding: .15em 0; -} -.confirm .sum-total > td { - border-top: solid 1px #DDD; - font-weight: bold; -} -.confirm .currency { - text-align: right; -} -.confirm .credit-info { - display: none; -} -.confirm .exceeded-info { - display: none; - color: #E53935; -} + .debt-info { + padding: 0; + } + .debt-info > table { + border-collapse: collapse; + } + td { + padding: .15em 0; + } + .sum-total > td { + border-top: solid 1px #DDD; + font-weight: bold; + } + .currency { + text-align: right; + } + .credit-info { + display: none; + } + .exceeded-info { + display: none; + color: #E53935; + } -/* Pay */ + /* Pay */ -.confirm .amount-selector, -.confirm .pay-methods > div { - display: none; -} -.confirm .pay-methods > div { - margin: .3em 0; -} -.confirm .pay-methods > div > label > input[type=radio] { - margin: 0; - margin-right: .5em; - vertical-align: middle; -} -.confirm .pay-methods > div > div { - padding: .5em 1.5em; - display: none; -} -.confirm .pay-methods > div.selected > div { - display: block; -} -.confirm .transfer-account { - margin-top: .5em; -} -.confirm .transfer-account > p { - margin: .1em 0; -} + .amount-selector, + .pay-methods > div { + display: none; + } + .pay-methods > div { + margin: .3em 0; + } + .pay-methods > div > label > input[type=radio] { + margin: 0; + margin-right: .5em; + vertical-align: middle; + } + .pay-methods > div > div { + padding: .5em 1.5em; + display: none; + } + .pay-methods > div.selected > div { + display: block; + } + .transfer-account { + margin-top: .5em; + } + .transfer-account > p { + margin: .1em 0; + } -.confirm .payment > div { - margin-bottom: 1.4em; + .payment > div { + margin-bottom: 1.4em; + } + .payment > .button-bar { + display: flex; + justify-content: space-between; + margin-bottom: 0; + margin-top: 32px; + } + .payment > .button-bar button{ + font-size: 1.2rem; + border-radius: 2rem; + padding: .5rem 1rem; + margin: 0; + } + .modify-order { + border: 1px solid #1a1a1a; + } + .modify-order:hover { + color: white; + background-color: #1a1a1a; + } + .confirm-order { + border: 1px solid #8cc63f; + background-color: #8cc63f; + color: white; + } + .confirm-order:hover { + background-color: transparent; + color: #6b5; + } } -.confirm .payment > .button-bar { - display: flex; - justify-content: space-between; - margin-bottom: 0; - margin-top: 32px; -} -.confirm .payment > .button-bar button{ - font-size: 1.2rem; - border-radius: 2rem; - padding: .5rem 1rem; - margin: 0; -} -.confirm .modify-order { - border: 1px solid #1a1a1a; -} -.confirm .modify-order:hover { - color: white; - background-color: #1a1a1a; -} -.confirm .confirm-order { - border: 1px solid #8cc63f; - background-color: #8cc63f; - color: white; -} -.confirm .confirm-order:hover { - background-color: transparent; - color: #6b5; -} \ No newline at end of file diff --git a/forms/ecomerce/confirm/ui.xml b/forms/ecomerce/confirm/ui.xml index c9deba20..7e30892b 100644 --- a/forms/ecomerce/confirm/ui.xml +++ b/forms/ecomerce/confirm/ui.xml @@ -23,14 +23,11 @@ tmp.orderTax; - - CALL myBasket_confirm -

Order summary

-
+
diff --git a/forms/ecomerce/invoices/ui.xml b/forms/ecomerce/invoices/ui.xml index e69a3ce7..aa6244a0 100644 --- a/forms/ecomerce/invoices/ui.xml +++ b/forms/ecomerce/invoices/ui.xml @@ -2,7 +2,7 @@

Invoices

-
+
diff --git a/forms/ecomerce/orders/ui.xml b/forms/ecomerce/orders/ui.xml index 9d83e3c5..395f4275 100644 --- a/forms/ecomerce/orders/ui.xml +++ b/forms/ecomerce/orders/ui.xml @@ -34,7 +34,7 @@ tip="_ShoppingBasket" on-click="onBasketClick"/>
-
+
div > div { - margin: 15px 0; -} -.ticket .head > div > div:first-child { - margin: 0; -} -.ticket .head p { - margin: 3px 0; -} -.ticket .head p.important { - font-size: 1.2rem; - font-weight: bold; -} -.ticket .total { - text-align: right; -} -.ticket .packages { - margin-top: 14px; - padding-top: 14px; - border-top: 1px solid #DDD; - display: block; -} + .head { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px solid #DDD; + margin-bottom: 1px; + } + .head > div > div { + margin: 15px 0; + } + .head > div > div:first-child { + margin: 0; + } + .head p { + margin: 3px 0; + } + .head p.important { + font-size: 1.2rem; + font-weight: bold; + } + .total { + text-align: right; + } + .packages { + margin-top: 14px; + padding-top: 14px; + border-top: 1px solid #DDD; + display: block; + } -/* Lines */ + /* Lines */ -.ticket .line { - display: flex; - align-items: center; - gap: 12px; - margin: 10px 0; - height: 80px; + .line { + display: flex; + align-items: center; + gap: 12px; + margin: 10px 0; + height: 80px; + } + .line:last-child { + margin-bottom: 0; + } + .line > .photo { + flex: none; + border-radius: 50%; + width: 68px; + height: 68px; + gap: 0; + } + .line > .info { + flex: 1; + overflow: hidden; + } + .line > .info > * { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + .line > .info > h2 { + font-size: 1rem; + font-weight: normal; + margin-bottom: 2px; + } + .line > .info > p { + margin: 0; + } + .line > .info > .tags { + color: #777; + } + .line > .info .discount { + color: green; + } + .line > .info > .subtotal { + float: right; + } } -.ticket .line:last-child { - margin-bottom: 0; -} -.ticket .line > .photo { - flex: none; - border-radius: 50%; - width: 68px; - height: 68px; - gap: 0; -} -.ticket .line > .info { - flex: 1; - overflow: hidden; -} -.ticket .line > .info > * { - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; -} -.ticket .line > .info > h2 { - font-size: 1rem; - font-weight: normal; - margin-bottom: 2px; -} -.ticket .line > .info > p { - margin: 0; -} -.ticket .line > .info > .tags { - color: #777; -} -.ticket .line > .info .discount { - color: green; -} -.ticket .line > .info > .subtotal { - float: right; -} - diff --git a/forms/ecomerce/ticket/ui.xml b/forms/ecomerce/ticket/ui.xml index c31e5f4e..4fb8f231 100644 --- a/forms/ecomerce/ticket/ui.xml +++ b/forms/ecomerce/ticket/ui.xml @@ -14,7 +14,7 @@ tip="_Print delivery note" on-click="this.onPrintClick()"/>
-
+
#{{ticket.id}}
diff --git a/js/hedera/app.js b/js/hedera/app.js index 6e7ba1c2..394ab2fe 100644 --- a/js/hedera/app.js +++ b/js/hedera/app.js @@ -198,11 +198,11 @@ module.exports = new Class({ ,async _onConnError(conn, err) { if (!(err instanceof Vn.JsonException)) return; switch (err.exception) { - case 'UserDisabled': + case 'UserDisabledError': Htk.Toast.showError(_('User disabled')); await this._logout(); return; - case 'OutdatedVersion': + case 'OutdatedVersionError': this._newVersion(); return; } @@ -222,8 +222,8 @@ module.exports = new Class({ Htk.Toast.showError(_('You don\'t have enough privileges')); else { switch (err.exception) { - case 'UserDisabled': - case 'OutdatedVersion': + case 'UserDisabledError': + case 'OutdatedVersionError': return; } if (err.statusCode == 401) diff --git a/js/hedera/gui.js b/js/hedera/gui.js index 60c8f130..9f391b75 100644 --- a/js/hedera/gui.js +++ b/js/hedera/gui.js @@ -50,19 +50,16 @@ module.exports = new Class({ this.doc.body.appendChild(this.node); Htk.Toast.pushTop(this.$.formHolder); + await this.refreshUserData(); + Vn.Node.setText(this.$.userName, this.user.nickname); + const resultSet = await this._conn.execQuery( - 'SELECT id, name, nickname FROM account.myUser;' - +'SELECT defaultForm FROM config;' + 'SELECT defaultForm FROM config;' +'SELECT url FROM imageConfig;' +'SELECT dbproduccion FROM vn.config;' +'SELECT productionDomain, testDomain FROM config;' ); - // Retrieving the user name - - this.user = resultSet.fetchObject(); - Vn.Node.setText(this.$.userName, this.user.nickname); - // Retrieving configuration parameters Vn.Config.defaultForm = resultSet.fetchValue(); @@ -119,6 +116,12 @@ module.exports = new Class({ Htk.Toast.showWarning(_('By using this site you accept cookies')); } } + + ,async refreshUserData() { + const resultSet = await this._conn.execQuery( + 'SELECT id, name, nickname FROM account.myUser'); + this.user = resultSet.fetchObject(); + } ,async hide() { if (!this._shown) @@ -474,11 +477,8 @@ module.exports = new Class({ this._conn.token = json; sessionStorage.setItem('supplantUser', supplantUser); - const resultSet = await this._conn.execQuery( - 'SELECT nickname FROM account.myUser'); - - const userName = resultSet.fetchValue(); - Vn.Node.setText(this.$.supplanted, userName); + await this.refreshUserData(); + Vn.Node.setText(this.$.supplanted, this.user.nickname); this.$.supplant.classList.toggle('show', true); await this.loadMenu(); } @@ -492,6 +492,7 @@ module.exports = new Class({ sessionStorage.removeItem('supplantUser'); this.$.supplant.classList.toggle('show', false); + await this.refreshUserData(); await this.loadMenu(); this._onFormChange(); } diff --git a/js/hedera/tpv.js b/js/hedera/tpv.js index dc759476..6deacca8 100644 --- a/js/hedera/tpv.js +++ b/js/hedera/tpv.js @@ -9,11 +9,10 @@ module.exports = new Class({ this.tpvStatus = this.hash.$.tpvStatus; if (this.tpvStatus) { - const query = 'CALL myTpvTransaction_end(#transaction, #status)'; - this.conn.execQuery(query, { - transaction: this.tpvOrder, + this.conn.post('TpvTransactions/end', { + orderId: this.tpvOrder, status: this.tpvStatus - }); + }) } return this.tpvStatus; @@ -29,11 +28,11 @@ module.exports = new Class({ return; } - const json = await this.conn.send('tpv/transaction', { - amount: parseInt(amount) - ,urlOk: this._makeUrl('ok') - ,urlKo: this._makeUrl('ko') - ,company + const json = await this.conn.post('TpvTransactions/start', { + amount: parseInt(amount), + urlOk: this._makeUrl('ok'), + urlKo: this._makeUrl('ko'), + company }); const postValues = json.postValues; diff --git a/js/vn/json-connection.js b/js/vn/json-connection.js index 12013dc6..6a088aaa 100644 --- a/js/vn/json-connection.js +++ b/js/vn/json-connection.js @@ -50,9 +50,8 @@ module.exports = new Class({ if (user !== null && user !== undefined) { params = { - user: user, - password: pass, - remember: remember + user, + password: pass }; } else params = null; @@ -261,7 +260,7 @@ module.exports = new Class({ if (exception) { exception = exception .replace(/\\/g, '.') - .replace(/Exception$/, '') + .replace(/Exception$/, 'Error') .replace(/^Vn\.Web\./, ''); err.exception = exception; diff --git a/js/vn/lot-iface.js b/js/vn/lot-iface.js index 2678e9af..4c4f1b96 100644 --- a/js/vn/lot-iface.js +++ b/js/vn/lot-iface.js @@ -1,4 +1,3 @@ - /** * Holds a plain key-value javascript object and monitorizes changes over it. */ @@ -10,14 +9,14 @@ module.exports = new Class({ */ params: { type: Object - } + }, /** * Shortcut for params property. */ - ,$: { + $: { type: Object - } - } + } + }, /** * Gets a value from the lot. @@ -25,9 +24,9 @@ module.exports = new Class({ * @param {string} field The field name * @return {*} The field value */ - ,get(field) { - return this.params[field]; - } + get(field) { + return this.params[field]; + }, /** * Sets a value on the lot. @@ -35,49 +34,51 @@ module.exports = new Class({ * @param {string} field The field name * @param {*} value The new field value */ - ,set(field, value) { - var params = {}; - params[field] = value; - this.assign(params); - } - + set(field, value) { + this.assign({[field]: value}); + }, + + unset(field) { + this.assign({[field]: undefined}); + }, + /** * Returns an array with the lot keys. * * @return {Array} The lot keys */ - ,keys() {} + keys() {}, /** * Emits the 'change' signal on the lot. * * @param {Object} changes The changed params and its values */ - ,changed(changes) { - this.emit('change', changes); - } + changed(changes) { + this.emit('change', changes); + }, /** * Copies all values from another lot. * * @param {Object} object The source object */ - ,assign() {} + assign() {}, /** * Copies all values from another lot. * * @param {LotIface} lot The source lot */ - ,assignLot(lot) { - this.assign(lot.$); - } + assignLot(lot) { + this.assign(lot.$); + }, /** * Resets all values. */ - ,reset() { - this.params = {}; - } + reset() { + this.params = {}; + } }); \ No newline at end of file diff --git a/js/vn/node.js b/js/vn/node.js index c75bac86..3cdb28c7 100644 --- a/js/vn/node.js +++ b/js/vn/node.js @@ -1,66 +1,63 @@ -module.exports = -{ - removeChilds: function (node) - { +module.exports = { + removeChilds(node) { var childs = node.childNodes; if (childs) while (childs.length > 0) - node.removeChild (childs[0]); - } + node.removeChild(childs[0]); + }, - ,remove: function (node) - { + remove(node) { if (node.parentNode) - node.parentNode.removeChild (node); - } + node.parentNode.removeChild(node); + }, - ,setText: function (node, text) - { - Vn.Node.removeChilds (node); + setText(node, text) { + Vn.Node.removeChilds(node); if (text) - node.appendChild ( - node.ownerDocument.createTextNode (text)); - } + node.appendChild( + node.ownerDocument.createTextNode(text)); + }, - ,addClass: function (node, className) - { -/* var classes = node.className.split (' '); + addClass(node, className) { +/* var classes = node.className.split(' '); - if (classes.split (' ').indexOf (className) == -1) + if (classes.split(' ').indexOf(className) == -1) */ node.className = className +' '+ node.className; - } + }, - ,removeClass: function (node, className) - { + removeClass(node, className) { var index = 0; var found = false; - var classes = node.className.split (' '); + var classes = node.className.split(' '); - while ((index = classes.indexOf (className, index)) != -1) - { - classes.splice (index, 1); + while ((index = classes.indexOf(className, index)) != -1) { + classes.splice(index, 1); found = true; } if (found) - node.className = classes.join (' '); - } + node.className = classes.join(' '); + }, - ,hide: function (node) - { + hide: function(node) { node.style.display = 'none'; - } + }, - ,show: function (node) - { + show: function(node) { node.style.display = 'block'; + }, + + disableInputs(formNode, disable = true) { + const inputs = formNode + .querySelectorAll('input, textarea, button, select'); + for (const input of inputs) + input.disabled = disable; } }; -$ = function (id) -{ - return document.getElementById (id); +$ = function(id) { + return document.getElementById(id); } diff --git a/package.json b/package.json index 11df0f03..59043dd7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "22.48.5", + "version": "22.48.10", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { diff --git a/pages/update-browser/firefox.png b/pages/update-browser/firefox.png new file mode 100644 index 00000000..2d25601a Binary files /dev/null and b/pages/update-browser/firefox.png differ diff --git a/pages/update-browser/locale/ca.yml b/pages/update-browser/locale/ca.yml index 6dc920c4..469ac938 100644 --- a/pages/update-browser/locale/ca.yml +++ b/pages/update-browser/locale/ca.yml @@ -1,2 +1,4 @@ UpdateYourBrowser: Actualitza el teu navegador ContinueAnyway: Continuar igualment +BrowserVersionNotCompatible: El vostre navegador no és compatible amb aquesta versió de la pàgina web +PushHereToInstallFirefox: Clica aquí per instal·lar Firefox diff --git a/pages/update-browser/locale/en.yml b/pages/update-browser/locale/en.yml index 3660ead7..645930b3 100644 --- a/pages/update-browser/locale/en.yml +++ b/pages/update-browser/locale/en.yml @@ -1,2 +1,4 @@ UpdateYourBrowser: Upgrade your browser ContinueAnyway: Continue anyway +BrowserVersionNotCompatible: Your browser is not compatible with this version of the website +PushHereToInstallFirefox: Click here to install Firefox diff --git a/pages/update-browser/locale/es.yml b/pages/update-browser/locale/es.yml index 39adff07..a2c5219d 100644 --- a/pages/update-browser/locale/es.yml +++ b/pages/update-browser/locale/es.yml @@ -1,2 +1,4 @@ UpdateYourBrowser: Actualiza tu navegador ContinueAnyway: Continuar de todos modos +BrowserVersionNotCompatible: Tu navegador no es compatible con esta versión de la página web +PushHereToInstallFirefox: Pulsa aquí para instalar Firefox diff --git a/pages/update-browser/locale/fr.yml b/pages/update-browser/locale/fr.yml index 8500ff28..83d75eee 100644 --- a/pages/update-browser/locale/fr.yml +++ b/pages/update-browser/locale/fr.yml @@ -1,2 +1,4 @@ UpdateYourBrowser: Mettez à jour votre navigateur ContinueAnyway: Continuer +BrowserVersionNotCompatible: Votre navigateur n'est pas compatible avec cette version du site +PushHereToInstallFirefox: Cliquez ici pour installer Firefox diff --git a/pages/update-browser/locale/mn.yml b/pages/update-browser/locale/mn.yml deleted file mode 100644 index 3660ead7..00000000 --- a/pages/update-browser/locale/mn.yml +++ /dev/null @@ -1,2 +0,0 @@ -UpdateYourBrowser: Upgrade your browser -ContinueAnyway: Continue anyway diff --git a/pages/update-browser/locale/pt.yml b/pages/update-browser/locale/pt.yml index 37048a27..e3ea26bf 100644 --- a/pages/update-browser/locale/pt.yml +++ b/pages/update-browser/locale/pt.yml @@ -1,2 +1,4 @@ UpdateYourBrowser: Atualize seu navegador ContinueAnyway: Continuar de todas maneiras +BrowserVersionNotCompatible: Seu navegador não é compatível com esta versão do site +PushHereToInstallFirefox: Clique aqui para instalar o Firefox diff --git a/pages/update-browser/style.css b/pages/update-browser/style.css index 8fff05e8..299b3465 100644 --- a/pages/update-browser/style.css +++ b/pages/update-browser/style.css @@ -1,26 +1,53 @@ -* -{ +* { font-family: 'Roboto'; } -img -{ - position: absolute; - margin-top: -200px; - margin-left: -200px; - top: 50%; - left: 50%; +.box { + text-align: center; + margin: 0 auto; + max-width: 380px; + padding: 40px; + padding-bottom: 60px; } -#continue -{ - position: absolute; +.logo { + padding: 5px; + max-width: 100%; +} +h2 { + font-weight: normal; + font-size: 22px; +} +.browser-logo { + display: block; + margin: 30px auto; + height: 120px; +} +.download { + display: block; +} +.bottom { + position: fixed; bottom: 0; left: 0; right: 0; margin: 1em; text-align: center; + color: white; } -a -{ - color: #444; +.continue { + color: white; + background-color: #8cc63f; + padding: 5px; + border-radius: 3px; +} +.continue:hover { + text-decoration: none; + background-color: #7eb239; +} +a { + color: #6a1; border-width: 0; + text-decoration: none; +} +a:hover { + text-decoration: underline; } diff --git a/pages/update-browser/ui.php b/pages/update-browser/ui.php index b5faeb43..aad4f191 100644 --- a/pages/update-browser/ui.php +++ b/pages/update-browser/ui.php @@ -2,20 +2,35 @@ - + Verdnatura -
- - <?=s('UpdateYourBrowser')?> + -
- + diff --git a/pages/update-browser/update-browser.png b/pages/update-browser/update-browser.png deleted file mode 100644 index 7be69691..00000000 Binary files a/pages/update-browser/update-browser.png and /dev/null differ diff --git a/reports/recover-password/locale/en.json b/reports/recover-password/locale/en.json deleted file mode 100644 index d6652994..00000000 --- a/reports/recover-password/locale/en.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Recover password": "Recover password", - "Press on the following link to change your password.": "Press on the following link to change your password." -} diff --git a/reports/recover-password/locale/en.yml b/reports/recover-password/locale/en.yml new file mode 100644 index 00000000..66592d30 --- /dev/null +++ b/reports/recover-password/locale/en.yml @@ -0,0 +1,2 @@ +recoverPassword: Recover password +pressLinkToRecoverPassword: Press on the following link to change your password. diff --git a/reports/recover-password/locale/es.json b/reports/recover-password/locale/es.json deleted file mode 100644 index 9525e11c..00000000 --- a/reports/recover-password/locale/es.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Recover password": "Restaurar contraseña", - "Press on the following link to change your password.": "Pulsa en el siguiente link para cambiar tu contraseña." -} diff --git a/reports/recover-password/locale/es.yml b/reports/recover-password/locale/es.yml new file mode 100644 index 00000000..64166de7 --- /dev/null +++ b/reports/recover-password/locale/es.yml @@ -0,0 +1,2 @@ +recoverPassword: Restaurar contraseña +pressLinkToRecoverPassword: Pulsa en el siguiente link para cambiar tu contraseña. diff --git a/reports/recover-password/locale/fr.json b/reports/recover-password/locale/fr.json deleted file mode 100644 index ac05d0bd..00000000 --- a/reports/recover-password/locale/fr.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Recover password": "Réinitialisation du mot de passe", - "Press on the following link to change your password.": "Appuyez sur le lien suivant pour changer votre mot de passe." -} diff --git a/reports/recover-password/locale/fr.yml b/reports/recover-password/locale/fr.yml new file mode 100644 index 00000000..61e2c2b7 --- /dev/null +++ b/reports/recover-password/locale/fr.yml @@ -0,0 +1,2 @@ +recoverPassword: Réinitialisation du mot de passe +pressLinkToRecoverPassword: Appuyez sur le lien suivant pour changer votre mot de passe. diff --git a/reports/recover-password/locale/pt.json b/reports/recover-password/locale/pt.json deleted file mode 100644 index 0fab61fb..00000000 --- a/reports/recover-password/locale/pt.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Recover password": "Recuperar palavra-passe", - "Press on the following link to change your password.": "Pressione o botão para modificar sua palavra-passe." -} diff --git a/reports/recover-password/locale/pt.yml b/reports/recover-password/locale/pt.yml new file mode 100644 index 00000000..e3fb0256 --- /dev/null +++ b/reports/recover-password/locale/pt.yml @@ -0,0 +1,2 @@ +recoverPassword: Recuperar palavra-passe +pressLinkToRecoverPassword: Pressione o botão para modificar sua palavra-passe. diff --git a/reports/recover-password/ui.php b/reports/recover-password/ui.php index d9fffee7..027f33a9 100644 --- a/reports/recover-password/ui.php +++ b/reports/recover-password/ui.php @@ -1,7 +1,7 @@ - +

- +

- + diff --git a/rest/client/supplant.php b/rest/client/supplant.php index 4ef83402..87715601 100644 --- a/rest/client/supplant.php +++ b/rest/client/supplant.php @@ -10,7 +10,7 @@ class Supplant extends Vn\Web\JsonRequest { 'SELECT id FROM account.user WHERE `name` = #', [$_REQUEST['supplantUser']] ); - +/* $isClient = $db->getValue( 'SELECT COUNT(*) > 0 FROM vn.client WHERE id = #', [$userId] @@ -24,7 +24,7 @@ class Supplant extends Vn\Web\JsonRequest { ); if ($hasAccount) throw new Web\ForbiddenException(s('The user is not impersonable')); - +*/ return $this->service->createToken($_REQUEST['supplantUser']); } } diff --git a/rest/core/locale/ca.json b/rest/core/locale/ca.json deleted file mode 100644 index 3bc546a6..00000000 --- a/rest/core/locale/ca.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "InvalidAction": "Acció invàlida" - - ,"EmptyQuery": "Consulta buida" -} diff --git a/rest/core/locale/ca.yml b/rest/core/locale/ca.yml new file mode 100644 index 00000000..fd0c7306 --- /dev/null +++ b/rest/core/locale/ca.yml @@ -0,0 +1,2 @@ +InvalidAction: Acció invàlida +EmptyQuery: Consulta buida diff --git a/rest/core/locale/en.json b/rest/core/locale/en.json deleted file mode 100644 index 75f9e384..00000000 --- a/rest/core/locale/en.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "InvalidAction": "Invalid action" - - ,"EmptyQuery": "Empty query" -} diff --git a/rest/core/locale/en.yml b/rest/core/locale/en.yml new file mode 100644 index 00000000..9418df77 --- /dev/null +++ b/rest/core/locale/en.yml @@ -0,0 +1,2 @@ +InvalidAction: Invalid action +EmptyQuery: Empty query diff --git a/rest/core/locale/es.json b/rest/core/locale/es.json deleted file mode 100644 index f33bd628..00000000 --- a/rest/core/locale/es.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "InvalidAction": "Acción inválida" - ,"EmptyQuery": "Consulta vacía" - ,"Invalid password": "Contraseña inválida" - ,"Password does not meet requirements": - "La nueva contraseña no reune los requisitos de seguridad necesarios" -} diff --git a/rest/core/locale/es.yml b/rest/core/locale/es.yml new file mode 100644 index 00000000..b795f758 --- /dev/null +++ b/rest/core/locale/es.yml @@ -0,0 +1,2 @@ +InvalidAction: Acción inválida +EmptyQuery: Consulta vacía diff --git a/rest/core/locale/fr.json b/rest/core/locale/fr.json deleted file mode 100644 index a9a18625..00000000 --- a/rest/core/locale/fr.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "InvalidAction": "Action non valide" - - ,"EmptyQuery": "Requête vide" -} diff --git a/rest/core/locale/fr.yml b/rest/core/locale/fr.yml new file mode 100644 index 00000000..d34f2b44 --- /dev/null +++ b/rest/core/locale/fr.yml @@ -0,0 +1,2 @@ +InvalidAction: Action non valide +EmptyQuery: Requête vide diff --git a/rest/core/locale/pt.json b/rest/core/locale/pt.json deleted file mode 100644 index 90823f48..00000000 --- a/rest/core/locale/pt.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "InvalidAction": "Ação Inválida" - - ,"EmptyQuery": "Consulta vazía" -} diff --git a/rest/core/locale/pt.yml b/rest/core/locale/pt.yml new file mode 100644 index 00000000..e1e7d8a5 --- /dev/null +++ b/rest/core/locale/pt.yml @@ -0,0 +1,2 @@ +InvalidAction: Ação Inválida +EmptyQuery: Consulta vazía diff --git a/rest/core/query.php b/rest/core/query.php index fb09ab27..4d398e93 100644 --- a/rest/core/query.php +++ b/rest/core/query.php @@ -22,53 +22,34 @@ class Query extends Vn\Web\JsonRequest { function run($db) { $results = []; + $db->multiQuery($_REQUEST['sql']); - try { - $db->multiQuery($_REQUEST['sql']); + do { + $result = $db->storeResult(); - do { - $result = $db->storeResult(); + if ($result !== FALSE) { + $results[] = $this->transformResult($result); + $result->free(); + } else + $results[] = TRUE; + } + while ($db->moreResults() && $db->nextResult()); - if ($result !== FALSE) { - $results[] = $this->transformResult($result); - $result->free(); - } else - $results[] = TRUE; + if ($db->checkWarnings() + &&($result = $db->query('SHOW WARNINGS'))) { + $sql = 'SELECT `description`, @warn `code` + FROM `message` WHERE `code` = @warn'; + + while ($row = $result->fetch_object()) { + if ($row->Code == 1265 + &&($warning = $db->getObject($sql))) + trigger_error("{$warning->code}: {$warning->description}", E_USER_WARNING); + else + trigger_error("{$row->Code}: {$row->Message}", E_USER_WARNING); } - while ($db->moreResults() && $db->nextResult()); - - // Checks for warnings - - if ($db->checkWarnings() - &&($result = $db->query('SHOW WARNINGS'))) { - $sql = 'SELECT `description`, @warn `code` - FROM `message` WHERE `code` = @warn'; - - while ($row = $result->fetch_object()) { - if ($row->Code == 1265 - &&($warning = $db->getObject($sql))) - trigger_error("{$warning->code}: {$warning->description}", E_USER_WARNING); - else - trigger_error("{$row->Code}: {$row->Message}", E_USER_WARNING); - } - } - - // Checks for errors - - $db->checkError(); - } catch (Vn\Db\Exception $e) { - if ($e->getCode() == 1644) { - $dbMessage = $e->getMessage(); - $sql = 'SELECT `description` FROM `message` WHERE `code` = #'; - $message = $db->getValue($sql, [$dbMessage]); - - if ($message) - throw new Lib\UserException($message, $dbMessage); - } - - throw $e; } + $db->checkError(); return $results; } diff --git a/rest/image/locale/en.json b/rest/image/locale/en.json deleted file mode 100644 index 4ce990a4..00000000 --- a/rest/image/locale/en.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "Cant lock cache": "The cache could not be blocked" - ,"Bad file format": "Unrecognized file format" - ,"File not choosed": "You have not selected any file" - ,"Permission denied": "You are not allowed to upload the file" - ,"File upload error": "Failed to upload the file, check that size is not too large" - ,"File save error": "Failed to save the file: %s" - ,"File size error": "The file must be no longer than %.2f MB" - ,"Bad file name": "The file name must contain only lowercase letters, digits or the '_' character" - ,"Bad collection name": "Invalid collection name" - ,"Collection not exists": "Collection does not exist" - ,"Unreferenced file": "The file is not referenced by the database" - ,"Cannot update matching id": "Cannot update matching id" - ,"Com error": "Error communicating with the server" - ,"Image open error": "Error opening the image file" - ,"Operation disabled": "Operation disabled for security" - ,"Image added": "Image added correctly" - - ,"ErrIniSize": "File exceeds the upload_max_filesize directive in php.ini" - ,"ErrFormSize": "File exceeds the MAX_FILE_SIZE specified in the HTML form" - ,"ErrPartial": "File was partially uploaded" - ,"ErrNoFile": "No file was uploaded" - ,"ErrNoTmpDir": "Missing a temporary folder" - ,"ErrCantWrite": "Failed to write file to disk" - ,"ErrExtension": "File upload stopped by extension" - ,"ErrDefault": "Unknown upload error" - - ,"Sync complete": "Synchronization complete" -} diff --git a/rest/image/locale/en.yml b/rest/image/locale/en.yml new file mode 100644 index 00000000..4a18391e --- /dev/null +++ b/rest/image/locale/en.yml @@ -0,0 +1,27 @@ +Cant lock cache: The cache could not be blocked +Bad file format: Unrecognized file format +File not choosed: You have not selected any file +Permission denied: You are not allowed to upload the file +File upload error: Failed to upload the file, check that size is not too large +File save error: 'Failed to save the file: %s' +File size error: The file must be no longer than %.2f MB +Bad file name: 'The file name must contain only lowercase letters, digits or the ''_'' character' +Bad collection name: Invalid collection name +Collection not exists: Collection does not exist +Unreferenced file: The file is not referenced by the database +Cannot update matching id: Cannot update matching id +Com error: Error communicating with the server +Image open error: Error opening the image file +Operation disabled: Operation disabled for security +Image added: Image added correctly + +ErrIniSize: File exceeds the upload_max_filesize directive in php.ini +ErrFormSize: File exceeds the MAX_FILE_SIZE specified in the HTML form +ErrPartial: File was partially uploaded +ErrNoFile: No file was uploaded +ErrNoTmpDir: Missing a temporary folder +ErrCantWrite: Failed to write file to disk +ErrExtension: File upload stopped by extension +ErrDefault: Unknown upload error + +Sync complete: Synchronization complete diff --git a/rest/image/locale/es.json b/rest/image/locale/es.json deleted file mode 100644 index 181acc65..00000000 --- a/rest/image/locale/es.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "Cant lock cache": "La caché no pudo ser bloqueada" - ,"Bad file format": "Formato de archivo no reconocido" - ,"File not choosed": "No has seleccionado ningún archivo" - ,"Permission denied": "No tienes permiso para subir el fichero" - ,"File upload error": "Error al subir el fichero, comprueba que su tamaño no sea demasiado grande" - ,"File save error": "Error al guardar el fichero: %s" - ,"File size error": "El fichero no debe ocupar más de %.2f MB" - ,"Bad file name": "El nombre del archivo solo debe contener letras minúsculas, dígitos o el carácter '_'" - ,"Bad collection name": "Nombre de colección no válido" - ,"Collection not exists": "La colección no existe" - ,"Unreferenced file": "El archivo no está referenciado por la base de datos" - ,"Cannot update matching id": "No es posible actualizar los ítems con id coincidente" - ,"Com error": "Error en la comunicación con el servidor" - ,"Image open error": "Error al abrir el archivo de imagen" - ,"Operation disabled": "Operación deshabilitada por seguridad" - ,"Image added": "Imagen añadida correctamente" - - ,"ErrIniSize": "File exceeds the upload_max_filesize directive in php.ini" - ,"ErrFormSize": "File exceeds the MAX_FILE_SIZE specified in the HTML form" - ,"ErrPartial": "File was partially uploaded" - ,"ErrNoFile": "No file was uploaded" - ,"ErrNoTmpDir": "Missing a temporary folder" - ,"ErrCantWrite": "Failed to write file to disk" - ,"ErrExtension": "File upload stopped by extension" - ,"ErrDefault": "Unknown upload error" - - ,"Sync complete": "Sincronización completada" -} diff --git a/rest/image/locale/es.yml b/rest/image/locale/es.yml new file mode 100644 index 00000000..54bdcee4 --- /dev/null +++ b/rest/image/locale/es.yml @@ -0,0 +1,27 @@ +Cant lock cache: La caché no pudo ser bloqueada +Bad file format: Formato de archivo no reconocido +File not choosed: No has seleccionado ningún archivo +Permission denied: No tienes permiso para subir el fichero +File upload error: Error al subir el fichero, comprueba que su tamaño no sea demasiado grande +File save error: 'Error al guardar el fichero: %s' +File size error: El fichero no debe ocupar más de %.2f MB +Bad file name: 'El nombre del archivo solo debe contener letras minúsculas, dígitos o el carácter ''_''' +Bad collection name: Nombre de colección no válido +Collection not exists: La colección no existe +Unreferenced file: El archivo no está referenciado por la base de datos +Cannot update matching id: No es posible actualizar los ítems con id coincidente +Com error: Error en la comunicación con el servidor +Image open error: Error al abrir el archivo de imagen +Operation disabled: Operación deshabilitada por seguridad +Image added: Imagen añadida correctamente + +ErrIniSize: File exceeds the upload_max_filesize directive in php.ini +ErrFormSize: File exceeds the MAX_FILE_SIZE specified in the HTML form +ErrPartial: File was partially uploaded +ErrNoFile: No file was uploaded +ErrNoTmpDir: Missing a temporary folder +ErrCantWrite: Failed to write file to disk +ErrExtension: File upload stopped by extension +ErrDefault: Unknown upload error + +Sync complete: Sincronización completada diff --git a/rest/image/locale/pt.json b/rest/image/locale/pt.json deleted file mode 100644 index 52f2936c..00000000 --- a/rest/image/locale/pt.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "Cant lock cache": "O cache não pôde ser bloqueado" - ,"Bad file format": "Formato de arquivo inválido" - ,"File not choosed": "Não selecionastes nenhum arquivo" - ,"Permission denied": "Não estas autorizado a subir o arquivo" - ,"File upload error": "Erro ao subir o arquivo, verifique o tamanho" - ,"File save error": "Erro ao salvar o arquivo: %s" - ,"File size error": "O arquivo não deve ser maior que: %.2f MB" - ,"Bad file name": "O nome do arquivo deve conter somente letras minusculas, numeros ou '_' " - ,"Bad collection name": "Nome de coleção inválido" - ,"Collection not exists": "Coleção não existe" - ,"Unreferenced file": "O arquivo não é referenciado pelo banco de dados" - ,"Cannot update matching id": "Não é possível atualizar os itens com id coincidente" - ,"Com error": "Erro de comunicação com o servidor" - ,"Image open error": "Erro ao abrir a imagem" - ,"Operation disabled": "Operação desativada por segurança" - ,"Image added": "Imagem adicionada corretamente" - - ,"ErrIniSize": "Arquivo supera o tamanho maximo de protocolo em php.ini" - ,"ErrFormSize": "Arquivo supera o tamanho maximo de protocolo em HTML form" - ,"ErrPartial": "Arquivo subido parcialmente" - ,"ErrNoFile": "Nenhum arquivo subido" - ,"ErrNoTmpDir": "Falta a pasta de arquivo temporal" - ,"ErrCantWrite": "Erro ao gravar arquivo no disco" - ,"ErrExtension": "Erro de extensão do arquivo" - ,"ErrDefault": "Erro desconhecido ao subir arquivo" - - ,"Sync complete": "Sincronização completa" -} diff --git a/rest/image/locale/pt.yml b/rest/image/locale/pt.yml new file mode 100644 index 00000000..a4986bf0 --- /dev/null +++ b/rest/image/locale/pt.yml @@ -0,0 +1,27 @@ +Cant lock cache: O cache não pôde ser bloqueado +Bad file format: Formato de arquivo inválido +File not choosed: Não selecionastes nenhum arquivo +Permission denied: Não estas autorizado a subir o arquivo +File upload error: Erro ao subir o arquivo, verifique o tamanho +File save error: 'Erro ao salvar o arquivo: %s' +File size error: O arquivo não deve ser maior que %.2f MB +Bad file name: 'O nome do arquivo deve conter somente letras minusculas, numeros ou ''_''' +Bad collection name: Nome de coleção inválido +Collection not exists: Coleção não existe +Unreferenced file: O arquivo não é referenciado pelo banco de dados +Cannot update matching id: Não é possível atualizar os itens com id coincidente +Com error: Erro de comunicação com o servidor +Image open error: Erro ao abrir a imagem +Operation disabled: Operação desativada por segurança +Image added: Imagem adicionada corretamente + +ErrIniSize: Arquivo supera o tamanho maximo de protocolo em php.ini +ErrFormSize: Arquivo supera o tamanho maximo de protocolo em HTML form +ErrPartial: Arquivo subido parcialmente +ErrNoFile: Nenhum arquivo subido +ErrNoTmpDir: Falta a pasta de arquivo temporal +ErrCantWrite: Erro ao gravar arquivo no disco +ErrExtension: Erro de extensão do arquivo +ErrDefault: Erro desconhecido ao subir arquivo + +Sync complete: Sincronização completa diff --git a/rest/misc/locale/es.json b/rest/misc/locale/es.json deleted file mode 100644 index c6fa7ca3..00000000 --- a/rest/misc/locale/es.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "An automated message could not be delivered": "Un mensaje automatizado no se ha podido entregar" - ,"Notification from IT department about problem.": "Desde el departamento de informática te enviamos este correo porque ha habido un problema al intentar entregar un correo automatizado." - ,"If you have questions, resend this email to cau@verdnatura.es.": "Si tienes dudas, reenvia este correo a cau@verdnatura.es." - ,"The response from the remote server was:": "La respuesta del servidor remoto ha sido:" -} \ No newline at end of file diff --git a/rest/misc/locale/es.yml b/rest/misc/locale/es.yml new file mode 100644 index 00000000..6e5a631e --- /dev/null +++ b/rest/misc/locale/es.yml @@ -0,0 +1,4 @@ +automatedMessageNotDelivered: Un mensaje automatizado no se ha podido entregar +ITProblemNotification: Desde el departamento de informática te enviamos este correo porque ha habido un problema al intentar entregar un correo automatizado. +ifQuestionsResendEmailToIT: Si tienes dudas, reenvia este correo a cau@verdnatura.es. +'The response from the remote server was:': 'La respuesta del servidor remoto ha sido:' diff --git a/rest/misc/mail.php b/rest/misc/mail.php index 6e075932..a2955200 100644 --- a/rest/misc/mail.php +++ b/rest/misc/mail.php @@ -48,13 +48,13 @@ class Mail extends Vn\Lib\Method { if ($row->replyTo) { Vn\Lib\Locale::set('es'); $errorMsg = - '

'. s('Notification from IT department about problem.') .'

' - .'

'. s('If you have questions, resend this email to cau@verdnatura.es.') .'

' + '

'. s('ITProblemNotification') .'

' + .'

'. s('ifQuestionsResendEmailToIT') .'

' .'

'. $status .'

'; $errorMail = $mailer->createObject($row->replyTo, $errorMsg, - s('An automated message could not be delivered') + s('automatedMessageNotDelivered') ); $errorMail->AddStringAttachment( $mail->getSentMIMEMessage(), diff --git a/rest/tpv/confirm-mail.php b/rest/tpv/confirm-mail.php deleted file mode 100644 index 719bfed1..00000000 --- a/rest/tpv/confirm-mail.php +++ /dev/null @@ -1,98 +0,0 @@ -getObject( - 'SELECT host, user, pass, cleanPeriod, successFolder, errorFolder - FROM tpvImapConfig' - ); - - $mailbox = sprintf('{%s/imap/ssl/novalidate-cert}', - $imapConf->host); - - $imap = imap_open($mailbox - ,$imapConf->user - ,base64_decode($imapConf->pass) - ); - - if (!$imap) - throw new Exception(imap_last_error()); - - // Fetchs and confirms new transaction mails - - $count = 0; - $inbox = imap_search($imap, 'ALL'); - - if ($inbox) - foreach ($inbox as $msg) { - // Decodes the mail body - - $params = []; - $body = imap_fetchbody($imap, $msg, '1'); - $strings = explode(';', $body); - - foreach ($strings as $string) { - $x = explode(':', $string); - $params[trim($x[0])] = trim($x[1]); - } - - // Confirms the transaction - - $success = FALSE; - - try { - $success = Tpv::confirm($db, $params); - } catch (\Exception $e) { - trigger_error($e->getMessage(), E_USER_WARNING); - } - - // Moves the processed mail to another folder - - if ($success) - $folder = $imapConf->successFolder; - else - $folder = $imapConf->errorFolder; - - if (!imap_mail_move($imap, $msg, "$folder")) - trigger_error(imap_last_error(), E_USER_WARNING); - - $count++; - } - - imap_expunge($imap); - - // Cleans the old mails - - $deleted = 0; - - if (rand(1, 20) == 1) { - $folders = array( - $imapConf->successFolder - ,$imapConf->errorFolder - ); - - $date = new \DateTime(NULL); - $date->sub(new \DateInterval($imapConf->cleanPeriod)); - $filter = sprintf('BEFORE "%s"', $date->format('D, j M Y')); - - foreach ($folders as $folder) - if (imap_reopen($imap, $mailbox.$folder)) - if ($messages = imap_search($imap, $filter)) { - foreach ($messages as $message) - imap_delete($imap, $message); - - imap_expunge($imap); - $deleted += count($messages); - } - } - - echo "$count mails processed, $deleted mails deleted.\n"; - } -} - diff --git a/rest/tpv/confirm-post.php b/rest/tpv/confirm-post.php deleted file mode 100644 index 20d3cb79..00000000 --- a/rest/tpv/confirm-post.php +++ /dev/null @@ -1,13 +0,0 @@ -addFunction('procesaNotificacionSIS'); - $server->handle(); - } -} - -function procesaNotificacionSIS($XML) { - global $tpvConfirmSoap; - - $db = $tpvConfirmSoap->app->getSysConn(); - - $status = 'OK'; - $requestString = $XML; - - // Processes the request - - try { - $xml = new SimpleXMLElement($requestString); - $params =(array) $xml->{'Request'}; - - if (!(isset($params['Ds_Amount']) - && isset($params['Ds_Order']) - && isset($params['Ds_MerchantCode']) - && isset($params['Ds_Currency']) - && isset($params['Ds_Response']))) - throw new Exception('Missing required parameters'); - - // Checks the signature - - $start = strpos($requestString, ''); - $shaString = substr($requestString, $start, $end - $start + 10); - - $key = $db->getValue( - 'SELECT secretKey FROM tpvMerchant WHERE id = #' - ,[$params['Ds_MerchantCode']] - ); - - if (sha1($shaString.$key) != $xml->{'Signature'}) - throw new Exception('Invalid signature'); - - // Confirms the transaction - - Tpv::confirm($db, $params); - } catch (Exception $e) { - $status = 'KO'; - } - - // Generates the response - - $responseString = file_get_contents(__DIR__ .'/soap-reply.xml'); - $xml = new SimpleXMLElement($responseString); - - $response = $xml->{'Response'}; - $response->{'Ds_Response_Merchant'} = $status; - - $xml->{'Signature'} = sha1($response->asXML().$key); - - return $xml->asXML(); -/* - // Another way to generate the response - - $xmlResponse = - ' - '. $status .' - '; - - $xmlMessage = - ' - '. $xmlResponse .' - '. sha1($xmlResponse.$key) .' - '; - - return $xmlMessage; -*/} - diff --git a/rest/tpv/soap-reply.xml b/rest/tpv/soap-reply.xml deleted file mode 100644 index c1d454ba..00000000 --- a/rest/tpv/soap-reply.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/rest/tpv/soap-request.dtd b/rest/tpv/soap-request.dtd deleted file mode 100644 index eb73a981..00000000 --- a/rest/tpv/soap-request.dtd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rest/tpv/soap-request.xml b/rest/tpv/soap-request.xml deleted file mode 100644 index 25d594db..00000000 --- a/rest/tpv/soap-request.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - 21/10/2014 - 17:56 - 1 - D - 724 - 1 - 978 - 000000007216 - 329744999 - 001 - 0000 - - 0 - 1 - 563451 - - b97d1aba50aac5efc0915f59a70e24fc94cb3ffe - diff --git a/rest/tpv/soap-test.php b/rest/tpv/soap-test.php deleted file mode 100644 index 5a6bef44..00000000 --- a/rest/tpv/soap-test.php +++ /dev/null @@ -1,56 +0,0 @@ -__soapCall('procesaNotificacionSIS', [ - 'XML' => $requestString - ]); - - $xml = new SimpleXMLElement($result); - - $key = $_POST['key']; - - $start = strpos($result, ''); - $shaString = substr($result, $start, $end - $start + 11); - $shaHash = sha1($shaString.$key); - - $isValid = $xml->{'Signature'} == $shaHash; -} else { - $key = ''; - $result = ''; - $shaHash = ''; - $isValid = FALSE; -} - -?> - - - - - TPV SOAP Client - - - -
- - - -
-

Response

-

-

-

-

Signature

-

- Calculated: -

-

- Valid: /> -

- - diff --git a/rest/tpv/soap.wsdl b/rest/tpv/soap.wsdl deleted file mode 100644 index bd85821d..00000000 --- a/rest/tpv/soap.wsdl +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rest/tpv/tpv.php b/rest/tpv/tpv.php deleted file mode 100644 index 3ae34f04..00000000 --- a/rest/tpv/tpv.php +++ /dev/null @@ -1,33 +0,0 @@ -query( - 'CALL tpvTransaction_confirm(#, #, #, #, #, #)', - [ - $params['Ds_Amount'] - ,$params['Ds_Order'] - ,$params['Ds_MerchantCode'] - ,$params['Ds_Currency'] - ,$params['Ds_Response'] - ,$error - ] - ); - } -} - diff --git a/rest/tpv/transaction.php b/rest/tpv/transaction.php deleted file mode 100644 index da465c90..00000000 --- a/rest/tpv/transaction.php +++ /dev/null @@ -1,67 +0,0 @@ -getObject('CALL myTpvTransaction_start(#, #)', - [$amount, $companyId]); - - if (!isset($row)) - throw new Exception('Transaction error'); - - $transactionId = str_pad($row->transactionId, 12, '0', STR_PAD_LEFT); - $merchantUrl = $row->merchantUrl ? $row->merchantUrl : ''; - $urlOk = empty($_REQUEST['urlOk']) ? '' : - str_replace('_transactionId_', $transactionId, $_REQUEST['urlOk']); - $urlKo = empty($_REQUEST['urlKo']) ? '' : - str_replace('_transactionId_', $transactionId, $_REQUEST['urlKo']); - - $params = [ - 'Ds_Merchant_Amount' => $amount - ,'Ds_Merchant_Order' => $transactionId - ,'Ds_Merchant_MerchantCode' => $row->merchant - ,'Ds_Merchant_Currency' => $row->currency - ,'Ds_Merchant_TransactionType' => $row->transactionType - ,'Ds_Merchant_Terminal' => $row->terminal - ,'Ds_Merchant_MerchantURL' => $merchantUrl - ,'Ds_Merchant_UrlOK' => $urlOk - ,'Ds_Merchant_UrlKO' => $urlKo - ]; - - $encodedParams = base64_encode(json_encode($params)); - - $key = base64_decode($row->secretKey); - - $bytes = [0, 0, 0, 0, 0, 0, 0, 0]; - $iv = implode(array_map('chr', $bytes)); - - $paddedData = $transactionId; - if (strlen($paddedData) % 8) { - $paddedData = str_pad($paddedData, - strlen($paddedData) + 8 - strlen($paddedData) % 8, "\0"); - } - - $encryptedData = openssl_encrypt($paddedData, - 'des-ede3-cbc', $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING , $iv); - $signature = base64_encode(hash_hmac('sha256', $encodedParams, $encryptedData, TRUE)); - - $url = $row->url; - $postValues = [ - 'Ds_SignatureVersion' => 'HMAC_SHA256_V1' - ,'Ds_MerchantParameters' => $encodedParams - ,'Ds_Signature' => $signature - ]; - - return [ - 'url' => $url - ,'postValues' => $postValues - ]; - } -} diff --git a/web/rest-service.php b/web/rest-service.php index aa32e1cb..dac5ca9e 100644 --- a/web/rest-service.php +++ b/web/rest-service.php @@ -50,9 +50,18 @@ class RestService extends Service { try { $res = $method->run($methodDb); - } catch (Db\Exception $e) { - if ($e->getCode() == 1644) - throw new UserException(s($e->getMessage())); + } catch (\Vn\Db\Exception $e) { + if ($e->getCode() == 1644) { + $eMessage = $e->getMessage(); + $tMessage = $db->getValue( + 'SELECT `description` FROM `message` WHERE `code` = #', + [$eMessage] + ); + if (!$tMessage) $tMessage = $eMessage; + throw new Lib\UserException($tMessage, $eMessage); + } + + throw $e; } if ($method::SECURITY == Security::DEFINER) diff --git a/web/unavailable.html b/web/unavailable.html index 47efb70e..325f7f19 100644 --- a/web/unavailable.html +++ b/web/unavailable.html @@ -3,6 +3,7 @@ + Not available - Verdnatura