From d8a87a6e992183a1ff1d041215c97522a2cf0671 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 19 Sep 2016 08:40:18 +0200 Subject: [PATCH] Backup --- forms/account/address-list/ui.xml | 7 +- forms/account/address/ui.xml | 14 ++- forms/account/conf/conf.js | 2 +- forms/account/conf/ui.xml | 7 +- forms/admin/connections/ui.xml | 11 +-- forms/admin/items/ui.xml | 11 ++- forms/admin/queries/ui.xml | 14 ++- forms/admin/shelves/shelves.js | 1 + forms/admin/shelves/style.css | 13 --- forms/admin/shelves/ui.xml | 15 ++- forms/admin/visits/ui.xml | 14 ++- forms/agencies/packages/ui.xml | 2 +- forms/cms/home/ui.xml | 7 +- forms/ecomerce/basket/ui.xml | 23 ++--- forms/ecomerce/catalog/ui.xml | 17 ++-- forms/ecomerce/checkout/ui.xml | 7 +- forms/ecomerce/orders/ui.xml | 8 +- forms/ecomerce/ticket/ui.xml | 7 +- forms/news/new/ui.xml | 14 ++- forms/news/news/ui.xml | 11 +-- image/banner.svg | 54 +++++------ image/{ => icon}/dark/add.svg | 0 image/{ => icon}/dark/basket.svg | 0 image/{ => icon}/dark/close.svg | 0 image/{ => icon}/dark/connect.svg | 0 image/{ => icon}/dark/delete.svg | 0 image/{ => icon}/dark/exit.svg | 0 image/{ => icon}/dark/go-next.svg | 0 image/{ => icon}/dark/go-previous.svg | 0 image/{ => icon}/dark/graph.svg | 0 image/{ => icon}/dark/info.svg | 0 image/{ => icon}/dark/logo.png | Bin image/{ => icon}/dark/logo.svg | 0 image/{ => icon}/dark/menu.svg | 0 image/{ => icon}/dark/new-order.svg | 0 image/{ => icon}/dark/ok.svg | 0 image/{ => icon}/dark/pay.svg | 0 image/{ => icon}/dark/place.svg | 0 image/{ => icon}/dark/preferences.svg | 0 image/{ => icon}/dark/print.svg | 0 image/{ => icon}/dark/refresh.svg | 0 image/{ => icon}/dark/search.svg | 0 image/{ => icon}/dark/shipping.svg | 0 image/{ => icon}/dark/user-info.svg | 0 image/{ => icon}/dark/view-dual.svg | 0 image/{ => icon}/dark/view-grid.svg | 0 image/{ => icon}/dark/view-list.svg | 0 image/{ => icon}/dark/view.svg | 0 image/{ => icon/light}/access-log.svg | 0 image/{ => icon/light}/add-photo.svg | 0 image/{ => icon/light}/add.svg | 0 image/{ => icon/light}/basket.svg | 0 image/{ => icon/light}/clean.svg | 0 image/{ => icon/light}/close.svg | 0 image/{ => icon/light}/delete.svg | 0 image/{ => icon/light}/download.svg | 0 image/{ => icon/light}/edit.svg | 0 image/{ => icon/light}/error.svg | 0 image/{ => icon/light}/exit.svg | 0 image/{ => icon/light}/gnome.svg | 0 image/{ => icon/light}/go-next.svg | 0 image/{ => icon/light}/go-previous.svg | 0 image/{ => icon/light}/incognito.svg | 0 image/{ => icon/light}/info.svg | 0 image/{ => icon/light}/invisible.png | Bin image/{ => icon/light}/menu.svg | 0 image/{ => icon/light}/new-order.svg | 0 image/{ => icon/light}/ok.svg | 0 image/{ => icon/light}/pay.svg | 0 image/{ => icon/light}/place.svg | 0 image/{ => icon/light}/preferences.svg | 0 image/{ => icon/light}/print.svg | 0 image/{ => icon/light}/refresh.svg | 0 image/{ => icon/light}/search.svg | 0 image/{ => icon/light}/shipping.svg | 0 image/{ => icon/light}/show.svg | 0 image/{ => icon/light}/supplant.svg | 0 image/{ => icon/light}/unavailable.svg | 0 image/{ => icon/light}/unknown.svg | 0 image/{ => icon/light}/warning.svg | 0 js/hedera/gui.css | 8 +- js/hedera/login.css | 25 +++-- js/hedera/login.js | 22 ++++- js/hedera/login.xml | 4 +- js/htk/field/bar-button.js | 19 ++++ js/htk/field/button.js | 9 ++ js/htk/main.js | 1 + pages/tpv/html.php | 2 +- pages/update-browser/html.php | 4 +- .../update-browser}/update-browser.png | Bin pages/version-menu/html.php | 6 +- reports/shelves-report/shelves-report.js | 30 +++++- rest/core/login.php | 2 +- rest/core/query.php | 4 +- rest/core/recover-password.php | 2 +- rest/misc/contact.php | 3 +- rest/misc/mail.php | 6 +- vn/web/app.php | 49 ++++------ vn/web/db-session-handler.php | 57 +++++++++++ vn/web/html-service.php | 2 +- vn/web/jwt.php | 90 ++++++++++++++++++ vn/web/service.php | 26 ++--- 102 files changed, 403 insertions(+), 227 deletions(-) rename image/{ => icon}/dark/add.svg (100%) rename image/{ => icon}/dark/basket.svg (100%) rename image/{ => icon}/dark/close.svg (100%) rename image/{ => icon}/dark/connect.svg (100%) rename image/{ => icon}/dark/delete.svg (100%) rename image/{ => icon}/dark/exit.svg (100%) rename image/{ => icon}/dark/go-next.svg (100%) rename image/{ => icon}/dark/go-previous.svg (100%) rename image/{ => icon}/dark/graph.svg (100%) rename image/{ => icon}/dark/info.svg (100%) rename image/{ => icon}/dark/logo.png (100%) rename image/{ => icon}/dark/logo.svg (100%) rename image/{ => icon}/dark/menu.svg (100%) rename image/{ => icon}/dark/new-order.svg (100%) rename image/{ => icon}/dark/ok.svg (100%) rename image/{ => icon}/dark/pay.svg (100%) rename image/{ => icon}/dark/place.svg (100%) rename image/{ => icon}/dark/preferences.svg (100%) rename image/{ => icon}/dark/print.svg (100%) rename image/{ => icon}/dark/refresh.svg (100%) rename image/{ => icon}/dark/search.svg (100%) rename image/{ => icon}/dark/shipping.svg (100%) rename image/{ => icon}/dark/user-info.svg (100%) rename image/{ => icon}/dark/view-dual.svg (100%) rename image/{ => icon}/dark/view-grid.svg (100%) rename image/{ => icon}/dark/view-list.svg (100%) rename image/{ => icon}/dark/view.svg (100%) rename image/{ => icon/light}/access-log.svg (100%) rename image/{ => icon/light}/add-photo.svg (100%) rename image/{ => icon/light}/add.svg (100%) rename image/{ => icon/light}/basket.svg (100%) rename image/{ => icon/light}/clean.svg (100%) rename image/{ => icon/light}/close.svg (100%) rename image/{ => icon/light}/delete.svg (100%) rename image/{ => icon/light}/download.svg (100%) rename image/{ => icon/light}/edit.svg (100%) rename image/{ => icon/light}/error.svg (100%) rename image/{ => icon/light}/exit.svg (100%) rename image/{ => icon/light}/gnome.svg (100%) rename image/{ => icon/light}/go-next.svg (100%) rename image/{ => icon/light}/go-previous.svg (100%) rename image/{ => icon/light}/incognito.svg (100%) rename image/{ => icon/light}/info.svg (100%) rename image/{ => icon/light}/invisible.png (100%) rename image/{ => icon/light}/menu.svg (100%) rename image/{ => icon/light}/new-order.svg (100%) rename image/{ => icon/light}/ok.svg (100%) rename image/{ => icon/light}/pay.svg (100%) rename image/{ => icon/light}/place.svg (100%) rename image/{ => icon/light}/preferences.svg (100%) rename image/{ => icon/light}/print.svg (100%) rename image/{ => icon/light}/refresh.svg (100%) rename image/{ => icon/light}/search.svg (100%) rename image/{ => icon/light}/shipping.svg (100%) rename image/{ => icon/light}/show.svg (100%) rename image/{ => icon/light}/supplant.svg (100%) rename image/{ => icon/light}/unavailable.svg (100%) rename image/{ => icon/light}/unknown.svg (100%) rename image/{ => icon/light}/warning.svg (100%) create mode 100644 js/htk/field/bar-button.js rename {image => pages/update-browser}/update-browser.png (100%) create mode 100755 vn/web/db-session-handler.php create mode 100755 vn/web/jwt.php diff --git a/forms/account/address-list/ui.xml b/forms/account/address-list/ui.xml index 1fed18e4..4bba3fdc 100755 --- a/forms/account/address-list/ui.xml +++ b/forms/account/address-list/ui.xml @@ -23,11 +23,10 @@

