0
1
Fork 0

Traducciones actualizadas, errores solucionados, release candidate

This commit is contained in:
Juan Ferrer Toribio 2016-10-15 20:58:30 +02:00
parent 8ed2b115ad
commit 960325833c
42 changed files with 362 additions and 287 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.353-deb8) stable; urgency=low hedera-web (1.354-deb8) stable; urgency=low
* Initial Release. * Initial Release.

14
debian/cron.d vendored
View File

@ -1,8 +1,8 @@
MAILTO=webmaster MAILTO=webmaster
*/4 * * * * root php /usr/share/hedera-web/cli.php -m tpv/confirm-mail */4 * * * * root /usr/share/hedera-web/cli.php -m tpv/confirm-mail
*/2 * * * * root php /usr/share/hedera-web/cli.php -m edi/load */2 * * * * root /usr/share/hedera-web/cli.php -m edi/load
0 23 * * * root php /usr/share/hedera-web/cli.php -m edi/clean 0 23 * * * root /usr/share/hedera-web/cli.php -m edi/clean
0 5 * * * root php /usr/share/hedera-web/cli.php -m edi/update 0 5 * * * root /usr/share/hedera-web/cli.php -m edi/update
*/1 * * * * root php /usr/share/hedera-web/cli.php -m misc/mail */1 * * * * root /usr/share/hedera-web/cli.php -m misc/mail
0 5 * * * root php /usr/share/hedera-web/cli.php -m misc/exchange-rate 0 5 * * * root /usr/share/hedera-web/cli.php -m misc/exchange-rate
45 14 20 11 * root php /usr/share/hedera-web/cli.php -m misc/exchange-rate 45 14 20 11 * root /usr/share/hedera-web/cli.php -m misc/exchange-rate

3
debian/postinst vendored
View File

@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
cd /usr/share/hedera-web && npm install --production
a2enconf hedera-web a2enconf hedera-web
service apache2 reload service apache2 reload
service cron restart service cron restart
cd /usr/share/hedera-web && npm install --production

2
debian/postrm vendored
View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
rm -rf /usr/share/hedera-web/node_modules
service apache2 reload service apache2 reload
service cron restart service cron restart

View File

@ -47,7 +47,7 @@
<div class="box"> <div class="box">
<div class="form"> <div class="form">
<div class="form-group"> <div class="form-group">
<label for="user-name"><t>UserName</t></label> <label for="user-name"><t>Username</t></label>
<htk-text column="name" form="user-form"/> <htk-text column="name" form="user-form"/>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -55,7 +55,7 @@
<htk-entry column="email" form="user-form"></htk-entry> <htk-entry column="email" form="user-form"></htk-entry>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="mail"><t>ReceiveInvoicesByEmail</t></label> <label for="mail"><t>Receive invoices by email</t></label>
<htk-check column="mail" form="user-form"/> <htk-check column="mail" form="user-form"/>
</div> </div>
</div> </div>

View File

@ -41,13 +41,13 @@
<htk-repeater form-id="iter"> <htk-repeater form-id="iter">
<db-model property="model"> <db-model property="model">
<custom> <custom>
SELECT u.date_time, a.platform, a.browser, a.version, a.javascript, a.cookies SELECT u.stamp, a.platform, a.browser, a.version, a.javascript, a.cookies
FROM visit_user u FROM visitUser u
JOIN visit_access c ON u.access_id = c.id JOIN visitAccess c ON c.id = u.access
JOIN visit_agent a ON c.agent_id = a.id JOIN visitAgent a ON a.id = c.agent
WHERE u.user_id = #user WHERE u.user = #user
ORDER BY u.date_time DESC ORDER BY u.stamp DESC
LIMIT 8 LIMIT 8
</custom> </custom>
<sql-batch property="batch"> <sql-batch property="batch">
<custom> <custom>
@ -58,18 +58,14 @@
<custom> <custom>
<div class="item"> <div class="item">
<p> <p>
<htk-text form="iter" column="date_time" format="_%a, %e %b %Y at %T"/> <htk-text form="iter" column="stamp" format="_%a, %e %b %Y at %T"/>
</p> </p>
<p> <p>
<htk-text form="iter" column="platform"/> - <htk-text form="iter" column="platform"/> -
<htk-text form="iter" column="browser"/> <htk-text form="iter" column="browser"/>
<htk-text form="iter" column="version"/> <htk-text form="iter" column="version"/>
</p> </p>
<!-- <p> </div>
<htk-text form="iter" column="javascript"/>,
<htk-text form="iter" column="cookies"/>
</p>
--> </div>
</custom> </custom>
</htk-repeater> </htk-repeater>
</div> </div>

View File

@ -30,7 +30,7 @@ Hedera.Connections = new Class
{ {
this.hash.set ({ this.hash.set ({
'form': 'admin/access-log' 'form': 'admin/access-log'
,'user': form.get ('user_id') ,'user': form.get ('userId')
}); });
} }

View File

@ -22,16 +22,16 @@
<htk-repeater form-id="iter"> <htk-repeater form-id="iter">
<db-model property="model" id="sessions" on-status-changed="onModelStatusChange"> <db-model property="model" id="sessions" on-status-changed="onModelStatusChange">
<custom> <custom>
SELECT s.id, e.user_id, c.Cliente, e.date_time login, is_new, SELECT s.id, vu.user userId, vu.stamp, c.Cliente, s.lastUpdate,
s.lastUpdate last_activity, a.platform, a.browser, a.version, u.name user a.platform, a.browser, a.version, u.name user
FROM userSession s FROM userSession s
JOIN visit_user e ON s.userVisit = e.id JOIN visitUser vu ON vu.id = s.userVisit
JOIN visit_access c ON e.access_id = c.id JOIN visitAccess ac ON ac.id = vu.access
JOIN visit_agent a ON c.agent_id = a.id JOIN visitAgent a ON a.id = ac.agent
JOIN visit v ON a.visit_id = v.id JOIN visit v ON v.id = a.visit
JOIN account.user u ON e.user_id = u.id JOIN account.user u ON u.id = vu.user
JOIN vn2008.Clientes c ON e.user_id = c.Id_cliente JOIN vn2008.Clientes c ON c.Id_cliente = vu.user
ORDER BY last_activity DESC ORDER BY lastUpdate DESC
</custom> </custom>
</db-model> </db-model>
<custom> <custom>
@ -52,15 +52,15 @@
<htk-text form="iter" column="Cliente"/> <htk-text form="iter" column="Cliente"/>
</p> </p>
<p> <p>
<htk-text form="iter" column="login" format="%a, %T"/> - <htk-text form="iter" column="stamp" format="%a, %T"/> -
<htk-text form="iter" column="last_activity" format="%T"/> <htk-text form="iter" column="lastUpdate" format="%T"/>
</p> </p>
<p> <p>
<htk-text form="iter" column="platform"/> - <htk-text form="iter" column="platform"/> -
<htk-text form="iter" column="browser"/> <htk-text form="iter" column="browser"/>
<htk-text form="iter" column="version"/> <htk-text form="iter" column="version"/>
</p> </p>
</div> </div>
</custom> </custom>
</htk-repeater> </htk-repeater>
</div> </div>

