Webgui: improve box, maintenance and date handling

This commit is contained in:
2026-09-16 06:12:50 +02:00
parent a76848e1da
commit 9b45fd3700
10 changed files with 116 additions and 31 deletions
+14 -12
View File
@@ -91,16 +91,18 @@ switch ($submit = form_get_action()) {
}
// for images check maximum size and scale down if needed
if (isset($_POST['noscale'])) {
$g_message->Add(_('Image has not been scaled down'));
} else {
// scale down if dimensions exceed limits
$img_maxx= $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=20")->fetchColumn();
$img_maxy= $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=21")->fetchColumn();
[$width, $height] = getimagesize($file_tmp);
$factor = min($img_maxx / $width, $img_maxy / $height);
if ($factor < 1) {
image_scale($file_tmp, $file_mimetype, $width, $height, $factor);
if (($file_mimetype == 'image/png') or ($file_mimetype == 'image/jpeg')) {
if (isset($_POST['noscale'])) {
$g_message->Add(_('Image has not been scaled down'));
} else {
// scale down if dimensions exceed limits
$img_maxx= $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=20")->fetchColumn();
$img_maxy= $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=21")->fetchColumn();
[$width, $height] = getimagesize($file_tmp);
$factor = min($img_maxx / $width, $img_maxy / $height);
if ($factor < 1) {
image_scale($file_tmp, $file_mimetype, $width, $height, $factor);
}
}
}
@@ -590,9 +592,9 @@ foreach ($sth->fetchAll() as $row) {
$eids = array();
$sql = "SELECT drid, reftype, refid, ename AS target "
. "FROM docref INNER JOIN equipment ON (docref.reftype='equipment' AND docref.refid=equipment.eid) "
. "WHERE docid=?";
. "WHERE docid=? AND vid=?";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);
$sth->execute([$id, $user->vid]);
foreach ($sth->fetchAll() as $row) {
$references[] = $row;
$eids[] = $row['refid'];