Addresses

- + on-click="onAddAddressClick"/>
diff --git a/forms/account/address/ui.xml b/forms/account/address/ui.xml index c8a7f77d..750f37fe 100755 --- a/forms/account/address/ui.xml +++ b/forms/account/address/ui.xml @@ -28,16 +28,14 @@

AddEditAddress

- - + + on-click="onReturnClick"/>
diff --git a/forms/account/conf/conf.js b/forms/account/conf/conf.js index 440f12f3..866563e3 100644 --- a/forms/account/conf/conf.js +++ b/forms/account/conf/conf.js @@ -22,7 +22,7 @@ Vn.Conf = new Class var batch = new Sql.Batch (); batch.addValue ('password', newPassword); - var query = 'UPDATE user_view SET password = MD5(#password) ' + var query = 'UPDATE user_view SET password = SHA2(#password, 256) ' +'WHERE id = account.user_get_id () LIMIT 1'; this.conn.execQuery (query, this.onPasswordUpdate.bind (this), batch); diff --git a/forms/account/conf/ui.xml b/forms/account/conf/ui.xml index 6473c5ce..c2b68d7a 100755 --- a/forms/account/conf/ui.xml +++ b/forms/account/conf/ui.xml @@ -24,11 +24,10 @@

Configuration

- + on-click="onAddressesClick"/>
diff --git a/forms/admin/connections/ui.xml b/forms/admin/connections/ui.xml index e6d2a079..38a93ea6 100755 --- a/forms/admin/connections/ui.xml +++ b/forms/admin/connections/ui.xml @@ -3,11 +3,10 @@

Connections

- + on-click="onRefreshClick"/>

diff --git a/forms/admin/items/ui.xml b/forms/admin/items/ui.xml index 65f97fbb..07fc6174 100755 --- a/forms/admin/items/ui.xml +++ b/forms/admin/items/ui.xml @@ -2,6 +2,12 @@

Item list

+
+ +
@@ -38,11 +44,6 @@
-
diff --git a/forms/admin/queries/ui.xml b/forms/admin/queries/ui.xml index a944946f..6d1b6745 100755 --- a/forms/admin/queries/ui.xml +++ b/forms/admin/queries/ui.xml @@ -3,16 +3,14 @@

Queries

- - + + on-click="_onCleanClick"/>
diff --git a/forms/admin/shelves/shelves.js b/forms/admin/shelves/shelves.js index 0d97dfc2..d2c0d050 100644 --- a/forms/admin/shelves/shelves.js +++ b/forms/admin/shelves/shelves.js @@ -35,6 +35,7 @@ Vn.Shelves = new Class 'max-amount': this.$('max-amount').value, 'show-packing': this.$('show-packing').value, 'stack': this.$('stack').value, + 'use-ids': this.$('use-ids').value, }); this.gui.openReport ('shelves-report', batch); } diff --git a/forms/admin/shelves/style.css b/forms/admin/shelves/style.css index c97b766f..0be2e7cf 100644 --- a/forms/admin/shelves/style.css +++ b/forms/admin/shelves/style.css @@ -28,16 +28,3 @@ margin: 0; width: 100%; } - -/* Footer */ - -.shelves .footer -{ - text-align: center; - margin-top: 1.5em; -} -.shelves .footer > button -{ - margin: 0 .2em; -} - diff --git a/forms/admin/shelves/ui.xml b/forms/admin/shelves/ui.xml index 9b7dae07..d67ea7d2 100755 --- a/forms/admin/shelves/ui.xml +++ b/forms/admin/shelves/ui.xml @@ -12,6 +12,12 @@