View File

@ -42,7 +42,7 @@
<db-calc-sum <db-calc-sum
property="param" property="param"
model="visits" model="visits"
column-name="new_visits"/> column-name="newVisits"/>
</htk-text> </htk-text>
<t>news</t> <t>news</t>
</p> </p>
@ -52,16 +52,16 @@
<db-model property="model" id="visits"> <db-model property="model" id="visits">
<custom> <custom>
SELECT browser SELECT browser
,MIN(CAST(version AS DECIMAL(4,1))) min_version ,MIN(CAST(version AS DECIMAL(4,1))) minVersion
,MAX(CAST(version AS DECIMAL(4,1))) max_version ,MAX(CAST(version AS DECIMAL(4,1))) maxVersion
,MAX(e.date_time) last_visit ,MAX(c.stamp) lastVisit
,COUNT(DISTINCT c.id) visits ,COUNT(DISTINCT c.id) visits
,SUM(is_new) new_visits ,SUM(a.firstAccess = c.id AND v.firstAgent = a.id) newVisits
FROM visit_user e FROM visitUser e
JOIN visit_access c ON e.access_id = c.id JOIN visitAccess c ON e.access = c.id
JOIN visit_agent a ON c.agent_id = a.id JOIN visitAgent a ON c.agent = a.id
JOIN visit v ON a.visit_id = v.id JOIN visit v ON a.visit = v.id
WHERE e.date_time BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59') WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
GROUP BY browser ORDER BY visits DESC GROUP BY browser ORDER BY visits DESC
</custom> </custom>
<sql-batch property="batch"> <sql-batch property="batch">
@ -75,19 +75,19 @@
<div class="item"> <div class="item">
<p class="important"> <p class="important">
<htk-text form="iter" column="browser"/> <htk-text form="iter" column="browser"/>
<htk-text form="iter" column="min_version"/> - <htk-text form="iter" column="minVersion"/> -
<htk-text form="iter" column="max_version"/> <htk-text form="iter" column="maxVersion"/>
</p> </p>
<p> <p>
<htk-text form="iter" column="visits"/> <htk-text form="iter" column="visits"/>
<t>visits</t>, <t>visits</t>,
<htk-text form="iter" column="new_visits"/> <htk-text form="iter" column="newVisits"/>
<t>news</t> <t>news</t>
</p> </p>
<p> <p>
<htk-text form="iter" column="last_visit" format="_%a, %e %b %Y at %T"/> <htk-text form="iter" column="lastVisit" format="_%a, %e %b %Y at %T"/>
</p> </p>
</div> </div>
</custom> </custom>
</htk-repeater> </htk-repeater>
</div> </div>

View File

@ -138,6 +138,7 @@ module.exports = new Class
{ {
localStorage.removeItem ('hederaGuest'); localStorage.removeItem ('hederaGuest');
this._focusUserInput (); this._focusUserInput ();
throw error;
} }
} }
@ -175,10 +176,10 @@ module.exports = new Class
,_onPasswordRecovered: function (json, error) ,_onPasswordRecovered: function (json, error)
{ {
if (json) if (error)
Htk.Toast.showMessage (_('A mail has been sent wich you can recover your password')); throw error;
else
Htk.Toast.showError (error.message); Htk.Toast.showMessage (_('A mail has been sent wich you can recover your password'));
} }
}); });

View File

@ -17,7 +17,7 @@ module.exports = new Class
batch.addValue ('transaction', this.tpvOrder); batch.addValue ('transaction', this.tpvOrder);
batch.addValue ('status', this.tpvStatus); batch.addValue ('status', this.tpvStatus);
var query = 'CALL transaction_end (#transaction, #status)'; var query = 'CALL transactionEnd (#transaction, #status)';
this.conn.execQuery (query, null, batch); this.conn.execQuery (query, null, batch);
} }

View File

@ -79,32 +79,10 @@ module.exports = new Class
var th = document.createElement ('th'); var th = document.createElement ('th');
tr.appendChild (th); tr.appendChild (th);
var weekday = Vn.Date.AbrWDays [i%len]; var weekday = _(Vn.Date.AbrWDays [i%len]);
th.appendChild (document.createTextNode (weekday)); th.appendChild (document.createTextNode (weekday));
} }
/*
var tfoot = document.createElement ('tfoot');
table.appendChild (tfoot);
var tr = document.createElement ('tr');
tfoot.appendChild (tr);
var th = document.createElement ('th');
th.appendChild (document.createTextNode ('<'));
th.className = 'button';
th.addEventListener ('click', this.prevYearClicked.bind (this));
tr.appendChild (th);
var yearNode = document.createElement ('th');
yearNode.colSpan = 5;
tr.appendChild (yearNode);
var th = document.createElement ('th');
th.appendChild (document.createTextNode ('>'));
th.className = 'button';
th.addEventListener ('click', this.nextYearClicked.bind (this));
tr.appendChild (th);
*/
var tbody = document.createElement ('tbody'); var tbody = document.createElement ('tbody');
table.appendChild (tbody); table.appendChild (tbody);
@ -175,7 +153,7 @@ module.exports = new Class
,refresh: function () ,refresh: function ()
{ {
Vn.Node.setText (this.yearNode, this.year); Vn.Node.setText (this.yearNode, this.year);
Vn.Node.setText (this.monthNode, Vn.Date.Months[this.month]); Vn.Node.setText (this.monthNode, _(Vn.Date.Months[this.month]));
var day = 1; var day = 1;
var cellDate = new Date (this.year, this.month, 1); var cellDate = new Date (this.year, this.month, 1);
@ -292,16 +270,4 @@ module.exports = new Class
this.refresh (); this.refresh ();
} }
/*
,prevYearClicked: function ()
{
this.year--;
this.refresh ();
}
,nextYearClicked: function ()
{
this.year++;
this.refresh ();
}*/
}); });

