Aumento tempo alerta toast.php

This commit is contained in:
HalbeBruno
2026-03-12 15:50:18 -03:00
parent fa96ec4aea
commit a58805a7dc
2 changed files with 28 additions and 2 deletions

View File

@@ -72,12 +72,38 @@ class OrderController
public function store()
{
// Detect post_max_size overflow
if (empty($_POST) && empty($_FILES) && isset($_SERVER['CONTENT_LENGTH']) && (int)$_SERVER['CONTENT_LENGTH'] > 0) {
$_SESSION['flash_error'] = "O tamanho total dos arquivos enviados excede o limite permitido pelo servidor.";
View::redirect('/admin/orders/create');
return;
}
if (!isset($_FILES['csv_file']) || $_FILES['csv_file']['error'] !== UPLOAD_ERR_OK) {
$_SESSION['flash_error'] = "Erro no upload do arquivo CSV.";
View::redirect('/admin/orders/create');
return;
}
// Validate attachments before inserting the order
if (isset($_FILES['attachments']) && !empty($_FILES['attachments']['name'][0])) {
$attachments = $_FILES['attachments'];
$count = count($attachments['name']);
for ($i = 0; $i < $count; $i++) {
$error = $attachments['error'][$i];
if ($error !== UPLOAD_ERR_OK && $error !== UPLOAD_ERR_NO_FILE) {
$fileName = $attachments['name'][$i];
if ($error === UPLOAD_ERR_INI_SIZE || $error === UPLOAD_ERR_FORM_SIZE) {
$_SESSION['flash_error'] = "O anexo '{$fileName}' excede o tamanho máximo permitido.";
} else {
$_SESSION['flash_error'] = "Erro no upload do anexo '{$fileName}': código {$error}.";
}
View::redirect('/admin/orders/create');
return;
}
}
}
$title = $_POST['title'];
$type = $_POST['type'];
$content = \App\Utils\TextFormatter::normalizeLineBreaks($_POST['content']);