Shelves

+
+ +
@@ -96,11 +102,10 @@
-
-
diff --git a/forms/admin/visits/ui.xml b/forms/admin/visits/ui.xml index 354aa783..44e14977 100755 --- a/forms/admin/visits/ui.xml +++ b/forms/admin/visits/ui.xml @@ -3,16 +3,14 @@

Visits

- - + + on-click="onSessionsClick"/>
diff --git a/forms/agencies/packages/ui.xml b/forms/agencies/packages/ui.xml index fea7f9c6..e41ede06 100755 --- a/forms/agencies/packages/ui.xml +++ b/forms/agencies/packages/ui.xml @@ -12,7 +12,7 @@ diff --git a/forms/cms/home/ui.xml b/forms/cms/home/ui.xml index 5a4d463a..5c9f1e56 100755 --- a/forms/cms/home/ui.xml +++ b/forms/cms/home/ui.xml @@ -3,12 +3,11 @@

Home

- + on-click="onStartOrderClick"/>
diff --git a/forms/ecomerce/basket/ui.xml b/forms/ecomerce/basket/ui.xml index 7fba5f82..5975f8e2 100755 --- a/forms/ecomerce/basket/ui.xml +++ b/forms/ecomerce/basket/ui.xml @@ -3,21 +3,18 @@

ShoppingBasket

- - + - + + on-click="onConfigureClick"/>
@@ -47,7 +44,7 @@ column="ticket_id" class="delete" tip="_Remove" - image="image/delete.svg" + icon="delete" on-click="onDeleteClick"/>
- - + + on-click="onSwitchViewClick"/>
@@ -162,7 +159,7 @@ form="item" column="id" tip="_AddToBasket" - image="image/add.svg" + icon="add" on-click="onAddItemClick" class="add-button"/>

diff --git a/forms/ecomerce/checkout/ui.xml b/forms/ecomerce/checkout/ui.xml index 34704a90..96bebaca 100755 --- a/forms/ecomerce/checkout/ui.xml +++ b/forms/ecomerce/checkout/ui.xml @@ -64,11 +64,10 @@

ConfigureOrder

- + on-click="onCancelClick"/>
diff --git a/forms/ecomerce/orders/ui.xml b/forms/ecomerce/orders/ui.xml index 0131bd17..d3fb343a 100755 --- a/forms/ecomerce/orders/ui.xml +++ b/forms/ecomerce/orders/ui.xml @@ -12,13 +12,13 @@

LastOrders

- -
diff --git a/forms/ecomerce/ticket/ui.xml b/forms/ecomerce/ticket/ui.xml index a3e3fe35..78ce6d03 100755 --- a/forms/ecomerce/ticket/ui.xml +++ b/forms/ecomerce/ticket/ui.xml @@ -25,11 +25,10 @@

OrderDetail

- + on-click="onPrintClick"/>
diff --git a/forms/news/new/ui.xml b/forms/news/new/ui.xml index 3df63967..e4a35a18 100755 --- a/forms/news/new/ui.xml +++ b/forms/news/new/ui.xml @@ -25,16 +25,14 @@

AddEditNew

- - + + on-click="onReturnClick"/>
diff --git a/forms/news/news/ui.xml b/forms/news/news/ui.xml index 71b82f85..8724e636 100755 --- a/forms/news/news/ui.xml +++ b/forms/news/news/ui.xml @@ -3,11 +3,10 @@

NewsManagement

