Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 247f154cc8 | |||
| e683a81f46 | |||
| cf7068d7c6 |
+2
-2
@@ -3,7 +3,7 @@
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
|
||||
/vendor
|
||||
/.idea
|
||||
/.fleet
|
||||
/.vscode
|
||||
@@ -12,7 +12,7 @@ Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
.env
|
||||
.phpunit.result.cache
|
||||
.php_cs.cache
|
||||
/documentation
|
||||
|
||||
@@ -44,7 +44,7 @@ class LoginController extends Controller
|
||||
$throttles = (bool) setting('throttle_enabled');
|
||||
|
||||
//Redirect URL that can be passed as hidden field.
|
||||
$to = $request->has('to') ? '?to='.$request->get('to') : '';
|
||||
$to = $request->has('to') ? '?to=' . $request->get('to') : '';
|
||||
|
||||
if ($throttles && $this->hasTooManyLoginAttempts($request)) {
|
||||
return $this->sendLockoutResponse($request);
|
||||
@@ -60,20 +60,20 @@ class LoginController extends Controller
|
||||
$this->incrementLoginAttempts($request);
|
||||
}
|
||||
|
||||
return redirect()->to('login'.$to)
|
||||
return redirect()->to('login' . $to)
|
||||
->withErrors(trans('auth.failed'));
|
||||
}
|
||||
|
||||
$user = Auth::getProvider()->retrieveByCredentials($credentials);
|
||||
|
||||
if ($user->isBanned()) {
|
||||
return redirect()->to('login'.$to)
|
||||
return redirect()->to('login' . $to)
|
||||
->withErrors(trans('auth.banned'));
|
||||
}
|
||||
|
||||
$maxSessions = setting('max_active_sessions');
|
||||
if ($maxSessions && $sessions->getActiveSessionsCount($user->id) >= $maxSessions) {
|
||||
return redirect()->to('login'.$to)
|
||||
return redirect()->to('login' . $to)
|
||||
->withErrors(trans('auth.max_sessions_reached'));
|
||||
}
|
||||
|
||||
@@ -107,15 +107,14 @@ class LoginController extends Controller
|
||||
}
|
||||
|
||||
// Reindirizza in base al ruolo
|
||||
if ($user->hasRole('Admin')) {
|
||||
return redirect()->to('userarea/admin.php');
|
||||
} elseif ($user->hasRole('User')) {
|
||||
if ($user->hasRole('Admin')) {
|
||||
return redirect()->to('userarea/import_dashboard.php');
|
||||
} elseif ($user->hasRole('User')) {
|
||||
return redirect()->to('userarea/index.php');
|
||||
}
|
||||
|
||||
// Se il ruolo non è specificato, reindirizza alla home predefinita
|
||||
return redirect()->intended('/');
|
||||
}
|
||||
|
||||
// Se il ruolo non è specificato, reindirizza alla home predefinita
|
||||
return redirect()->intended('/');
|
||||
}
|
||||
|
||||
protected function logoutAndRedirectToTokenPage(Request $request, $user, ?string $redirectPage): RedirectResponse
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 10 KiB |
@@ -50,7 +50,7 @@
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center">
|
||||
<div>
|
||||
<p class="mb-0 text-dark">Bounce Rate</p>
|
||||
<p class="mb-0 text-dark">Other Stats</p>
|
||||
<h4 class="my-1 text-dark">34.46%</h4>
|
||||
<p class="mb-0 font-13 text-dark"><i class="bx bxs-down-arrow align-middle"></i>12.2% from last week</p>
|
||||
</div>
|
||||
|
||||
@@ -40,10 +40,10 @@ if (!is_writable($uploadDir)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Verifica che il file sia un'immagine
|
||||
$allowedTypes = ['image/jpeg', 'image/png', 'image/gif'];
|
||||
// Verifica che il file sia un'immagine (inclusi HEIC/HEIF)
|
||||
$allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/heic', 'image/heif'];
|
||||
if (!in_array($photo['type'], $allowedTypes)) {
|
||||
echo json_encode(['success' => false, 'message' => 'Il file deve essere un\'immagine (JPEG, PNG, GIF)']);
|
||||
echo json_encode(['success' => false, 'message' => 'Il file deve essere un\'immagine (JPEG, PNG, GIF, HEIC)']);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -56,24 +56,56 @@ if (!file_exists($photo['tmp_name']) || !is_uploaded_file($photo['tmp_name'])) {
|
||||
// Rinomina il file: idriga-timestamp-nomeoriginale.estensione
|
||||
$timestamp = date('YmdHis');
|
||||
$originalName = pathinfo($photo['name'], PATHINFO_FILENAME);
|
||||
$extension = pathinfo($photo['name'], PATHINFO_EXTENSION);
|
||||
$newFileName = "{$iddatadb}-{$timestamp}-{$originalName}.{$extension}";
|
||||
$destination = $uploadDir . $newFileName;
|
||||
$extension = strtolower(pathinfo($photo['name'], PATHINFO_EXTENSION));
|
||||
|
||||
// Se il file è HEIC/HEIF, convertilo in JPEG
|
||||
if (in_array($photo['type'], ['image/heic', 'image/heif'])) {
|
||||
// Verifica che la libreria GD sia disponibile
|
||||
if (!extension_loaded('gd')) {
|
||||
echo json_encode(['success' => false, 'message' => 'La libreria GD non è disponibile per convertire il file HEIC']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Carica il file HEIC
|
||||
$image = imagecreatefromstring(file_get_contents($photo['tmp_name']));
|
||||
if ($image === false) {
|
||||
echo json_encode(['success' => false, 'message' => 'Impossibile caricare il file HEIC']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Crea un nuovo nome per il file JPEG
|
||||
$newFileName = "{$iddatadb}-{$timestamp}-{$originalName}.jpg";
|
||||
$destination = $uploadDir . $newFileName;
|
||||
|
||||
// Salva l'immagine come JPEG
|
||||
if (!imagejpeg($image, $destination, 90)) { // 90 è la qualità JPEG
|
||||
imagedestroy($image);
|
||||
echo json_encode(['success' => false, 'message' => 'Errore durante la conversione del file HEIC in JPEG']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Libera la memoria
|
||||
imagedestroy($image);
|
||||
} else {
|
||||
// Per i formati non HEIC, usa il nome e l'estensione originali
|
||||
$newFileName = "{$iddatadb}-{$timestamp}-{$originalName}.{$extension}";
|
||||
$destination = $uploadDir . $newFileName;
|
||||
|
||||
// Salva il file
|
||||
if (!move_uploaded_file($photo['tmp_name'], $destination)) {
|
||||
$error = error_get_last();
|
||||
echo json_encode(['success' => false, 'message' => 'Errore durante il caricamento del file: ' . (isset($error['message']) ? $error['message'] : 'Sconosciuto')]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Debug: verifica i percorsi
|
||||
error_log("Upload directory: $uploadDir");
|
||||
error_log("Destination: $destination");
|
||||
error_log("Temp file: " . $photo['tmp_name']);
|
||||
|
||||
// Salva il file
|
||||
if (!move_uploaded_file($photo['tmp_name'], $destination)) {
|
||||
$error = error_get_last();
|
||||
echo json_encode(['success' => false, 'message' => 'Errore durante il caricamento del file: ' . (isset($error['message']) ? $error['message'] : 'Sconosciuto')]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Salva il riferimento nel database
|
||||
$stmt = $pdo->prepare("INSERT INTO datadb_photos (iddatadb, file_path, file_name, uploaded_by) VALUES (?, ?, ?, ?)");
|
||||
$stmt->execute([$iddatadb, $newFileName, $photo['name'], $iduserlogin]);
|
||||
$stmt->execute([$iddatadb, $newFileName, $newFileName, $iduserlogin]);
|
||||
|
||||
echo json_encode(['success' => true, 'message' => 'Foto caricata con successo']);
|
||||
|
||||
Reference in New Issue
Block a user