forked from verdnatura/hedera-web
Merge branch 'master' into test
This commit is contained in:
commit
572d4b7b83
|
@ -1,4 +1,4 @@
|
|||
hedera-web (23.6.13) stable; urgency=low
|
||||
hedera-web (23.6.14) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hedera-web",
|
||||
"version": "23.6.13",
|
||||
"version": "23.6.14",
|
||||
"description": "Verdnatura web page",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
|
|
|
@ -39,31 +39,31 @@ class Upload extends Vn\Web\JsonRequest {
|
|||
|
||||
if ($_FILES['image']['error'] != 0) {
|
||||
switch ($_FILES['image']['error']) {
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
$message = 'ErrIniSize';
|
||||
break;
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
$message = 'ErrFormSize';
|
||||
break;
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
$message = 'ErrPartial';
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
$message = 'ErrNoFile';
|
||||
break;
|
||||
case UPLOAD_ERR_NO_TMP_DIR:
|
||||
$message = 'ErrNoTmpDir';
|
||||
break;
|
||||
case UPLOAD_ERR_CANT_WRITE:
|
||||
$message = 'ErrCantWrite';
|
||||
break;
|
||||
case UPLOAD_ERR_EXTENSION:
|
||||
$message = 'ErrExtension';
|
||||
break;
|
||||
default:
|
||||
$message = 'ErrDefault';
|
||||
break;
|
||||
}
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
$message = 'ErrIniSize';
|
||||
break;
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
$message = 'ErrFormSize';
|
||||
break;
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
$message = 'ErrPartial';
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
$message = 'ErrNoFile';
|
||||
break;
|
||||
case UPLOAD_ERR_NO_TMP_DIR:
|
||||
$message = 'ErrNoTmpDir';
|
||||
break;
|
||||
case UPLOAD_ERR_CANT_WRITE:
|
||||
$message = 'ErrCantWrite';
|
||||
break;
|
||||
case UPLOAD_ERR_EXTENSION:
|
||||
$message = 'ErrExtension';
|
||||
break;
|
||||
default:
|
||||
$message = 'ErrDefault';
|
||||
break;
|
||||
}
|
||||
|
||||
throw new Lib\Exception(s($message));
|
||||
}
|
||||
|
@ -101,12 +101,6 @@ class Upload extends Vn\Web\JsonRequest {
|
|||
$symbolicSrc = "../full/$fileName";
|
||||
|
||||
$image = Image::create($tmpName);
|
||||
Image::resizeSave($image, $fullFile, $info['maxHeight'], $info['maxWidth']);
|
||||
|
||||
foreach ($info['sizes'] as $size => $i) {
|
||||
$dstFile = "$collectionPath/$size/$fileName";
|
||||
Image::resizeSave($image, $dstFile, $i['height'], $i['width'], $i['crop'], $symbolicSrc);
|
||||
}
|
||||
|
||||
$query =
|
||||
"INSERT INTO `image`
|
||||
|
@ -121,6 +115,13 @@ class Upload extends Vn\Web\JsonRequest {
|
|||
'name' => $name
|
||||
]);
|
||||
|
||||
Image::resizeSave($image, $fullFile, $info['maxHeight'], $info['maxWidth']);
|
||||
|
||||
foreach ($info['sizes'] as $size => $i) {
|
||||
$dstFile = "$collectionPath/$size/$fileName";
|
||||
Image::resizeSave($image, $dstFile, $i['height'], $i['width'], $i['crop'], $symbolicSrc);
|
||||
}
|
||||
|
||||
imagedestroy($image);
|
||||
unlink($tmpName);
|
||||
return TRUE;
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Account {
|
||||
static function trySync($db, $userName, $password = NULL) {
|
||||
$sync = $db->getValue(
|
||||
'SELECT COUNT(*) > 0 FROM account.userSync WHERE name = #',
|
||||
[$userName]
|
||||
);
|
||||
|
||||
if ($sync)
|
||||
self::sync($db, $userName, $password);
|
||||
}
|
||||
|
||||
static function sync($db, $userName, $password = NULL) {
|
||||
$bcryptPassword = password_hash($password, PASSWORD_BCRYPT);
|
||||
|
||||
$userId = $db->getValue(
|
||||
'SELECT id FROM account.user WHERE `name` = #',
|
||||
[$userName]
|
||||
);
|
||||
$db->query(
|
||||
'UPDATE account.user SET
|
||||
bcryptPassword = #
|
||||
WHERE id = #',
|
||||
[$bcryptPassword, $userId]
|
||||
);
|
||||
|
||||
$hasAccount = $db->getValue(
|
||||
'SELECT COUNT(*) > 0
|
||||
FROM account.user u
|
||||
JOIN account.account a ON u.id = a.id
|
||||
WHERE u.name = #',
|
||||
[$userName]
|
||||
);
|
||||
if (!$hasAccount)
|
||||
$db->query('DELETE FROM account.userSync WHERE name = #',
|
||||
[$userName]
|
||||
);
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ class RestService extends Service {
|
|||
if ($e->getCode() == 1644) {
|
||||
$eMessage = $e->getMessage();
|
||||
$tMessage = $db->getValue(
|
||||
'SELECT `description` FROM `message` WHERE `code` = #',
|
||||
'SELECT `description` FROM `messageL10n` WHERE `code` = #',
|
||||
[$eMessage]
|
||||
);
|
||||
if (!$tMessage) $tMessage = $eMessage;
|
||||
|
|
Loading…
Reference in New Issue