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..f4f50393 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (22.48.5) stable; urgency=low +hedera-web (22.48.6) 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/forms/account/conf/index.js b/forms/account/conf/index.js index 1cd8855a..ee0f4d48 100644 --- a/forms/account/conf/index.js +++ b/forms/account/conf/index.js @@ -32,15 +32,18 @@ export default new Class({ 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')); + 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); + } var verificationToken = this.hash.$.verificationToken; var params = {newPassword}; - let err; try { if (verificationToken) { params.verificationToken = verificationToken; @@ -51,8 +54,7 @@ export default new Class({ await this.conn.patch( `Accounts/${userId}/changePassword`, params); } - } catch(e) { - err = e; + } catch(err) { Htk.Toast.showError(err.message); if (this.hash.$.verificationToken) @@ -65,8 +67,8 @@ export default new Class({ this.$.changePassword.hide(); this.hash.unset('verificationToken'); + await this.conn.open(this.gui.user.name, newPassword); Htk.Toast.showMessage(_('Password changed!')); - this.$.userForm.refresh(); } ,onPassInfoClick() { diff --git a/forms/ecomerce/confirm/index.js b/forms/ecomerce/confirm/index.js index db1e9f78..918112a6 100644 --- a/forms/ecomerce/confirm/index.js +++ b/forms/ecomerce/confirm/index.js @@ -106,25 +106,23 @@ export default new Class({ Vn.Node.addClass(this.$[id], 'selected'); }, - disableButtons(disable) { - this.$.modify.disabled = disable; - this.$.confirm.disabled = disable; - }, - onModifyClick() { window.history.back(); }, async onConfirmClick() { this.disableButtons(true); - await this.$.confirmQuery.execute(); - }, - - onConfirm(query, resultSet) { - this.disableButtons(false); - - if (resultSet.fetchResult()) + try { + await this.conn.execQuery('CALL myBasket_confirm'); this.$.successDialog.show(); + } finally { + this.disableButtons(false); + } + }, + + disableButtons(disable) { + this.$.modify.disabled = disable; + this.$.confirm.disabled = disable; }, async onDialogResponse() { diff --git a/forms/ecomerce/confirm/ui.xml b/forms/ecomerce/confirm/ui.xml index c9deba20..8e31ea3f 100644 --- a/forms/ecomerce/confirm/ui.xml +++ b/forms/ecomerce/confirm/ui.xml @@ -23,9 +23,6 @@ tmp.orderTax; - - CALL myBasket_confirm -

Order summary

diff --git a/js/hedera/app.js b/js/hedera/app.js index 6e7ba1c2..290fca02 100644 --- a/js/hedera/app.js +++ b/js/hedera/app.js @@ -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/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/package.json b/package.json index 11df0f03..759c3369 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "22.48.5", + "version": "22.48.6", "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/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