View File

@ -382,7 +382,7 @@ td.cell-image .htk-image
left: 50%; left: 50%;
top: 4em; top: 4em;
width: 21em; width: 21em;
margin-left: -10.5em; margin-left: -11em;
text-align: center; text-align: center;
overflow: auto; overflow: auto;
max-height: 40em; max-height: 40em;

View File

@ -11,56 +11,56 @@ module.exports =
{ {
WDays: WDays:
[ [
_('Sunday') 'Sunday'
,_('Monday') ,'Monday'
,_('Tuesday') ,'Tuesday'
,_('Wednesday') ,'Wednesday'
,_('Thursday') ,'Thursday'
,_('Friday') ,'Friday'
,_('Saturday') ,'Saturday'
] ]
,AbrWDays: ,AbrWDays:
[ [
_('Su') 'Su'
,_('Mo') ,'Mo'
,_('Tu') ,'Tu'
,_('We') ,'We'
,_('Th') ,'Th'
,_('Fr') ,'Fr'
,_('Sa') ,'Sa'
] ]
,Months: ,Months:
[ [
_('January') 'January'
,_('February') ,'February'
,_('March') ,'March'
,_('April') ,'April'
,_('May') ,'May'
,_('June') ,'June'
,_('July') ,'July'
,_('August') ,'August'
,_('September') ,'September'
,_('October') ,'October'
,_('November') ,'November'
,_('December') ,'December'
] ]
,AbrMonths: ,AbrMonths:
[ [
_('Jan') 'Jan'
,_('Feb') ,'Feb'
,_('Mar') ,'Mar'
,_('Apr') ,'Apr'
,_('May') ,'May'
,_('Jun') ,'Jun'
,_('Jul') ,'Jul'
,_('Ago') ,'Ago'
,_('Sep') ,'Sep'
,_('Oct') ,'Oct'
,_('Nov') ,'Nov'
,_('Dec') ,'Dec'
] ]
,tokenD: _('%A, %B %e') ,tokenD: '%A, %B %e'
,regexp: new RegExp ('%[a-zA-Z]', 'g') ,regexp: new RegExp ('%[a-zA-Z]', 'g')
@ -86,10 +86,10 @@ module.exports =
case 'T': return d.toLocaleTimeString (); case 'T': return d.toLocaleTimeString ();
// Complete week day name // Complete week day name
case 'A': return this.WDays[d.getDay ()]; case 'A': return _(this.WDays[d.getDay ()]);
// Abreviated week day name // Abreviated week day name
case 'a': return this.AbrWDays[d.getDay ()]; case 'a': return _(this.AbrWDays[d.getDay ()]);
// Day of month with 2 digits // Day of month with 2 digits
case 'd': return this.pad (d.getDate ()); case 'd': return this.pad (d.getDate ());
@ -98,10 +98,10 @@ module.exports =
case 'e': return d.getDate (); case 'e': return d.getDate ();
// Complete month name // Complete month name
case 'B': return this.Months[d.getMonth ()]; case 'B': return _(this.Months[d.getMonth ()]);
// Abreviated month name // Abreviated month name
case 'b': return this.AbrMonths[d.getMonth ()]; case 'b': return _(this.AbrMonths[d.getMonth ()]);
// Month number with 2 digits // Month number with 2 digits
case 'm': return this.pad (d.getMonth () + 1); case 'm': return this.pad (d.getMonth () + 1);
@ -110,7 +110,7 @@ module.exports =
case 'Y': return d.getFullYear (); case 'Y': return d.getFullYear ();
// Complete date without year // Complete date without year
case 'D': return this.tokenD.replace (this.regexp, this.regexpFunc.bind (this, d)); case 'D': return _(this.tokenD).replace (this.regexp, this.regexpFunc.bind (this, d));
} }
return token; return token;

View File

