From 043c11a4edc5ca40f387e30130c3a3903d3d4794 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio <juan.ferrer.toribio@gmail.com> Date: Thu, 9 Mar 2017 13:30:39 +0100 Subject: [PATCH] backup --- app.js | 1 - debian/changelog | 2 +- debian/control | 2 +- debian/install | 3 +- forms/ecomerce/basket/style.css | 11 ++-- forms/ecomerce/basket/ui.xml | 82 +++++++++++++-------------- forms/ecomerce/confirm/style.css | 9 --- forms/ecomerce/ticket/style.css | 13 +++-- forms/ecomerce/ticket/ui.xml | 38 ++++++++----- image/logo.png | Bin 0 -> 8577 bytes index.php | 1 - js/hedera/app.js | 2 +- js/hedera/login.js | 4 +- js/hedera/report.js | 1 - js/htk/style.css | 3 +- package.json | 2 +- pages/main/ui.php | 46 +-------------- reports/delivery-note/locale/es.json | 3 + reports/delivery-note/ui.xml | 2 +- rest/core/recover-password.php | 6 +- web/html-service.php | 13 ++++- web/html.php | 73 ++++++++++++++++-------- web/json-service.php | 1 + web/rest-service.php | 39 +++++++++++++ web/service.php | 59 +++++++------------ web/unavailable.html | 17 ++++-- 26 files changed, 227 insertions(+), 206 deletions(-) create mode 100644 image/logo.png create mode 100644 reports/delivery-note/locale/es.json diff --git a/app.js b/app.js index 138ca36b..28b7aaf2 100644 --- a/app.js +++ b/app.js @@ -61,4 +61,3 @@ function loadLocale (cb) cb (require.context ('js', true, /locale\/en.json$/)); }); } } - diff --git a/debian/changelog b/debian/changelog index 45f05bdb..c9b5ce4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (2.0.1) stable; urgency=low +hedera-web (2.0.3) stable; urgency=low * Initial Release. diff --git a/debian/control b/debian/control index d3ccdba8..05e31365 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,7 @@ Vcs-Git: git://www.verdnatura.es/var/git/hedera-web Package: hedera-web Architecture: all -Depends: apache2, php5-mysql, php5-mcrypt, php5-ssh2, php-vn-lib, php-acpu, nodejs, npm +Depends: apache2, php5-mysql, php5-mcrypt, php5-ssh2, php5-apcu, php-vn-lib, nodejs, npm Suggests: php-text-captcha, php5-imap Section: misc Priority: optional diff --git a/debian/install b/debian/install index ddaaaa78..b709bf6e 100644 --- a/debian/install +++ b/debian/install @@ -10,5 +10,6 @@ reports usr/share/hedera-web rest usr/share/hedera-web index.php usr/share/hedera-web package.json usr/share/hedera-web -build usr/share/hedera-web manifest.json usr/share/hedera-web +webpack.config.json usr/share/hedera-web +build usr/share/hedera-web diff --git a/forms/ecomerce/basket/style.css b/forms/ecomerce/basket/style.css index bed6bd76..e7c05999 100644 --- a/forms/ecomerce/basket/style.css +++ b/forms/ecomerce/basket/style.css @@ -8,9 +8,10 @@ } .basket .head { + padding: 0; padding-bottom: 2em; - margin: 0; border-bottom: 1px solid #DDD; + margin-bottom: 1em; } .basket .head p { @@ -22,13 +23,9 @@ /* Lines */ -.basket .lines -{ - padding: .8em 0; -} .basket .line { - padding: 1em 0; + padding: .5em 0; } .basket .line > .delete { @@ -48,7 +45,7 @@ .basket .line > p { margin: .1em 0; - margin-left: 7.5em; + margin-left: 6em; } .basket .line .subtotal { diff --git a/forms/ecomerce/basket/ui.xml b/forms/ecomerce/basket/ui.xml index 07d111df..549a07af 100755 --- a/forms/ecomerce/basket/ui.xml +++ b/forms/ecomerce/basket/ui.xml @@ -26,50 +26,48 @@ </htk-text> </p> </div> - <div class="lines"> - <htk-repeater form-id="iter" renderer="repeaterFunc"> - <db-model id="items" property="model" updatable="true"> - <custom> - SELECT i.id, i.amount, i.price, a.Article, a.Categoria, - a.Medida, a.Tallos, a.Color, o.Abreviatura, a.Foto - FROM basket_item i - JOIN vn2008.Articles a ON a.Id_Article = i.item_id - LEFT JOIN vn2008.Origen o ON a.id_origen = o.id - </custom> - </db-model> + <htk-repeater form-id="iter" renderer="repeaterFunc"> + <db-model id="items" property="model" updatable="true"> <custom> - <div class="line"> - <htk-button - form="iter" - column="ticket_id" - class="delete" - tip="_Remove" - icon="delete" - on-click="onDeleteClick"/> - <htk-image - form="iter" - column="Foto" - class="photo" - directory="catalog" - subdir="200x200" - full-dir="900x900"/> - <p class="concept"> - <htk-text form="iter" column="Article"/> - <htk-text form="iter" column="Medida"/> - <htk-text form="iter" column="Categoria"/> - </p> - <p class="amount"> - <htk-text form="iter" column="amount"/> x - <htk-text form="iter" column="price" format="%.2d€"/> - <span class="subtotal"> - <htk-text id="subtotal" format="%.2d€"/> - </span> - </p> - <div class="clear"/> - </div> + SELECT i.id, i.amount, i.price, a.Article, a.Categoria, + a.Medida, a.Tallos, a.Color, o.Abreviatura, a.Foto + FROM basket_item i + JOIN vn2008.Articles a ON a.Id_Article = i.item_id + LEFT JOIN vn2008.Origen o ON a.id_origen = o.id </custom> - </htk-repeater> - </div> + </db-model> + <custom> + <div class="line"> + <htk-button + form="iter" + column="ticket_id" + class="delete" + tip="_Remove" + icon="delete" + on-click="onDeleteClick"/> + <htk-image + form="iter" + column="Foto" + class="photo" + directory="catalog" + subdir="200x200" + full-dir="900x900"/> + <p class="concept"> + <htk-text form="iter" column="Article"/> + <htk-text form="iter" column="Medida"/> + <htk-text form="iter" column="Categoria"/> + </p> + <p class="amount"> + <htk-text form="iter" column="amount"/> x + <htk-text form="iter" column="price" format="%.2d€"/> + <span class="subtotal"> + <htk-text id="subtotal" format="%.2d€"/> + </span> + </p> + <div class="clear"/> + </div> + </custom> + </htk-repeater> </div> </div> </vn> diff --git a/forms/ecomerce/confirm/style.css b/forms/ecomerce/confirm/style.css index 01dbb62d..3ab459fe 100644 --- a/forms/ecomerce/confirm/style.css +++ b/forms/ecomerce/confirm/style.css @@ -2,14 +2,6 @@ { color: #555; } -.confirm .card -{ - padding: 2.2em 2.5em; -} -.confirm .summary -{ - margin-bottom: 1em; -} .confirm .address { margin-top: .8em; @@ -119,4 +111,3 @@ { margin: .1em 0; } - diff --git a/forms/ecomerce/ticket/style.css b/forms/ecomerce/ticket/style.css index e7b533df..142ef4da 100644 --- a/forms/ecomerce/ticket/style.css +++ b/forms/ecomerce/ticket/style.css @@ -31,13 +31,18 @@ { padding: .5em 0; } +.ticket .line > .photo +{ + margin-right: 1em; + float: left; + border-radius: 50%; + height: 3.2em; + width: 3.2em; +} .ticket .line p { margin: .1em 0; -} -.ticket .amount -{ - float: left; + margin-left: 4em; } .ticket .subtotal { diff --git a/forms/ecomerce/ticket/ui.xml b/forms/ecomerce/ticket/ui.xml index 96125e7b..605bb999 100755 --- a/forms/ecomerce/ticket/ui.xml +++ b/forms/ecomerce/ticket/ui.xml @@ -6,12 +6,12 @@ <db-model id="ticket-data" property="model"> <custom> SELECT t.id, date, a.Agencia, note, p.name province, - zip_code, city, c.name, consignee, invoice, delivery + zip_code, city, c.name, consignee, invoice, delivery FROM ticket_view t - JOIN address_view c ON t.address_id = c.id - JOIN vn2008.Agencias a ON t.agency_id = a.Id_Agencia - JOIN vn2008.province p ON c.province_id = p.province_id - WHERE t.id = #ticket + JOIN address_view c ON t.address_id = c.id + JOIN vn2008.Agencias a ON t.agency_id = a.Id_Agencia + JOIN vn2008.province p ON c.province_id = p.province_id + WHERE t.id = #ticket </custom> <sql-batch property="batch"> <custom> @@ -69,14 +69,15 @@ <htk-repeater form-id="iter" renderer="repeaterFunc"> <db-model property="model" id="movements"> <custom> - SELECT m.item_id, amount, concept, Categoria, Medida, Tallos, Color, - Abreviatura, IF(fixed != FALSE, price, NULL) price, fixed, discount + SELECT m.item_id, m.amount, m.concept, + IF(m.fixed != FALSE, m.price, NULL) price, m.fixed, m.discount, + o.Abreviatura, a.Categoria, a.Medida, a.Tallos, a.Color, a.Foto FROM ticket_row_view m - INNER JOIN vn2008.Articles a - ON m.item_id = a.Id_Article AND ticket_id = #ticket - LEFT JOIN vn2008.Origen o - ON a.id_origen = o.id - ORDER BY concept + INNER JOIN vn2008.Articles a + ON m.item_id = a.Id_Article AND ticket_id = #ticket + LEFT JOIN vn2008.Origen o + ON a.id_origen = o.id + ORDER BY concept </custom> <sql-batch property="batch"> <custom> @@ -86,6 +87,13 @@ </db-model> <custom> <div class="line"> + <htk-image + form="iter" + column="Foto" + class="photo" + directory="catalog" + subdir="200x200" + full-dir="900x900"/> <p class="concept"> <htk-text form="iter" column="concept"/> <htk-text form="iter" column="Medida"/> @@ -94,9 +102,9 @@ <p class="amount"> <htk-text form="iter" column="amount"/> x <htk-text form="iter" column="price" format="%.2d€"/> - </p> - <p class="subtotal"> - <htk-text id="subtotal" format="%.2d€"/> + <span class="subtotal"> + <htk-text id="subtotal" format="%.2d€"/> + </span> </p> <div class="clear"/> </div> diff --git a/image/logo.png b/image/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..55e26fec6d6a2abff506862b1f851e1554f603c6 GIT binary patch literal 8577 zcmV-{A%5P8P)<h;3K|Lk000e1NJLTq00A=q001lq1^@s639nzI00009a7bBm001Wt z001Wt0hDP`82|tZPiaF#P*7-ZbZ>KLZ*U+<Lqi~Na&Km7Y-Iodc-oy)XH-+^7Crag z^g>IBfRsybQWXdwQbLP>6p<z>Aqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uh<iVD~V z<RPMtgQJLw%KPDaqifc@_vX$1wbwr9tn;0-&j-K=43<bUQ8j=JsX`tR;Dg7+#^K~H zK!FM*Z~zbpvt%K2{UZSY_<lS*D<Z%Lz5oGu(+dayz)hRLFdT>f59&ghTmgWD0l;*T zI7<kC6aYYajzXpYKt=(8otP$50H6c_V9R4-;{Z@C0AMG7=F<Rxo%or10RUT+Ar%3j zkpLhQWr#!oXgdI`&sK^>09Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-<?i z0%4j!F2Z@488U%158(66005wo6%pWr^Zj_v4zAA5HjcIqUoGmt2LB>rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_<lS*MWK+n+1cgf z<k(8YLR(?VSAG6x!e78w{cQPuJpA|d;J)G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once 'vn-autoload.php'; $webApp = new Vn\Web\App ('hedera-web'); $webApp->run (); - diff --git a/js/hedera/app.js b/js/hedera/app.js index cd6ce000..6871c10b 100644 --- a/js/hedera/app.js +++ b/js/hedera/app.js @@ -48,7 +48,7 @@ module.exports = new Class gui.show (); } - ,_onLogout: function (gui) + ,_onLogout: function () { this.clearAutoLogin (); this._freeGui (); diff --git a/js/hedera/login.js b/js/hedera/login.js index 56144131..78fa4d4d 100644 --- a/js/hedera/login.js +++ b/js/hedera/login.js @@ -44,7 +44,7 @@ module.exports = new Class this.$('spinner').stop (); } - ,show: function (firstLogin) + ,show: function () { document.body.appendChild (this.node); @@ -114,7 +114,7 @@ module.exports = new Class if (!user) Htk.Toast.showError (_('Please write your user name')); else - this._conn.send ('core/recover-password', {'user': user}, + this._conn.send ('core/recover-password', {'recoverUser': user}, this._onPasswordRecovered.bind (this)); } diff --git a/js/hedera/report.js b/js/hedera/report.js index d48c5b86..b7fe0165 100644 --- a/js/hedera/report.js +++ b/js/hedera/report.js @@ -100,4 +100,3 @@ module.exports = new Class this.doc.body.appendChild (res.$('report')); } }); - diff --git a/js/htk/style.css b/js/htk/style.css index 27e88c9e..6f345467 100644 --- a/js/htk/style.css +++ b/js/htk/style.css @@ -99,7 +99,7 @@ th.cell-radio } td.cell-button { - max-width: 1px; + width: 1em; text-align: center; } td.cell-button > button @@ -633,4 +633,3 @@ td.cell-image .htk-image { to {-webkit-transform: rotate(360deg);} } - diff --git a/package.json b/package.json index 8e77c567..83b993b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "2.0.1", + "version": "2.0.3", "description": "Verdnatura web page", "devDependencies": { "assets-webpack-plugin": "^3.5.1", diff --git a/pages/main/ui.php b/pages/main/ui.php index f081b50b..65a7a283 100755 --- a/pages/main/ui.php +++ b/pages/main/ui.php @@ -1,47 +1,7 @@ <?php $lang = Vn\Lib\Locale::get (); -$result = $db->query('SELECT name, content FROM metatag'); - -$wpConfig = json_decode (file_get_contents ('webpack.config.json')); -$buildDir = $wpConfig->buildDir; -$devServerPort = $wpConfig->devServerPort; - -$host = $_SERVER['SERVER_NAME']; -$assets = new stdClass(); - -if (!_DEV_MODE) -{ - $wpAssets = json_decode (file_get_contents ("$buildDir/webpack-assets.json")); - - $manifestJs = $wpAssets->manifest->js; - $mainJs = $wpAssets->main->js; - unset ($wpAssets->manifest); - unset ($wpAssets->main); - - foreach ($wpAssets as $name => $asset) - if (property_exists ($asset, 'js')) - $assets->$name = $asset->js; -} -else -{ - $devServerPath = "http://$host:$devServerPort/$buildDir"; - $manifestJs = "$devServerPath/manifest.js"; - $mainJs = "$devServerPath/main.js"; - - unset ($wpConfig->entry->main); - - foreach ($wpConfig->entry as $asset => $files) - $assets->$asset = "$devServerPath/$asset.js"; -} - -$jsFiles = []; -$jsFiles[] = $manifestJs; - -foreach ($assets as $jsFile) - $jsFiles[] = $jsFile; - -$jsFiles[] = $mainJs; +$result = $db->query ('SELECT name, content FROM metatag'); ?> <!DOCTYPE html> @@ -58,11 +18,11 @@ $jsFiles[] = $mainJs; <meta name="theme-color" content="#009688"/> <meta name="content-language" content="<?=$lang?>"/> - <?php while ($row = $result->fetch_object()): ?> + <?php while ($row = $result->fetch_object ()): ?> <meta name="<?=$row->name?>" content="<?=$row->content?>"/> <?php endwhile ?> - <?php foreach ($jsFiles as $js): ?> + <?php foreach (getWebpackAssets () as $js): ?> <script type="text/javascript" src="<?=$js?>"></script> <?php endforeach ?> diff --git a/reports/delivery-note/locale/es.json b/reports/delivery-note/locale/es.json new file mode 100644 index 00000000..d6cc0100 --- /dev/null +++ b/reports/delivery-note/locale/es.json @@ -0,0 +1,3 @@ +{ + "Import": "Importe" +} \ No newline at end of file diff --git a/reports/delivery-note/ui.xml b/reports/delivery-note/ui.xml index e92107b1..16c24034 100755 --- a/reports/delivery-note/ui.xml +++ b/reports/delivery-note/ui.xml @@ -56,7 +56,7 @@ <htk-column-text title="_S1" column="Medida"/> <htk-column-text title="_Cat" column="Categoria"/> <htk-column-spin title="_Price" column="price" unit="€" digits="2"/> - <htk-column-spin title="_Subtotal" unit="€" digits="2" renderer="subtotalRenderer"/> + <htk-column-spin title="_Import" unit="€" digits="2" renderer="subtotalRenderer"/> </htk-grid> <p class="footer"> <htk-text format="%.2d€"> diff --git a/rest/core/recover-password.php b/rest/core/recover-password.php index 876a110c..9c2c2307 100755 --- a/rest/core/recover-password.php +++ b/rest/core/recover-password.php @@ -4,7 +4,7 @@ use Vn\Web; class RecoverPassword extends Vn\Web\JsonRequest { - const PARAMS = ['user']; + const PARAMS = ['recoverUser']; function run ($db) { @@ -13,14 +13,14 @@ class RecoverPassword extends Vn\Web\JsonRequest FROM vn2008.Clientes c JOIN account.user u ON u.id = c.Id_Cliente WHERE u.name = #', - [$_REQUEST['user']] + [$_REQUEST['recoverUser']] ); if (!($user['active'] && $user['mail'])) return TRUE; $service = $this->service; - $token = $service->createToken ($_REQUEST['user'], FALSE, TRUE); + $token = $service->createToken ($_REQUEST['recoverUser'], FALSE, TRUE); $url = $service->getUrl () ."#!form=account/conf&token=$token"; $report = new Vn\Web\Report ($db, 'recover-password', ['url' => $url]); diff --git a/web/html-service.php b/web/html-service.php index dee901fe..1600ee7d 100644 --- a/web/html-service.php +++ b/web/html-service.php @@ -13,12 +13,20 @@ class HtmlService extends Service { function run () { + $eFlag = + E_ERROR + | E_USER_ERROR; + + set_error_handler ([$this, 'errorHandler'], $eFlag); + set_exception_handler ([$this, 'errorHandler']); + + $this->init (); $db = $this->db; if (!$this->isHttps () && $db->getValue ('SELECT https FROM config') && !_DEV_MODE) { - header ("Location: https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"); + header ("Location: https://{$this->getUri()}"); exit (0); } @@ -96,11 +104,12 @@ class HtmlService extends Service //header ("Content-Security-Policy: default-src *; img-src *;"); } - function globalErrorHandler () + function errorHandler () { $this->printHeader (); include (__DIR__.'/unavailable.html'); exit (0); + return FALSE; } function isMobile () diff --git a/web/html.php b/web/html.php index e1e7fae3..f810b145 100644 --- a/web/html.php +++ b/web/html.php @@ -3,29 +3,11 @@ function getUrl ($fileName) { if (file_exists ($fileName)) - { - $hashes = apc_fetch ("$appName.hashes", $success); - - if (!$success) - { - apc_store ("$appName.version", $version); - $hashes = []; - } - - if (!isset ($hashes[$fileName])) - { - $hash = md5_file($fileName); - $hashes[$fileName] = $hash; - } - else - $hash = $hashes[$fileName]; - - $mTime = "?$hash"; - } - else - $mTime = ''; - - return $fileName.$mTime; + $mTime = '?'. strftime ('%G%m%d%H%M%S', filemtime ($fileName)); + else + $mTime = '?'. $this->getVersion (); + + return $fileName.$mTime; } function js ($fileName) @@ -37,3 +19,48 @@ function css ($fileName) { return '<link rel="stylesheet" type="text/css" href="'. getUrl ($fileName) .'"/>'."\n"; } + +function getWebpackAssets () +{ + $wpConfig = json_decode (file_get_contents ('webpack.config.json')); + $buildDir = $wpConfig->buildDir; + $devServerPort = $wpConfig->devServerPort; + + $host = $_SERVER['SERVER_NAME']; + $assets = new stdClass(); + + if (!_DEV_MODE) + { + $wpAssets = json_decode (file_get_contents ("$buildDir/webpack-assets.json")); + + $manifestJs = $wpAssets->manifest->js; + $mainJs = $wpAssets->main->js; + unset ($wpAssets->manifest); + unset ($wpAssets->main); + + foreach ($wpAssets as $name => $asset) + if (property_exists ($asset, 'js')) + $assets->$name = $asset->js; + } + else + { + $devServerPath = "http://$host:$devServerPort/$buildDir"; + $manifestJs = "$devServerPath/manifest.js"; + $mainJs = "$devServerPath/main.js"; + + unset ($wpConfig->entry->main); + + foreach ($wpConfig->entry as $asset => $files) + $assets->$asset = "$devServerPath/$asset.js"; + } + + $jsFiles = []; + $jsFiles[] = $manifestJs; + + foreach ($assets as $jsFile) + $jsFiles[] = $jsFile; + + $jsFiles[] = $mainJs; + + return $jsFiles; +} diff --git a/web/json-service.php b/web/json-service.php index 59ead94a..e7da96e0 100644 --- a/web/json-service.php +++ b/web/json-service.php @@ -17,6 +17,7 @@ class JsonService extends RestService set_error_handler ([$this, 'errorHandler'], E_ALL); set_exception_handler ([$this, 'exceptionHandler']); + $this->init (); $this->startSession (); $this->checkVersion (); diff --git a/web/rest-service.php b/web/rest-service.php index 2376fdfd..96f8a6e6 100644 --- a/web/rest-service.php +++ b/web/rest-service.php @@ -3,6 +3,8 @@ namespace Vn\Web; use Vn\Lib; +use Vn\Lib\Locale; +use Vn\Lib\UserException; /** * Base class for REST application. @@ -15,9 +17,46 @@ class RestService extends Service set_error_handler ([$this, 'errorHandler'], E_ALL); set_exception_handler ([$this, 'exceptionHandler']); + $this->init (); $this->startSession (); $this->loadMethod (__NAMESPACE__.'\RestRequest'); } + + /** + * Runs a REST method. + */ + function loadMethod ($class) + { + $db = $this->db; + $this->login (); + + $method = $this->app->loadMethod ( + $_REQUEST['method'], $class, './rest'); + $method->service = $this; + + if ($method::SECURITY == Security::DEFINER) + { + $isAuthorized = $db->getValue ('SELECT userCheckRestPriv (#)', + [$_REQUEST['method']]); + + if (!$isAuthorized) + throw new UserException (s('You don\'t have enough privileges')); + + $methodDb = $db; + } + else + $methodDb = $this->getUserDb ($_SESSION['user']); + + if ($method::PARAMS !== NULL && !$method->checkParams ($_REQUEST, $method::PARAMS)) + throw new UserException (s('Missing parameters')); + + Locale::addPath ("rest/{$_REQUEST['method']}"); + + $res = $method->run ($methodDb); + $db->query ('CALL account.userLogout ()'); + + return $res; + } function statusFromException ($e) { diff --git a/web/service.php b/web/service.php index eac532a0..64d59708 100755 --- a/web/service.php +++ b/web/service.php @@ -37,7 +37,11 @@ abstract class Service function __construct ($app) { $this->app = $app; - $this->db = $app->getSysConn (); + } + + function init () + { + $this->db = $this->app->getSysConn (); } /** @@ -45,7 +49,7 @@ abstract class Service */ function startSession () { - $db = $this->db; + $db = $this->app->getSysConn (); ini_set ('session.cookie_secure', $this->isHttps ()); ini_set ('session.hash_function', 'sha256'); @@ -147,7 +151,10 @@ abstract class Service catch (\Vn\Db\Exception $e) { if ($e->getMessage () == 'INVALID_CREDENTIALS') + { + sleep (3); throw new BadLoginException (); + } else throw $e; } @@ -258,42 +265,6 @@ abstract class Service $key = $this->db->getValue ('SELECT jwtKey FROM config'); return Jwt::encode ($payload, $key); } - - /** - * Runs a method. - */ - function loadMethod ($class) - { - $db = $this->db; - $this->login (); - - $method = $this->app->loadMethod ( - $_REQUEST['method'], $class, './rest'); - $method->service = $this; - - if ($method::SECURITY == Security::DEFINER) - { - $isAuthorized = $db->getValue ('SELECT userCheckRestPriv (#)', - [$_REQUEST['method']]); - - if (!$isAuthorized) - throw new UserException (s('You don\'t have enough privileges')); - - $methodDb = $db; - } - else - $methodDb = $this->getUserDb ($_SESSION['user']); - - if ($method::PARAMS !== NULL && !$method->checkParams ($_REQUEST, $method::PARAMS)) - throw new UserException (s('Missing parameters')); - - Locale::addPath ("rest/{$_REQUEST['method']}"); - - $res = $method->run ($methodDb); - $db->query ('CALL account.userLogout ()'); - - return $res; - } /** * Obtains the application version number. It is extracted and @@ -344,6 +315,16 @@ abstract class Service { return isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'; } + + /** + * Returns the current URI without the GET part. + * + * @return string The current URI + */ + function getUri () + { + return "{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"; + } /** * Returns the current URL without the GET part. @@ -353,7 +334,7 @@ abstract class Service function getUrl () { $proto = $this->isHttps () ? 'https' : 'http'; - return "$proto://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"; + return "$proto://{$this->getUri()}"; } } diff --git a/web/unavailable.html b/web/unavailable.html index 5d882273..af574787 100755 --- a/web/unavailable.html +++ b/web/unavailable.html @@ -3,36 +3,41 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> - <title>No disponible - Verdnatura</title> + <title>Not available - Verdnatura</title> <style type="text/css"> body { font-size: 16pt; + font-family: Sans; } div { position: absolute; - width: 36em; + width: 32em; margin-top: -7em; margin-left: -18em; top: 50%; left: 50%; text-align: center; } + div h2 + { + font-weight: normal; + } div a { - color: #444; + color: #2962FF; + text-decoration: none; } </style> </head> <body> <div> <h2> - Estamos teniendo problemas; por favor, - espera unos minutos e inténtalo de nuevo. + We are having problems; Please wait a few minutes and try again. </h2> <a href="javascript: location.reload (true)"> - Intentarlo de nuevo + Try it again </a> </div> </body>