From e373ad452229370b624a74c5714977bbb1c7496f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 17 Oct 2016 14:36:52 +0200 Subject: [PATCH] Errores solucionados --- debian/changelog | 2 +- rest/edi/lib/segment.php | 14 ++++++++------ rest/edi/load.php | 14 ++++++++------ rest/tpv/tpv.php | 2 +- web/db-session-handler.php | 4 +++- web/service.php | 3 +-- 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/debian/changelog b/debian/changelog index 155e14bd..2d1500ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.359-deb8) stable; urgency=low +hedera-web (1.362-deb8) stable; urgency=low * Initial Release. diff --git a/rest/edi/lib/segment.php b/rest/edi/lib/segment.php index 53d10521..555d4695 100644 --- a/rest/edi/lib/segment.php +++ b/rest/edi/lib/segment.php @@ -3,6 +3,8 @@ namespace Edi; use Vn\Lib\Type; +use Vn\Lib\Date; +use Vn\Lib\Time; class Segment { @@ -18,16 +20,16 @@ class Segment switch ($type) { - case TYPE_DATE: - $tmp = new \Date (); + case Type::DATE: + $tmp = new Date (); $tmp->setDate (substr ($v, 0, 4), substr ($v, 4, 2), substr ($v, 6, 2)); return $tmp; - case TYPE_TIME: - $tmp = new \Time (); + case Type::TIME: + $tmp = new Time (); $tmp->setTime (substr ($v, 0, 2), substr ($v, 2, 2)); return $tmp; - case TYPE_DOUBLE: - case TYPE_INTEGER: + case Type::DOUBLE: + case Type::INTEGER: Type::set ($v, $type); default: return $v; diff --git a/rest/edi/load.php b/rest/edi/load.php index 7e9f5d92..9aec6876 100644 --- a/rest/edi/load.php +++ b/rest/edi/load.php @@ -3,6 +3,8 @@ require_once (__DIR__.'/lib/method.php'); require_once (__DIR__.'/lib/message.php'); +use Vn\Lib\Type; + class Load extends Edi\Method { function ediRun ($db) @@ -105,19 +107,19 @@ class Load extends Edi\Method switch ($row['type']) { case 'INTEGER': - $type = TYPE_INTEGER; + $type = Type::INTEGER; break; case 'DOUBLE': - $type = TYPE_DOUBLE; + $type = Type::DOUBLE; break; case 'DATE': - $type = TYPE_DATE; + $type = Type::DATE; break; case 'TIME': - $type = TYPE_TIME; + $type = Type::TIME; break; default: - $type = TYPE_STRING; + $type = Type::STRING; } $value = $lin->getValue ( @@ -141,7 +143,7 @@ class Load extends Edi\Method if ($res) while ($row = $res->fetch_assoc ()) { - $value = $lin->getValue ('IMD', 2, TYPE_INTEGER, $row['feature']); + $value = $lin->getValue ('IMD', 2, Type::INTEGER, $row['feature']); $ediValues['s'.$row['presentation_order']] = $value; } else diff --git a/rest/tpv/tpv.php b/rest/tpv/tpv.php index 29c439c9..99ac4fb9 100755 --- a/rest/tpv/tpv.php +++ b/rest/tpv/tpv.php @@ -20,7 +20,7 @@ class Tpv $error = NULL; return $db->query ( - 'CALL transaction_confirm (#, #, #, #, #, #)', + 'CALL transactionConfirm (#, #, #, #, #, #)', [ $params['Ds_Amount'] ,$params['Ds_Order'] diff --git a/web/db-session-handler.php b/web/db-session-handler.php index fd479bab..06669caf 100755 --- a/web/db-session-handler.php +++ b/web/db-session-handler.php @@ -38,8 +38,9 @@ class DbSessionHandler implements \SessionHandlerInterface function read ($sessionId) { + $this->db->query ('DO GET_LOCK(#, 10)', [$sessionId]); $sessionData = $this->db->getValue ( - 'SELECT data FROM userSession WHERE ssid = #', [$sessionId]); + 'SELECT data FROM userSession WHERE ssid = # FOR UPDATE', [$sessionId]); return isset ($sessionData) ? $sessionData : ''; } @@ -51,6 +52,7 @@ class DbSessionHandler implements \SessionHandlerInterface ON DUPLICATE KEY UPDATE data = VALUES(data), lastUpdate = VALUES(lastUpdate)', [$sessionId, $sessionData]); + $this->db->query ('DO RELEASE_LOCK(#)', [$sessionId]); return TRUE; } } diff --git a/web/service.php b/web/service.php index c7e95ded..9685b772 100755 --- a/web/service.php +++ b/web/service.php @@ -48,7 +48,6 @@ abstract class Service $db = $this->db; ini_set ('session.cookie_secure', $this->isHttps ()); - ini_set ('session.use_only_cookies', FALSE); ini_set ('session.hash_function', 'sha256'); session_set_save_handler (new DbSessionHandler ($db)); @@ -81,7 +80,7 @@ abstract class Service // Registering the visit - if (!isset ($_COOKIE['PHPSESSID']) + if (isset ($_COOKIE['PHPSESSID']) || isset ($_SESSION['access']) || isset ($_SESSION['skipVisit'])) return;