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;
-
- =s('Press on the following link to change your password.')?> + =s('pressLinkToRecoverPassword')?>
- =s('Recover password')?> + =s('recoverPassword')?> 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 @@ +