@ -1,14 +1,12 @@
var vnLocaleStrings = {}; vnLocaleStrings = {};
/** /**
* Class to manage the internationalization. * Class to manage the internationalization.
**/ **/
module.exports = module.exports =
{ {
strings: {} language: null
,language: null
,init: function () ,init: function ()
{ {

View File

@ -1,19 +1,30 @@
{ {
"Configuration": "Configuració" "Configuration": "Configuració"
,"UserNumber": "N d'usuari" ,"Username": "Nom d'usuari"
,"UserName": "Nom d'usuari"
,"Password": "Contrasenya" ,"Password": "Contrasenya"
,"Email": "Correu electrònic" ,"Email": "Correu electrònic"
,"Billing": "Facturació" ,"Billing": "Facturació"
,"ReceiveInvoicesByEmail": "Rebre factures per correu electrònic" ,"Receive invoices by email": "Rebre factures per correu electrònic"
,"NewPassword": "Nova contrasenya" ,"Old password": "Contrasenya antiga"
,"RepeatPassword": "Repetir contrasenya" ,"New password": "Nova contrasenya"
,"Repeat password": "Repetir contrasenya"
,"Info": "Info"
,"Modify": "Modificar"
,"MustReloginIfChange": "Per canviar el nom d'usuari hauràs de tornar a iniciar sessió" ,"Password requirements": "Requisits de contrasenya"
,"PasswordsChanged": "Contrasenya modificada!" ,"characters long": "caràcters de longitud"
,"PasswordsDoesntMatch": "Les contrasenyes no coincideixen!" ,"alphabetic characters": "caràcters alfabètics"
,"capital letters": "majúscules"
,"digits": "dígits"
,"symbols": "símbols"
,"Password changed!": "Contrasenya modificada!"
,"Password doesn't meet the requirements": ""
,"Passwords doesn't match": "Les contrasenyes no coincideixen!"
,"Passwords empty": "Les contrasenyes en blanc"
,"Addresses": "Adreces" ,"Addresses": "Adreces"
,"Change password": "Canvia la contrasenya"
} }

View File

@ -7,10 +7,15 @@
,"Enter": "Entrar" ,"Enter": "Entrar"
,"Login mail": "clientes@verdnatura.es" ,"Login mail": "clientes@verdnatura.es"
,"Login phone": "+34 607 562 391" ,"Login phone": "+34 607 562 391"
,"Password forgotten? Push here": "¿Has oblidat la teva contrasenya?"
,"Yet you are not a customer?": "Encara no ets client?"
,"Sign up": "Registrarme"
,"You've been too idle": "Has estat massa temps inactiu i la sessió ha expirat" ,"You've been too idle": "Has estat massa temps inactiu i la sessió ha expirat"
,"Invalid login": "Usuari o contrasenya incorrectes, recorda que s'hi distingeix entre majúscula i minúscula" ,"Invalid login": "Usuari o contrasenya incorrectes, recorda que s'hi distingeix entre majúscula i minúscula"
,"There was an internal error": "S'ha produït un error intern" ,"There was an internal error": "S'ha produït un error intern"
,"Please write your user name": "Si us plau introdueix el teu nom d'usuari"
,"A mail has been sent wich you can recover your password": "T'hem enviat un correu on podràs recuperar la teva contrasenya"
,"Menu": "Menú" ,"Menu": "Menú"
,"Exit": "Sortir" ,"Exit": "Sortir"

View File

@ -1,19 +1,30 @@
{ {
"Configuration": "Configuration" "Configuration": "Configuration"
,"UserNumber": "User number" ,"Username": "Username"
,"UserName": "Username"
,"Password": "Password" ,"Password": "Password"
,"Email": "Email" ,"Email": "Email"
,"Billing": "Billing" ,"Billing": "Billing"
,"ReceiveInvoicesByEmail": "Receive invoices by email" ,"Receive invoices by email": "Receive invoices by email"
,"NewPassword": "New password" ,"Old password": "Old password"
,"RepeatPassword": "Repeat password" ,"New password": "New password"
,"Repeat password": "Repeat password"
,"Info": "Info"
,"Modify": "Modify"
,"Password requirements": "Password requirements"
,"characters long": "characters long"
,"alphabetic characters": "alphabetic characters"
,"capital letters": "capital letters"
,"digits": "digits"
,"symbols": "symbols. Ej: $%&."
,"MustReloginIfChange": "To change your username you must login again" ,"Password changed!": "Password changed!"
,"PasswordsChanged": "Password changed!" ,"Password doesn't meet the requirements": "Password doesn't meet the requirements, press info button for more details"
,"PasswordsDoesntMatch": "Passwords do not match!" ,"Passwords doesn't match": "Passwords doesn't match"
,"Passwords empty": "Passwords empty"
,"Addresses": "Addresses" ,"Addresses": "Addresses"
,"Change password": "Change password"
} }

View File

@ -7,10 +7,15 @@
,"Enter": "Enter" ,"Enter": "Enter"
,"Login mail": "clientes@verdnatura.es" ,"Login mail": "clientes@verdnatura.es"
,"Login phone": "+34 607 562 391" ,"Login phone": "+34 607 562 391"
,"Password forgotten? Push here": "Password forgotten? Push here"
,"Yet you are not a customer?": "Yet you are not a customer?"
,"Sign up": "Sign up"
,"You've been too idle": "You have been idle too long and your session has expired" ,"You've been too idle": "You have been idle too long and your session has expired"
,"Invalid login": "Username or password incorrect, remember that it is case-sensitive" ,"Invalid login": "Username or password incorrect, remember that it is case-sensitive"
,"There was an internal error": "There was an internal error" ,"There was an internal error": "There was an internal error"
,"Please write your user name": "Please write your user name"
,"A mail has been sent wich you can recover your password": "A mail has been sent wich you can recover your password"
,"Menu": "Menu" ,"Menu": "Menu"
,"Exit": "Exit" ,"Exit": "Exit"

View File

@ -0,0 +1,5 @@
{
"Recover password": "Recover password"
,"Press on the following link to change your password.":
"Press on the following link to change your password."
}

View File

@ -0,0 +1,28 @@
{
"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 schema name": "Invalid schema name"
,"Schema not exists": "Schema does not exist"
,"Unreferenced file": "The file is not referenced by the database"
,"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"
}

View File

@ -1,5 +0,0 @@
{
"InvalidAction": "Invalid action"
,"EmptyQuery": "Empty query"
}

View File

@ -1,28 +0,0 @@
{
"CantLockCache": "The cache could not be blocked"
,"BadFileFormat": "Unrecognized file format"
,"FileNotChoosed": "You have not selected any file"
,"PermissionDenied": "You are not allowed to upload the file"
,"FileUploadError": "Failed to upload the file, check that size is not too large"
,"FileSaveError": "Failed to save the file: %s"
,"FileSizeError": "The file must be no longer than %.2f MB"
,"BadFileName": "The file name must contain only lowercase letters, digits or the '_' character"
,"BadSchemaName": "Invalid schema name"
,"SchemaNotExists": "Schema does not exist"
,"UnreferencedFile": "The file is not referenced by the database"
,"ComError": "Error communicating with the server"
,"ImageOpenError": "Error opening the image file"
,"OperationDisabled": "Operation disabled for security"
,"ImageAdded": "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"
,"SyncComplete": "Synchronization complete"
}

4
locale/en/vn/web.json Executable file
View File

@ -0,0 +1,4 @@
{
"You don't have enough privileges": "You don't have enough privileges"
,"Missing parameters": "Missing parameters"
}

View File

@ -1,19 +1,30 @@
{ {
"Configuration": "Configuración" "Configuration": "Configuración"
,"UserNumber": "Nº usuario" ,"Username": "Nombre de usuario"
,"UserName": "Nombre de usuario"
,"Password": "Contraseña" ,"Password": "Contraseña"
,"Email": "Correo electrónico" ,"Email": "Correo electrónico"
,"Billing": "Facturación" ,"Billing": "Facturación"
,"ReceiveInvoicesByEmail": "Recibir facturas por correo electrónico" ,"Receive invoices by email": "Recibir facturas por correo electrónico"
,"NewPassword": "Nueva contraseña" ,"Old password": "Contaseña antigua"
,"RepeatPassword": "Repetir contraseña" ,"New password": "Nueva contraseña"
,"Repeat password": "Repetir contraseña"
,"Info": "Info"
,"Modify": "Modificar"
,"Password requirements": "Requisitos de constraseña"
,"characters long": "carácteres de longitud"
,"alphabetic characters": "carácteres alfabéticos"
,"capital letters": "letras mayúsculas"
,"digits": "dígitos"
,"symbols": "símbolos. Ej: $%&."
,"MustReloginIfChange": "Para cambiar tu nombre de usuario deberás volver a iniciar sesión" ,"Password changed!": "¡Contraseña modificada!"
,"PasswordsChanged": "¡Contraseña modificada!" ,"Password doesn't meet the requirements": "La nueva contraseña no reune los requisitos de seguridad necesarios, pulsa en info para más detalle"
,"PasswordsDoesntMatch": "¡Las contraseñas no coinciden!" ,"Passwords doesn't match": "¡Las contraseñas no coinciden!"
,"Passwords empty": "Contraseña vacía"
,"Addresses": "Direcciones" ,"Addresses": "Direcciones"
,"Change password": "Cambiar contraseña"
} }

View File

@ -7,10 +7,15 @@
,"Enter": "Entrar" ,"Enter": "Entrar"
,"Login mail": "clientes@verdnatura.es" ,"Login mail": "clientes@verdnatura.es"
,"Login phone": "+34 963 242 100" ,"Login phone": "+34 963 242 100"
,"Password forgotten? Push here": "¿Has olvidado tu contraseña?"
,"Yet you are not a customer?": "¿Todavía no eres cliente?"
,"Sign up": "Registrarme"
,"You've been too idle": "Has estado demasiado tiempo inactivo y la sesión ha expirado" ,"You've been too idle": "Has estado demasiado tiempo inactivo y la sesión ha expirado"
,"Invalid login": "Usuario o contraseña incorrectos, recuerda que se hace distinción entre mayúsculas y minúsculas" ,"Invalid login": "Usuario o contraseña incorrectos, recuerda que se hace distinción entre mayúsculas y minúsculas"
,"There was an internal error": "Se ha producido un error interno" ,"There was an internal error": "Se ha producido un error interno"
,"Please write your user name": "Por favor escribe tu nombre de usuario"
,"A mail has been sent wich you can recover your password": "Te hemos enviado un correo donde podrás recuperar tu contraseña"
,"Menu": "Menú" ,"Menu": "Menú"
,"Exit": "Salir" ,"Exit": "Salir"

View File

@ -0,0 +1,5 @@
{
"Recover password": "Restaurar contraseña"
,"Press on the following link to change your password.":
"Presiona en el siguiente link para cambiar tu contraseña."
}

View File

@ -0,0 +1,28 @@
{
"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 schema name": "Nombre de esquema no válido"
,"Schema not exists": "El esquema no existe"
,"Unreferenced file": "El archivo no está referenciado por la base de datos"
,"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"
}

View File

@ -1,5 +0,0 @@
{
"InvalidAction": "Acción inválida"
,"EmptyQuery": "Consulta vacía"
}

View File

@ -1,28 +0,0 @@
{
"CantLockCache": "La caché no pudo ser bloqueada"
,"BadFileFormat": "Formato de archivo no reconocido"
,"FileNotChoosed": "No has seleccionado ningún archivo"
,"PermissionDenied": "No tienes permiso para subir el fichero"
,"FileUploadError": "Error al subir el fichero, comprueba que su tamaño no sea demasiado grande"
,"FileSaveError": "Error al guardar el fichero: %s"
,"FileSizeError": "El fichero no debe ocupar más de %.2f MB"
,"BadFileName": "El nombre del archivo solo debe contener letras minúsculas, dígitos o el carácter '_'"
,"BadSchemaName": "Nombre de esquema no válido"
,"SchemaNotExists": "El esquema no existe"
,"UnreferencedFile": "El archivo no está referenciado por la base de datos"
,"ComError": "Error en la comunicación con el servidor"
,"ImageOpenError": "Error al abrir el archivo de imagen"
,"OperationDisabled": "Operación deshabilitada por seguridad"
,"ImageAdded": "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"
,"SyncComplete": "Sincronización completada"
}

4
locale/es/vn/web.json Executable file
View File

@ -0,0 +1,4 @@
{
"You don't have enough privileges": "No tienes suficientes privilegios"
,"Missing parameters": "Faltan parámetros"
}

View File

@ -1,19 +1,30 @@
{ {
"Configuration": "Configuration" "Configuration": "Configuration"
,"UserNumber": "Numéro utilisateur" ,"Username": "Utilisateur"
,"UserName": "Utilisateur"
,"Password": "Mot de passe" ,"Password": "Mot de passe"
,"Email": "Courriel" ,"Email": "Courriel"
,"Billing": "Facturation" ,"Billing": "Facturation"
,"ReceiveInvoicesByEmail": "Recevoir des factures par e-mail" ,"Receive invoices by email": "Recevoir des factures par e-mail"
,"NewPassword": "Nouveau mot de passe" ,"Old password": "Ancien mot de passe"
,"RepeatPassword": "Répéter le mot de passe" ,"New password": "Nouveau mot de passe"
,"Repeat password": "Répéter le mot de passe"
,"Info": "Info"
,"Modify": "Modifier"
,"MustReloginIfChange": "Vous devrez vous identifier à nouveau pour changer votre nom d'utilisateur" ,"Password requirements": "Mot de passe exigences"
,"PasswordsChanged": "Mot de passe modifié!" ,"characters long": "Longs caractères"
,"PasswordsDoesntMatch": "Les mots de passe ne correspondent pas!" ,"alphabetic characters": "les caractères alphabétiques"
,"capital letters": "lettres majuscules"
,"digits": "chiffres"
,"symbols": "symboles. Ej: $%&."
,"Password changed!": "Mot de passe modifié!"
,"Password doesn't meet the requirements": ""
,"Passwords doesn't match": "Les mots de passe ne correspondent pas!"
,"Passwords empty": ""
,"Addresses": "Adresses" ,"Addresses": "Adresses"
,"Change password": "Changer le mot de passe"
} }

View File

@ -7,10 +7,15 @@
,"Enter": "Entrer" ,"Enter": "Entrer"
,"Login mail": "ruben@verdnatura.es" ,"Login mail": "ruben@verdnatura.es"
,"Login phone": "+33 781 533 900" ,"Login phone": "+33 781 533 900"
,"Password forgotten? Push here": "as tu oublié ton mot de passe?"
,"Yet you are not a customer?": "Êtes-vous Pas encore client?"
,"Sign up": "Inscription"
,"You've been too idle": "Il a eu le temps de trop paresseux et votre session a expiré" ,"You've been too idle": "Il a eu le temps de trop paresseux et votre session a expiré"
,"Invalid login": "Utilisateur ou mot de passe incorrect, n'oubliez pas de distinction entre majuscules et minuscules" ,"Invalid login": "Utilisateur ou mot de passe incorrect, n'oubliez pas de distinction entre majuscules et minuscules"
,"There was an internal error": "Il ya eu une erreur interne" ,"There was an internal error": "Il ya eu une erreur interne"
,"Please write your user name": "S'il vous plaît entrer votre nom d'utilisateur"
,"A mail has been sent wich you can recover your password": "Nous avons envoyé un e-mail où vous pouvez récupérer votre mot de passe"
,"Menu": "Menu" ,"Menu": "Menu"
,"Exit": "Laisser" ,"Exit": "Laisser"

View File

@ -1,19 +1,30 @@
{ {
"Configuration": "ТОХИРГОО" "Configuration": "Configuration"
,"UserNumber": "ХЭРЭГЛЭГЧИЙН ТОО:" ,"Username": "Username"
,"UserName": "НЭВТРЭХ НЭР" ,"Password": "Password"
,"Password": "НУУЦ ҮГ" ,"Email": "Email"
,"Email": "И-МЭЙЛ" ,"Billing": "Billing"
,"Billing": "НЭХЭМЖЛЭЛ" ,"Receive invoices by email": "Receive invoices by email"
,"ReceiveInvoicesByEmail": "И-МЭЙЛ НЭХЭМЖЛЭЛ"
,"NewPassword": "ШИНЭ НУУЦ ҮГ" ,"Old password": "Old password"
,"RepeatPassword": "НУУЦ ҮГ ДАВТАХ" ,"New password": "New password"
,"Repeat password": "Repeat password"
,"Info": "Info"
,"Modify": "Modify"
,"Password requirements": "Password requirements"
,"characters long": "characters long"
,"alphabetic characters": "alphabetic characters"
,"capital letters": "capital letters"
,"digits": "digits"
,"symbols": "symbols. Ej: $%&."
,"MustReloginIfChange": "To change your username you must login again" ,"Password changed!": "Password changed!"
,"PasswordsChanged": "Password changed!" ,"Password doesn't meet the requirements": "Password doesn't meet the requirements, press info button for more details"
,"PasswordsDoesntMatch": "Passwords do not match!" ,"Passwords doesn't match": "Passwords doesn't match"
,"Passwords empty": "Passwords empty"
,"Addresses": "Addresses" ,"Addresses": "Addresses"
,"Change password": "Change password"
} }

View File

@ -7,10 +7,15 @@
,"Enter": "энд бичнэ үү" ,"Enter": "энд бичнэ үү"
,"Login mail": "clientes@verdnatura.es" ,"Login mail": "clientes@verdnatura.es"
,"Login phone": "+34 607 562 391" ,"Login phone": "+34 607 562 391"
,"Password forgotten? Push here": "Нууц үг мартсан? энд түлхэх"
,"Yet you are not a customer?": "Гэсэн хэдий ч та хэрэглэгчийн биш гэж үү?"
,"Sign up": "бүртгүүлэх"
,"You've been too idle": "Та нар ч бас зогссон байсан, чуулган хугацаа дууссан байна" ,"You've been too idle": "Та нар ч бас зогссон байсан, чуулган хугацаа дууссан байна"
,"Invalid login": "Хэрэглэгчийн нэр эсвэл нууц үг буруу, Тэр хэргийг мэдрэмтгий гэдгийг санаарай" ,"Invalid login": "Хэрэглэгчийн нэр эсвэл нууц үг буруу, Тэр хэргийг мэдрэмтгий гэдгийг санаарай"
,"There was an internal error": "Дотоод алдаа гарлаа" ,"There was an internal error": "Дотоод алдаа гарлаа"
,"Please write your user name": "Хэрэглэгчийн нэрээ бичнэ үү"
,"A mail has been sent wich you can recover your password": "Мэйл та нууц үгээ сэргээх боломжтой А байна илгээсэн"
,"Menu": "Цэс" ,"Menu": "Цэс"
,"Exit": "гарах" ,"Exit": "гарах"

View File

@ -1,19 +1,30 @@
{ {
"Configuration": "Configuração" "Configuration": "Configuração"
,"UserNumber": "Nº usuario" ,"Username": "Nome de usuario"
,"UserName": "Nome de usuario"
,"Password": "Palavra-Passe" ,"Password": "Palavra-Passe"
,"Email": "E-Mail" ,"Email": "E-Mail"
,"Billing": "Facturação" ,"Billing": "Facturação"
,"ReceiveInvoicesByEmail": "Receber facturas por e-mail" ,"Receive invoices by email": "Receber facturas por e-mail"
,"NewPassword": "Nova Palavra-Passe" ,"Old password": "Palavra-Passe antiga"
,"RepeatPassword": "Repetir Palavra-Passe" ,"New password": "Nova Palavra-Passe"
,"Repeat password": "Repetir Palavra-Passe"
,"Info": "Info"
,"Modify": "Modificar"
,"Password requirements": "Requisitos de Palavra-Passe"
,"characters long": "caracteres"
,"alphabetic characters": "caracteres alfabéticos"
,"capital letters": "letras maiúsculas"
,"digits": "dígitos"
,"symbols": "símbolos. Ej: $%&."
,"MustReloginIfChange": "Para modificar seu nome de usario deves voltar a inicar sessão" ,"Password changed!": "Palavra-Passe Modificada!"
,"PasswordsChanged": "Palavra-Passe Modificada!" ,"Password doesn't meet the requirements": "Palavra-Passe não atende aos requisitos"
,"PasswordsDoesntMatch": "As Palavras-Passe não coincidem!" ,"Passwords doesn't match": "As Palavras-Passe não coincidem!"
,"Passwords empty": "Palavra-Passe vazia"
,"Addresses": "Endereços" ,"Addresses": "Endereços"
,"Change password": "Mudar Palavra-Passe"
} }

View File

@ -7,10 +7,15 @@
,"Enter": "Entrar" ,"Enter": "Entrar"
,"Login mail": "clientes@verdnatura.es" ,"Login mail": "clientes@verdnatura.es"
,"Login phone": "+34 963 242 100" ,"Login phone": "+34 963 242 100"
,"Password forgotten? Push here": "Contra-senha? empurre aqui"
,"Yet you are not a customer?": "No entanto, você não é um cliente?"
,"Sign up": "Inscrever-se"
,"You've been too idle": "Muito tempo de inatividade, a sessão foi finalizada" ,"You've been too idle": "Muito tempo de inatividade, a sessão foi finalizada"
,"Invalid login": "Usuário ou Palavra-Passe incorreto, lembre-se de diferenciar maiusculas e minusculas" ,"Invalid login": "Usuário ou Palavra-Passe incorreto, lembre-se de diferenciar maiusculas e minusculas"
,"There was an internal error": "Houve um erro interno" ,"There was an internal error": "Houve um erro interno"
,"Please write your user name": "Por favor, escreva seu nome de usuário"
,"A mail has been sent wich you can recover your password": "Um e-mail foi enviado a qual poderá recuperar sua senha"
,"Menu": "Menú" ,"Menu": "Menú"
,"Exit": "Sair" ,"Exit": "Sair"

View File

@ -19,13 +19,13 @@ class Upload extends Vn\Web\JsonRequest
$regexp = '/[^a-z0-9_]/'; $regexp = '/[^a-z0-9_]/';
if (empty ($_REQUEST['schema']) || preg_match ($regexp, $_REQUEST['schema']) !== 0) if (empty ($_REQUEST['schema']) || preg_match ($regexp, $_REQUEST['schema']) !== 0)
throw new UserException (s('BadSchemaName'), 'badSchemaName'); throw new UserException (s('Bad schema name'));
$schema = $_REQUEST['schema']; $schema = $_REQUEST['schema'];
$info = $util->loadInfo ($schema); $info = $util->loadInfo ($schema);
if (!$info) if (!$info)
throw new UserException (s('SchemaNotExists'), 'schemaNotExists'); throw new UserException (s('Schema not exists'));
// Checks file name and identifier. // Checks file name and identifier.
@ -50,7 +50,7 @@ class Upload extends Vn\Web\JsonRequest
} }
if (empty ($_REQUEST['name']) || preg_match ($regexp, $_REQUEST['name']) !== 0) if (empty ($_REQUEST['name']) || preg_match ($regexp, $_REQUEST['name']) !== 0)
throw new UserException (s('BadFileName'), 'badFileName'); throw new UserException (s('Bad file name'));
// Checks permissions. // Checks permissions.
@ -78,12 +78,12 @@ class Upload extends Vn\Web\JsonRequest
]; ];
if (!$db->query ($query, $params)) if (!$db->query ($query, $params))
throw new UserException (s('PermissionDenied'), 'permissionDenied'); throw new UserException (s('Permission denied'));
// Checks for file errors. // Checks for file errors.
if (empty ($_FILES['image']['name'])) if (empty ($_FILES['image']['name']))
throw new UserException (s('FileNotChoosed'), 'fileNotChoosed'); throw new UserException (s('File not choosed'));
if ($_FILES['image']['error'] != 0) if ($_FILES['image']['error'] != 0)
{ {
@ -115,13 +115,13 @@ class Upload extends Vn\Web\JsonRequest
break; break;
} }
throw new Lib\Exception (s($message), 'uploadError'); throw new Lib\Exception (s($message));
} }
$maxSize = $db->getValue ('SELECT max_size FROM image_config'); $maxSize = $db->getValue ('SELECT max_size FROM image_config');
if ($_FILES['image']['size'] > $maxSize * 1048576) if ($_FILES['image']['size'] > $maxSize * 1048576)
throw new UserException (sprintf (s('FileSizeError'), $maxSize), 'fileSizeError'); throw new UserException (sprintf (s('File size error'), $maxSize));
// Resizes and saves the image. // Resizes and saves the image.