- + on-click="onAddClick"/>
@@ -26,13 +25,13 @@ form="iter" column="id" tip="_EditNew" - image="image/edit.svg" + icon="edit" on-click="onEditClick"/> \ No newline at end of file + style="fill:#a9d42d" /> \ No newline at end of file diff --git a/image/dark/add.svg b/image/icon/dark/add.svg similarity index 100% rename from image/dark/add.svg rename to image/icon/dark/add.svg diff --git a/image/dark/basket.svg b/image/icon/dark/basket.svg similarity index 100% rename from image/dark/basket.svg rename to image/icon/dark/basket.svg diff --git a/image/dark/close.svg b/image/icon/dark/close.svg similarity index 100% rename from image/dark/close.svg rename to image/icon/dark/close.svg diff --git a/image/dark/connect.svg b/image/icon/dark/connect.svg similarity index 100% rename from image/dark/connect.svg rename to image/icon/dark/connect.svg diff --git a/image/dark/delete.svg b/image/icon/dark/delete.svg similarity index 100% rename from image/dark/delete.svg rename to image/icon/dark/delete.svg diff --git a/image/dark/exit.svg b/image/icon/dark/exit.svg similarity index 100% rename from image/dark/exit.svg rename to image/icon/dark/exit.svg diff --git a/image/dark/go-next.svg b/image/icon/dark/go-next.svg similarity index 100% rename from image/dark/go-next.svg rename to image/icon/dark/go-next.svg diff --git a/image/dark/go-previous.svg b/image/icon/dark/go-previous.svg similarity index 100% rename from image/dark/go-previous.svg rename to image/icon/dark/go-previous.svg diff --git a/image/dark/graph.svg b/image/icon/dark/graph.svg similarity index 100% rename from image/dark/graph.svg rename to image/icon/dark/graph.svg diff --git a/image/dark/info.svg b/image/icon/dark/info.svg similarity index 100% rename from image/dark/info.svg rename to image/icon/dark/info.svg diff --git a/image/dark/logo.png b/image/icon/dark/logo.png similarity index 100% rename from image/dark/logo.png rename to image/icon/dark/logo.png diff --git a/image/dark/logo.svg b/image/icon/dark/logo.svg similarity index 100% rename from image/dark/logo.svg rename to image/icon/dark/logo.svg diff --git a/image/dark/menu.svg b/image/icon/dark/menu.svg similarity index 100% rename from image/dark/menu.svg rename to image/icon/dark/menu.svg diff --git a/image/dark/new-order.svg b/image/icon/dark/new-order.svg similarity index 100% rename from image/dark/new-order.svg rename to image/icon/dark/new-order.svg diff --git a/image/dark/ok.svg b/image/icon/dark/ok.svg similarity index 100% rename from image/dark/ok.svg rename to image/icon/dark/ok.svg diff --git a/image/dark/pay.svg b/image/icon/dark/pay.svg similarity index 100% rename from image/dark/pay.svg rename to image/icon/dark/pay.svg diff --git a/image/dark/place.svg b/image/icon/dark/place.svg similarity index 100% rename from image/dark/place.svg rename to image/icon/dark/place.svg diff --git a/image/dark/preferences.svg b/image/icon/dark/preferences.svg similarity index 100% rename from image/dark/preferences.svg rename to image/icon/dark/preferences.svg diff --git a/image/dark/print.svg b/image/icon/dark/print.svg similarity index 100% rename from image/dark/print.svg rename to image/icon/dark/print.svg diff --git a/image/dark/refresh.svg b/image/icon/dark/refresh.svg similarity index 100% rename from image/dark/refresh.svg rename to image/icon/dark/refresh.svg diff --git a/image/dark/search.svg b/image/icon/dark/search.svg similarity index 100% rename from image/dark/search.svg rename to image/icon/dark/search.svg diff --git a/image/dark/shipping.svg b/image/icon/dark/shipping.svg similarity index 100% rename from image/dark/shipping.svg rename to image/icon/dark/shipping.svg diff --git a/image/dark/user-info.svg b/image/icon/dark/user-info.svg similarity index 100% rename from image/dark/user-info.svg rename to image/icon/dark/user-info.svg diff --git a/image/dark/view-dual.svg b/image/icon/dark/view-dual.svg similarity index 100% rename from image/dark/view-dual.svg rename to image/icon/dark/view-dual.svg diff --git a/image/dark/view-grid.svg b/image/icon/dark/view-grid.svg similarity index 100% rename from image/dark/view-grid.svg rename to image/icon/dark/view-grid.svg diff --git a/image/dark/view-list.svg b/image/icon/dark/view-list.svg similarity index 100% rename from image/dark/view-list.svg rename to image/icon/dark/view-list.svg diff --git a/image/dark/view.svg b/image/icon/dark/view.svg similarity index 100% rename from image/dark/view.svg rename to image/icon/dark/view.svg diff --git a/image/access-log.svg b/image/icon/light/access-log.svg similarity index 100% rename from image/access-log.svg rename to image/icon/light/access-log.svg diff --git a/image/add-photo.svg b/image/icon/light/add-photo.svg similarity index 100% rename from image/add-photo.svg rename to image/icon/light/add-photo.svg diff --git a/image/add.svg b/image/icon/light/add.svg similarity index 100% rename from image/add.svg rename to image/icon/light/add.svg diff --git a/image/basket.svg b/image/icon/light/basket.svg similarity index 100% rename from image/basket.svg rename to image/icon/light/basket.svg diff --git a/image/clean.svg b/image/icon/light/clean.svg similarity index 100% rename from image/clean.svg rename to image/icon/light/clean.svg diff --git a/image/close.svg b/image/icon/light/close.svg similarity index 100% rename from image/close.svg rename to image/icon/light/close.svg diff --git a/image/delete.svg b/image/icon/light/delete.svg similarity index 100% rename from image/delete.svg rename to image/icon/light/delete.svg diff --git a/image/download.svg b/image/icon/light/download.svg similarity index 100% rename from image/download.svg rename to image/icon/light/download.svg diff --git a/image/edit.svg b/image/icon/light/edit.svg similarity index 100% rename from image/edit.svg rename to image/icon/light/edit.svg diff --git a/image/error.svg b/image/icon/light/error.svg similarity index 100% rename from image/error.svg rename to image/icon/light/error.svg diff --git a/image/exit.svg b/image/icon/light/exit.svg similarity index 100% rename from image/exit.svg rename to image/icon/light/exit.svg diff --git a/image/gnome.svg b/image/icon/light/gnome.svg similarity index 100% rename from image/gnome.svg rename to image/icon/light/gnome.svg diff --git a/image/go-next.svg b/image/icon/light/go-next.svg similarity index 100% rename from image/go-next.svg rename to image/icon/light/go-next.svg diff --git a/image/go-previous.svg b/image/icon/light/go-previous.svg similarity index 100% rename from image/go-previous.svg rename to image/icon/light/go-previous.svg diff --git a/image/incognito.svg b/image/icon/light/incognito.svg similarity index 100% rename from image/incognito.svg rename to image/icon/light/incognito.svg diff --git a/image/info.svg b/image/icon/light/info.svg similarity index 100% rename from image/info.svg rename to image/icon/light/info.svg diff --git a/image/invisible.png b/image/icon/light/invisible.png similarity index 100% rename from image/invisible.png rename to image/icon/light/invisible.png diff --git a/image/menu.svg b/image/icon/light/menu.svg similarity index 100% rename from image/menu.svg rename to image/icon/light/menu.svg diff --git a/image/new-order.svg b/image/icon/light/new-order.svg similarity index 100% rename from image/new-order.svg rename to image/icon/light/new-order.svg diff --git a/image/ok.svg b/image/icon/light/ok.svg similarity index 100% rename from image/ok.svg rename to image/icon/light/ok.svg diff --git a/image/pay.svg b/image/icon/light/pay.svg similarity index 100% rename from image/pay.svg rename to image/icon/light/pay.svg diff --git a/image/place.svg b/image/icon/light/place.svg similarity index 100% rename from image/place.svg rename to image/icon/light/place.svg diff --git a/image/preferences.svg b/image/icon/light/preferences.svg similarity index 100% rename from image/preferences.svg rename to image/icon/light/preferences.svg diff --git a/image/print.svg b/image/icon/light/print.svg similarity index 100% rename from image/print.svg rename to image/icon/light/print.svg diff --git a/image/refresh.svg b/image/icon/light/refresh.svg similarity index 100% rename from image/refresh.svg rename to image/icon/light/refresh.svg diff --git a/image/search.svg b/image/icon/light/search.svg similarity index 100% rename from image/search.svg rename to image/icon/light/search.svg diff --git a/image/shipping.svg b/image/icon/light/shipping.svg similarity index 100% rename from image/shipping.svg rename to image/icon/light/shipping.svg diff --git a/image/show.svg b/image/icon/light/show.svg similarity index 100% rename from image/show.svg rename to image/icon/light/show.svg diff --git a/image/supplant.svg b/image/icon/light/supplant.svg similarity index 100% rename from image/supplant.svg rename to image/icon/light/supplant.svg diff --git a/image/unavailable.svg b/image/icon/light/unavailable.svg similarity index 100% rename from image/unavailable.svg rename to image/icon/light/unavailable.svg diff --git a/image/unknown.svg b/image/icon/light/unknown.svg similarity index 100% rename from image/unknown.svg rename to image/icon/light/unknown.svg diff --git a/image/warning.svg b/image/icon/light/warning.svg similarity index 100% rename from image/warning.svg rename to image/icon/light/warning.svg diff --git a/js/hedera/gui.css b/js/hedera/gui.css index 96f5223a..b745fd20 100644 --- a/js/hedera/gui.css +++ b/js/hedera/gui.css @@ -24,7 +24,7 @@ right: 0; z-index: 1; overflow: hidden; - box-shadow: 0 0.1em 0.1em rgba(1, 1, 1, 0.3); + box-shadow: 0 .1em .1em rgba(1, 1, 1, 0.3); height: 3.9em; color: white; @@ -138,7 +138,7 @@ top: 0; background-color: white; z-index: 20; - box-shadow: 0 0.2em 0.2em rgba(1, 1, 1, 0.4); + box-shadow: 0 .2em .2em rgba(1, 1, 1, 0.4); width: 15em; } .vn-gui .menu-overflow @@ -254,7 +254,7 @@ border: none; border-radius: 1px; background-color: white; - box-shadow: 0 0.2em 0.2em #CCC; + box-shadow: 0 .2em .2em #CCC; z-index: 50; list-style-type: none; padding-left: 0; @@ -359,7 +359,7 @@ { top: 0; left: -15em; - box-shadow: 0 0.2em 0.2em #333; + box-shadow: 0 .2em .2em #333; transition: transform 200ms ease-out; -webkit-transition: transform 200ms ease-out; diff --git a/js/hedera/login.css b/js/hedera/login.css index 1daa1654..5226bd4b 100644 --- a/js/hedera/login.css +++ b/js/hedera/login.css @@ -45,8 +45,8 @@ body margin: 0 auto; max-width: 40em; height: 100%; - background-color: #9CBC28; - box-shadow: 0 .3em .3em rgba(1, 1, 1, 0.4); + background-color: white; + box-shadow: 0 0 .3em 0 rgba(1, 1, 1, 0.4); } /* Login */ @@ -95,6 +95,7 @@ body { display: block; width: 100%; +/* box-shadow: 0 0 .3em 0 rgba(1, 1, 1, 0.4);*/ } .vn-login .version-code { @@ -158,35 +159,41 @@ body .vn-login button { margin: 0 auto; - background-color: #333; - border: 1px solid #222; + background-color: #9CBC28; + border: 1px solid #8A1; height: 2.4em; width: 100%; - color: white; + color: #240; text-transform: uppercase; } .vn-login input[type=submit]:hover, .vn-login input[type=button]:hover, .vn-login button:hover { - background-color: #222; + background-color: #8A1; } hr { - border: solid 1px white; + border: solid 1px #333; margin: 0; padding: 0; display: block; } +.vn-login .enter +{ + position: relative; +} .vn-login .wrapper { width: 0; overflow: visible; - position: relative; + position: absolute; + top: 0; + right: 0; } .vn-login .htk-spinner { - margin: .45em 1em; + margin: .3em 1em; position: absolute; } diff --git a/js/hedera/login.js b/js/hedera/login.js index 4bf6809c..f4c72ab3 100644 --- a/js/hedera/login.js +++ b/js/hedera/login.js @@ -16,7 +16,7 @@ Vn.Login = new Class this.link ({_conn: x}, {'loading-changed': this._onConnLoadChange}); /* x.execQuery ( 'SELECT title, link, icon FROM social ORDER BY priority', - this.onSocialQueryDone.bind (this)); + this._onSocialQueryDone.bind (this)); */ } ,get: function () { @@ -97,8 +97,26 @@ Vn.Login = new Class else this._focusUserInput (); } + + ,onPasswordLost: function () + { + if (!this.$('user').value) + { + Htk.Toast.showError (_('Please write your user name')); + return; + } + + var request = new Vn.JsonRequest ('core/recover-password'); + request.send (null, this._onPasswordRecovered.bind (this)); + } + + ,_onPasswordRecovered: function (request, json, error) + { + if (json) + Htk.Toast.showMessage (_('It sent an email with your new password')); + } - ,onSocialQueryDone: function (resultSet) + ,_onSocialQueryDone: function (resultSet) { var res = resultSet.fetchResult (); var social = this.$('social'); diff --git a/js/hedera/login.xml b/js/hedera/login.xml index fa1953de..2f2d2014 100755 --- a/js/hedera/login.xml +++ b/js/hedera/login.xml @@ -27,13 +27,13 @@
-
+