View File

@ -12,23 +12,23 @@ class Transaction extends Vn\Web\JsonRequest
$amount = (int) $_REQUEST['amount']; $amount = (int) $_REQUEST['amount'];
$companyId = empty ($_REQUEST['company']) ? NULL : $_REQUEST['company']; $companyId = empty ($_REQUEST['company']) ? NULL : $_REQUEST['company'];
$row = $db->getRow ('CALL transaction_start_sha256 (#, #)', $row = $db->getRow ('CALL transactionStart (#, #)',
[$amount, $companyId]); [$amount, $companyId]);
if (!isset ($row)) if (!isset ($row))
throw new Exception ('Transaction error'); throw new Exception ('Transaction error');
$transactionId = str_pad ($row['transaction_id'], 12, '0', STR_PAD_LEFT); $transactionId = str_pad ($row['transactionId'], 12, '0', STR_PAD_LEFT);
$urlOk = empty ($_REQUEST['urlOk']) ? '' : sprintf ($_REQUEST['urlOk'], $transactionId); $urlOk = empty ($_REQUEST['urlOk']) ? '' : sprintf ($_REQUEST['urlOk'], $transactionId);
$urlKo = empty ($_REQUEST['urlKo']) ? '' : sprintf ($_REQUEST['urlKo'], $transactionId); $urlKo = empty ($_REQUEST['urlKo']) ? '' : sprintf ($_REQUEST['urlKo'], $transactionId);
$merchantUrl = $row['merchant_url'] ? $row['merchant_url'] : ''; $merchantUrl = $row['merchantUrl'] ? $row['merchantUrl'] : '';
$params = [ $params = [
'Ds_Merchant_Amount' => $amount 'Ds_Merchant_Amount' => $amount
,'Ds_Merchant_Order' => $transactionId ,'Ds_Merchant_Order' => $transactionId
,'Ds_Merchant_MerchantCode' => $row['merchant'] ,'Ds_Merchant_MerchantCode' => $row['merchant']
,'Ds_Merchant_Currency' => $row['currency'] ,'Ds_Merchant_Currency' => $row['currency']
,'Ds_Merchant_TransactionType' => $row['transaction_type'] ,'Ds_Merchant_TransactionType' => $row['transactionType']
,'Ds_Merchant_Terminal' => $row['terminal'] ,'Ds_Merchant_Terminal' => $row['terminal']
,'Ds_Merchant_MerchantURL' => $merchantUrl ,'Ds_Merchant_MerchantURL' => $merchantUrl
,'Ds_Merchant_UrlOK' => $urlOk ,'Ds_Merchant_UrlOK' => $urlOk
@ -37,7 +37,7 @@ class Transaction extends Vn\Web\JsonRequest
$encodedParams = base64_encode (json_encode ($params)); $encodedParams = base64_encode (json_encode ($params));
$key = base64_decode ($row['secret_key']); $key = base64_decode ($row['secretKey']);
$bytes = [0, 0, 0, 0, 0, 0, 0, 0]; $bytes = [0, 0, 0, 0, 0, 0, 0, 0];
$iv = implode (array_map ('chr', $bytes)); $iv = implode (array_map ('chr', $bytes));

View File

@ -38,7 +38,6 @@ class DbSessionHandler implements \SessionHandlerInterface
function read ($sessionId) function read ($sessionId)
{ {
//$db->query ('DO GET_LOCK(#, 30)', [$sessionId]);
$sessionData = $this->db->getValue ( $sessionData = $this->db->getValue (
'SELECT data FROM userSession WHERE ssid = #', [$sessionId]); 'SELECT data FROM userSession WHERE ssid = #', [$sessionId]);
return isset ($sessionData) ? $sessionData : ''; return isset ($sessionData) ? $sessionData : '';
@ -46,9 +45,12 @@ class DbSessionHandler implements \SessionHandlerInterface
function write ($sessionId, $sessionData) function write ($sessionId, $sessionData)
{ {
$this->db->query ('REPLACE INTO userSession SET ssid = #, data = #', $this->db->query (
'INSERT INTO userSession SET
ssid = #, data = #, lastUpdate = NOW()
ON DUPLICATE KEY UPDATE
data = VALUES(data), lastUpdate = VALUES(lastUpdate)',
[$sessionId, $sessionData]); [$sessionId, $sessionData]);
//$db->query ('DO RELEASE_LOCK(#)', [$sessionId]);
return TRUE; return TRUE;
} }
} }

View File

@ -15,6 +15,8 @@ class Report
extract ($params); extract ($params);
\Vn\Lib\Locale::addPath ("reports/$reportName");
ob_start (); ob_start ();
include __DIR__.'/report.html.php'; include __DIR__.'/report.html.php';
$this->html = ob_get_contents (); $this->html = ob_get_contents ();

View File

@ -77,6 +77,7 @@ abstract class Service
$_SESSION['lang'] = NULL; $_SESSION['lang'] = NULL;
Locale::set ($_SESSION['lang']); Locale::set ($_SESSION['lang']);
Locale::addPath ('vn/web');
// Registering the visit // Registering the visit
@ -134,7 +135,7 @@ abstract class Service
function login () function login ()
{ {
$db = $this->db; $db = $this->db;
$user = NULL; $anonymousUser = FALSE;
if (isset ($_POST['user']) && isset ($_POST['password'])) if (isset ($_POST['user']) && isset ($_POST['password']))
{ {
@ -175,24 +176,29 @@ abstract class Service
); );
} }
else else
{
$user = $db->getValue ('SELECT guest_user FROM config'); $user = $db->getValue ('SELECT guest_user FROM config');
$anonymousUser = TRUE;
}
$db->query ('CALL account.userLoginWithName (#)', [$user]); $db->query ('CALL account.userLoginWithName (#)', [$user]);
} }
$userChanged = !$anonymousUser
&& (empty ($_SESSION['user']) || $_SESSION['user'] != $user);
$_SESSION['user'] = $user; $_SESSION['user'] = $user;
// Registering the user access // Registering the user access
if (isset ($_SESSION['access']) if (isset ($_SESSION['access']) && $userChanged)
&& !isset ($_SESSION['visitUser']))
{ {
$_SESSION['visitUser'] = TRUE;
$db->query ( $db->query (
'CALL visitUserNew (#, #)', 'CALL visitUserNew (#, #)',
[$_SESSION['access'], session_id ()] [$_SESSION['access'], session_id ()]
); );
error_log ($db->render ('CALL visitUserNew (#, #)',
[$_SESSION['access'], session_id ()]));
} }
} }
@ -201,7 +207,6 @@ abstract class Service
**/ **/
function logout () function logout ()
{ {
unset ($_SESSION['visitUser']);
unset ($_SESSION['user']); unset ($_SESSION['user']);
} }
@ -266,7 +271,7 @@ abstract class Service
[$_REQUEST['method']]); [$_REQUEST['method']]);
if (!$isAuthorized) if (!$isAuthorized)
throw new UserException ('You don\'t have enough privileges'); throw new UserException (s('You don\'t have enough privileges'));
$methodDb = $db; $methodDb = $db;
} }
@ -275,6 +280,8 @@ abstract class Service
if ($method::PARAMS !== NULL && !$method->checkParams ($_REQUEST, $method::PARAMS)) if ($method::PARAMS !== NULL && !$method->checkParams ($_REQUEST, $method::PARAMS))
throw new UserException (s('Missing parameters')); throw new UserException (s('Missing parameters'));
Locale::addPath ("rest/{$_REQUEST['method']}");
$res = $method->run ($methodDb); $res = $method->run ($methodDb);
$db->query ('CALL account.userLogout ()'); $db->query ('CALL account.userLogout ()');