- + Password forgotten? Push here

diff --git a/js/htk/field/bar-button.js b/js/htk/field/bar-button.js new file mode 100644 index 00000000..8818426b --- /dev/null +++ b/js/htk/field/bar-button.js @@ -0,0 +1,19 @@ +Htk.BarButton = new Class +({ + Extends: Htk.Button + ,Tag: 'htk-bar-button' + ,Properties: + { + icon: + { + type: String + ,set: function (x) + { + this.img.src = 'image/icon/dark/'+ x +'.svg'; + } + + } + } + + ,_showText: true +}); diff --git a/js/htk/field/button.js b/js/htk/field/button.js index b6f575f8..e84426b7 100644 --- a/js/htk/field/button.js +++ b/js/htk/field/button.js @@ -12,6 +12,15 @@ Htk.Button = new Class this.img.src = x; } + }, + icon: + { + type: String + ,set: function (x) + { + this.img.src = 'image/icon/light/'+ x +'.svg'; + } + }, tip: { diff --git a/js/htk/main.js b/js/htk/main.js index 37f8eb6c..898e06da 100644 --- a/js/htk/main.js +++ b/js/htk/main.js @@ -29,6 +29,7 @@ Vn.includeLib ('htk', ,'field/date-chooser' ,'field/image' ,'field/button' + ,'field/bar-button' ,'field/table' ,'field/search-entry' ,'column' diff --git a/pages/tpv/html.php b/pages/tpv/html.php index 8af3205e..d7e6cb5d 100755 --- a/pages/tpv/html.php +++ b/pages/tpv/html.php @@ -5,7 +5,7 @@ - + Verdnatura diff --git a/pages/update-browser/html.php b/pages/update-browser/html.php index 508697f5..63b1be5c 100755 --- a/pages/update-browser/html.php +++ b/pages/update-browser/html.php @@ -5,13 +5,13 @@ - + Verdnatura
diff --git a/image/update-browser.png b/pages/update-browser/update-browser.png similarity index 100% rename from image/update-browser.png rename to pages/update-browser/update-browser.png diff --git a/pages/version-menu/html.php b/pages/version-menu/html.php index 1786a030..b62590f1 100755 --- a/pages/version-menu/html.php +++ b/pages/version-menu/html.php @@ -5,7 +5,7 @@ - + Verdnatura @@ -14,7 +14,7 @@
- +

@@ -27,7 +27,7 @@
- +

diff --git a/reports/shelves-report/shelves-report.js b/reports/shelves-report/shelves-report.js index 8ca24635..8eb59970 100644 --- a/reports/shelves-report/shelves-report.js +++ b/reports/shelves-report/shelves-report.js @@ -13,12 +13,13 @@ Vn.ShelvesReport = new Class this.maxAmount = batch.getValue ('max-amount'); this.showPacking = batch.getValue ('show-packing'); this.stack = batch.getValue ('stack'); + this.useIds = batch.getValue ('use-ids'); var query = 'SELECT id, name, width, height, depth, max_height, tray_height, '+ 'first_tray_elevation, tray_density, vspacing, hspacing '+ 'FROM shelf WHERE id = #shelf; '+ - 'CALL item_organizer (#wh, #date, #family, #filter)'; + 'CALL itemAllocator (#wh, #date, #family, #filter, #use-ids)'; this.conn.execQuery (query, this.onQueryExec.bind (this), this.batch); } @@ -30,6 +31,8 @@ Vn.ShelvesReport = new Class var res = resultSet.fetchResult (); res.next (); + // Calculates the scale + var maxWidth = 170; var maxHeight = 200; @@ -37,6 +40,8 @@ Vn.ShelvesReport = new Class if (res.get ('max_height') * scale > maxHeight) scale = maxHeight / res.get ('max_height'); + + // Gets the shelf dimensions var shelf = this.shelf = { @@ -50,6 +55,8 @@ Vn.ShelvesReport = new Class ,vspacing: res.get ('vspacing') * scale ,hspacing: res.get ('hspacing') * scale }; + + // Gets the items var items = this.items = []; var remainings = this.remainings = []; @@ -186,7 +193,7 @@ Vn.ShelvesReport = new Class var subtitle = this.doc.createElement ('h2'); subtitle.className = 'subtitle'; - subtitle.appendChild (this.doc.createTextNode (item.id.toLocaleString ())); + subtitle.appendChild (this.doc.createTextNode (this.getName (item))); sheet.appendChild (subtitle); this.drawShelfEnding (); @@ -221,10 +228,18 @@ Vn.ShelvesReport = new Class ,drawShelfEnding: function () { if (this.lastSubtitle) - this.lastSubtitle.appendChild ( - this.doc.createTextNode (' - '+ this.lastItem.id.toLocaleString ())); + this.lastSubtitle.appendChild (this.doc.createTextNode ( + ' - '+ this.getName (this.lastItem))); } + ,getName: function (item) + { + if (this.useIds) + return item.id.toLocaleString (); + else + return item.name.charAt (0).toUpperCase (); + } + ,mm: function (size) { return size.toFixed (2) +'mm'; @@ -263,11 +278,16 @@ Vn.ShelvesReport = new Class if (fontSize > item.boxHeight - 1) fontSize = item.boxHeight - 1; + + if (this.useIds) + var labelText = item.id.toLocaleString (); + else + var labelText = item.name; var boxLabel = this.doc.createElement ('div'); boxLabel.className = 'box-label'; boxLabel.style.fontSize = this.mm (fontSize); - boxLabel.appendChild (this.doc.createTextNode (item.id.toLocaleString ())); + boxLabel.appendChild (this.doc.createTextNode (labelText)); box.appendChild (boxLabel); } diff --git a/rest/core/login.php b/rest/core/login.php index d078d4c3..73716e77 100755 --- a/rest/core/login.php +++ b/rest/core/login.php @@ -42,7 +42,7 @@ class Login extends Vn\Web\JsonRequest $user = $this->escape ($_SESSION['user']); $pass = $this->escape ($_SESSION['password']); - ssh2_exec ($ssh, "samba-tool user add \"$user\" \"$pass\""); + ssh2_exec ($ssh, "samba-tool user create \"$user\" \"$pass\""); } /** diff --git a/rest/core/query.php b/rest/core/query.php index 38cc048d..674d61be 100755 --- a/rest/core/query.php +++ b/rest/core/query.php @@ -40,9 +40,9 @@ class Query extends Vn\Web\JsonRequest { if ($row['Code'] == 1265 && ($warning = $db->getRow ($sql))) - trigger_error ("${warning['code']}: ${warning['description']}", E_USER_WARNING); + trigger_error ("{$warning['code']}: {$warning['description']}", E_USER_WARNING); else - trigger_error ("${row['Code']}: ${row['Message']}", E_USER_WARNING); + trigger_error ("{$row['Code']}: {$row['Message']}", E_USER_WARNING); } } diff --git a/rest/core/recover-password.php b/rest/core/recover-password.php index 92e8a8b3..25238cac 100755 --- a/rest/core/recover-password.php +++ b/rest/core/recover-password.php @@ -48,7 +48,7 @@ class RecoverPassword extends Vn\Web\JsonRequest return TRUE; $db->query ( - 'UPDATE account.user SET password = # WHERE name = #', + 'UPDATE account.user SET password = MD5(#) WHERE name = #', [$randomPass, $_REQUEST['user']]); return TRUE; diff --git a/rest/misc/contact.php b/rest/misc/contact.php index 55cc95a9..ea2c314d 100755 --- a/rest/misc/contact.php +++ b/rest/misc/contact.php @@ -13,6 +13,7 @@ class Contact extends Vn\Web\JsonRequest ,'phone' ,'email' ,'message' + ,'captcha' ]; function run () @@ -22,7 +23,7 @@ class Contact extends Vn\Web\JsonRequest $lastCaptcha = $_SESSION['captcha']; unset ($_SESSION['captcha']); - if (empty ($_REQUEST['captcha']) || $_REQUEST['captcha'] !== $lastCaptcha) + if ($_REQUEST['captcha'] !== $lastCaptcha) throw new Lib\UserException (s('Wrong captcha'), 'wrongCaptcha'); // Sends the mail diff --git a/rest/misc/mail.php b/rest/misc/mail.php index 2b50a911..1008df15 100755 --- a/rest/misc/mail.php +++ b/rest/misc/mail.php @@ -27,8 +27,8 @@ class Mail extends Vn\Lib\Method $status = 'OK'; try { - if (!preg_match ('/^[\w\._%-]+@[\w\.-]+\.[A-Za-z]{2,4}$/', $row['to'])) - throw new Exception ('Destination mail has invalid sintax'); + //if (!preg_match ('/^[\w\._%-]+@[\w\.-]+\.[A-Za-z]{2,4}$/', $row['to'])) + // throw new Exception ('Destination mail has invalid sintax'); $mail = new PHPMailer (); $mail->isSMTP (); @@ -66,7 +66,7 @@ class Mail extends Vn\Lib\Method if (!empty ($row['path'])) { - $attachment = '/mnt/storage/pdfs/'. $row['path']; + $attachment = '/mnt/cluster/pdfs/'. $row['path']; if (file_exists ($attachment)) $mail->AddAttachment ($attachment, ''); diff --git a/vn/web/app.php b/vn/web/app.php index b8651782..006567c5 100644 --- a/vn/web/app.php +++ b/vn/web/app.php @@ -3,6 +3,7 @@ namespace Vn\Web; require_once ('vn/lib/app.php'); +require_once (__DIR__.'/jwt.php'); /** * Main class for web applications. @@ -58,7 +59,7 @@ class App extends \Vn\Lib\App { $hostSplit = explode ('.', $_SERVER['SERVER_NAME']); $configDir = _CONFIG_DIR .'/'. $this->name; - $hostFile = $configDir .'/config.'. $hostSplit[0] .'.php'; + $hostFile = "$configDir/config/{$hostSplit[0]}.php"; } if (isset ($hostFile) && file_exists ($hostFile)) @@ -84,8 +85,6 @@ class App extends \Vn\Lib\App $user = NULL; $password = NULL; - $rememberUser = TRUE; - $rememberPass = FALSE; $credentialsChanged = TRUE; $wasLoged = isset ($_SESSION['user']); @@ -99,16 +98,18 @@ class App extends \Vn\Lib\App { $user = $row['guest_user']; $password = base64_decode ($row['guest_pass']); - $rememberUser = FALSE; } } elseif (isset ($_POST['user']) && isset ($_POST['password'])) { $user = $_POST['user']; $password = $_POST['password']; - - if (isset ($_POST['remember']) && $_POST['remember']) - $rememberPass = TRUE; + } + elseif (isset ($_POST['token']) || isset ($_GET['token'])) + { + $key = $sysDb->getValue ('SELECT jwt_key FROM config'); + $jwtPayload = Jwt::decode ($_REQUEST['token'], $key); + $user = $jwtPayload['user']; } elseif (isset ($_SESSION['user'])) { @@ -116,12 +117,6 @@ class App extends \Vn\Lib\App $password = $_SESSION['password']; $credentialsChanged = FALSE; } - elseif (isset ($_COOKIE['vn_user']) && isset ($_COOKIE['vn_pass'])) - { - $user = $_COOKIE['vn_user']; - $password = base64_decode ($_COOKIE['vn_pass']); - $rememberPass = TRUE; - } if (!isset ($user)) throw new SessionExpiredException (); @@ -130,18 +125,14 @@ class App extends \Vn\Lib\App try { $db = $this->createConnection ($user, $password); - $db->query ('CALL user_session_start (#)', [session_id ()]); + $db->query ('CALL userStartSession (#)', [session_id ()]); $this->conn = $db; - - if ($rememberUser) - { - $cookieLife = time () + 7 * 86400; // 7 Days - setcookie ('vn_user', $user, $cookieLife); - - if ($rememberPass) - setcookie ('vn_pass', - base64_encode ($password), $cookieLife); - } + + $jwtToken = Jwt::encode ([ + 'userName' => $user, + 'timestamp' => time () + 'exp' => NULL + ]); $_SESSION['user'] = $user; $_SESSION['password'] = $password; @@ -162,7 +153,7 @@ class App extends \Vn\Lib\App { $sysConn = $this->getSysConn (); $_SESSION['visitUser'] = $sysConn->getValue ( - 'CALL visit_user_new (#, #, #)', + 'CALL visitUserNew (#, #, #)', [ $_SESSION['access'] ,nullIf ($_SESSION, 'visitUser') @@ -184,17 +175,13 @@ class App extends \Vn\Lib\App { $_SESSION['visitUser'] = nullIf ($_SESSION, 'visitUnknown'); - setcookie ('vn_pass', '', -1); - unset ($_COOKIE['vn_pass']); + setcookie ('vnPass', '', -1); unset ($_SESSION['user']); unset ($_SESSION['password']); if ($this->conn) { - $this->conn->query ( - 'DELETE FROM user_session_view - WHERE connection_id = CONNECTION_ID()' - ); + $this->conn->query ('DELETE FROM user_session_view'); $this->conn->close (); $this->conn = NULL; } diff --git a/vn/web/db-session-handler.php b/vn/web/db-session-handler.php new file mode 100755 index 00000000..bf0e56da --- /dev/null +++ b/vn/web/db-session-handler.php @@ -0,0 +1,57 @@ +db = $db; + } + + function close () + { + return TRUE; + } + + function destroy ($sessionId) + { + $db->query ('DELETE FROM userSession WHERE id = #', [$sessionId]); + return TRUE; + } + + function gc ($maxLifeTime) + { + $db->query ('DELETE FROM userSession + WHERE creationDate < TIMESTAMPADD(SECOND, -#, NOW())', + [$maxLifeTime] + ); + return TRUE; + } + + function open ($savePath, $name) + { + return TRUE; + } + + function read ($sessionId) + { + $db->query ('DO GET_LOCK(#, 30)', [$sessionId]); + $sessionData = $db->getValue ( + 'SELECT data FROM userSession WHERE id = #', [$sessionId]); + return isset ($sessionData) ? $sessionData : ''; + } + + function write ($sessionId, $sessionData) + { + $db->query ('REPLACE INTO userSession SET id = #, data = #', + [$sessionId, $sessionData]); + $db->query ('DO RELEASE_LOCK(#)', [$sessionId]); + return TRUE; + } + +} + +?> diff --git a/vn/web/html-service.php b/vn/web/html-service.php index 516724c0..c75980e9 100644 --- a/vn/web/html-service.php +++ b/vn/web/html-service.php @@ -18,7 +18,7 @@ class HtmlService extends Service if (!$this->isHttps () && $db->getValue ('SELECT https FROM config')) { - header ("Location: https://${_SERVER['SERVER_NAME']}${_SERVER['REQUEST_URI']}"); + header ("Location: https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"); exit (0); } diff --git a/vn/web/jwt.php b/vn/web/jwt.php new file mode 100755 index 00000000..adcf1b11 --- /dev/null +++ b/vn/web/jwt.php @@ -0,0 +1,90 @@ + 'HS256', + 'typ' => 'JWT' + ]; + + $b64Header = self::jsonB64Encode ($header); + $b64Payload = self::jsonB64Encode ($payload); + $b64Signature = self::getSignature ($b64Header, $b64Payload, $key); + + return "$b64Header.$b64Payload.$b64Signature"; + } + + /** + * Validates and extracts the data from a JWT token. + * + * @param {Array} $token The JWT token + * @param {string} $key The key used to validate the token + * @return {string} The JWT validated and decoded data + **/ + static function decode ($token, $key) + { + $parts = explode ('.', $token); + + if (count($parts) !== 3) + throw new Exception ('Bad JWT token'); + + $b64Header = $parts[0]; + $b64Payload = $parts[1]; + $b64Signature = $parts[2]; + + $header = self::jsonB64Decode ($b64Header); + $payload = self::jsonB64Decode ($b64Payload); + + if ($b64Signature != self::getSignature ($b64Header, $b64Payload, $key)) + throw new Exception ('Bad token signature'); + + return $payload; + } + + static function getSignature ($b64Header, $b64Payload, $key) + { + $signature = hash_hmac ('sha256', "$b64Header.$b64Payload", $key, TRUE); + return self::base64UrlEncode ($signature); + } + + static function jsonB64Encode ($data) + { + return self::base64UrlEncode (json_encode ($data)); + } + + static function jsonB64Decode ($data) + { + return json_decode (self::base64UrlDecode ($data)); + } + + static function base64UrlEncode ($data) + { + return rtrim (strtr (base64_encode ($data), '+/', '-_'), '='); + } + + static function base64UrlDecode ($data) + { + $remainder = strlen ($data) % 4; + $data = strtr ($data, '-_', '+/'); + return base64_decode (str_pad ($data, $remainder, '=', STR_PAD_RIGHT)); + } +} + +?> diff --git a/vn/web/service.php b/vn/web/service.php index b785c9e8..d5d942e4 100755 --- a/vn/web/service.php +++ b/vn/web/service.php @@ -3,6 +3,7 @@ namespace Vn\Web; require_once ('vn/lib/app.php'); +require_once (__DIR__.'/db-session-handler.php'); use Vn\Lib; use Vn\Lib\Locale; @@ -40,19 +41,23 @@ abstract class Service **/ function startSession () { - if ($this->isHttps ()) - ini_set ('session.cookie_secure', TRUE); - + $db = $this->app->getSysConn (); + + ini_set ('session.cookie_secure', TRUE); + ini_set ('session.use_only_cookies', FALSE); + ini_set ('session.cookie_path', 'cookies'); ini_set ('session.hash_function', 'sha512'); + + session_set_save_handler (new DbSessionHandler ($db)); session_start (); - + // Setting the locale if (isset ($_SERVER['HTTP_ACCEPT_LANGUAGE'])) - if (!isset ($_SESSION['http_language']) - || $_SESSION['http_language'] != $_SERVER['HTTP_ACCEPT_LANGUAGE']) + if (!isset ($_SESSION['httpLanguage']) + || $_SESSION['httpLanguage'] != $_SERVER['HTTP_ACCEPT_LANGUAGE']) { - $_SESSION['http_language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + $_SESSION['httpLanguage'] = $_SERVER['HTTP_ACCEPT_LANGUAGE']; $regexp = '/([a-z]{1,4})(?:-[a-z]{1,4})?\s*(?:;\s*q\s*=\s*(?:1|0\.[0-9]+))?,?/i'; preg_match_all ($regexp, $_SERVER['HTTP_ACCEPT_LANGUAGE'], $languages); @@ -89,11 +94,10 @@ abstract class Service if (isset ($_SERVER['REMOTE_ADDR'])) $ip = ip2long ($_SERVER['REMOTE_ADDR']); - $db = $this->app->getSysConn (); $row = $db->getRow ( - 'CALL visit_register (#, #, #, #, #, #, #, #, #)', + 'CALL visitRegister (#, #, #, #, #, #, #, #, #)', [ - nullIf ($_COOKIE, 'vn_visit') + nullIf ($_COOKIE, 'vnVisit') ,nullIf ($browser, 'platform') ,nullIf ($browser, 'browser') ,nullIf ($browser, 'version') @@ -107,7 +111,7 @@ abstract class Service if (isset ($row['access'])) { - setcookie ('vn_visit', $row['visit'], time () + 31536000); // 1 Year + setcookie ('vnVisit', $row['visit'], time () + 31536000); // 1 Year $_SESSION['access'] = $row['access']; } else