Improve accessibility and file handling in CRUD

Co-authored-by: naielv <109038805+naielv@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-14 13:30:42 +00:00
parent f13c0725ec
commit b8b605cff0
2 changed files with 9 additions and 7 deletions

View File

@@ -82,10 +82,11 @@ switch ($_GET["form"] ?? '') {
// Validate image // Validate image
$image_info = getimagesize($tmp_name); $image_info = getimagesize($tmp_name);
if ($image_info !== false) { if ($image_info !== false) {
move_uploaded_file($tmp_name, $photo_path); if (move_uploaded_file($tmp_name, $photo_path)) {
chmod($photo_path, 0644); chmod($photo_path, 0644);
} }
} }
}
header("Location: ?aulario=" . urlencode($aulario_id) . "&_result=" . urlencode("Alumno añadido correctamente")); header("Location: ?aulario=" . urlencode($aulario_id) . "&_result=" . urlencode("Alumno añadido correctamente"));
exit; exit;
@@ -133,10 +134,11 @@ switch ($_GET["form"] ?? '') {
// Validate image // Validate image
$image_info = getimagesize($tmp_name); $image_info = getimagesize($tmp_name);
if ($image_info !== false) { if ($image_info !== false) {
move_uploaded_file($tmp_name, $photo_path); if (move_uploaded_file($tmp_name, $photo_path)) {
chmod($photo_path, 0644); chmod($photo_path, 0644);
} }
} }
}
header("Location: ?aulario=" . urlencode($aulario_id) . "&_result=" . urlencode("Alumno actualizado correctamente")); header("Location: ?aulario=" . urlencode($aulario_id) . "&_result=" . urlencode("Alumno actualizado correctamente"));
exit; exit;
@@ -223,7 +225,7 @@ switch ($_GET["action"] ?? '') {
<?php if ($photo_exists): ?> <?php if ($photo_exists): ?>
<div class="mb-2"> <div class="mb-2">
<img src="_filefetch.php?type=alumno_photo&alumno=<?= urlencode($nombre) ?>&centro=<?= urlencode($centro_id) ?>&aulario=<?= urlencode($aulario_id) ?>" <img src="_filefetch.php?type=alumno_photo&alumno=<?= urlencode($nombre) ?>&centro=<?= urlencode($centro_id) ?>&aulario=<?= urlencode($aulario_id) ?>"
alt="<?= htmlspecialchars($nombre) ?>" alt="Foto de <?= htmlspecialchars($nombre) ?>"
style="max-width: 200px; max-height: 200px; border: 2px solid #ddd; border-radius: 10px;"> style="max-width: 200px; max-height: 200px; border: 2px solid #ddd; border-radius: 10px;">
</div> </div>
<?php else: ?> <?php else: ?>
@@ -311,7 +313,7 @@ switch ($_GET["action"] ?? '') {
<td> <td>
<?php if ($photo_exists): ?> <?php if ($photo_exists): ?>
<img src="_filefetch.php?type=alumno_photo&alumno=<?= urlencode($nombre) ?>&centro=<?= urlencode($centro_id) ?>&aulario=<?= urlencode($aulario_id) ?>" <img src="_filefetch.php?type=alumno_photo&alumno=<?= urlencode($nombre) ?>&centro=<?= urlencode($centro_id) ?>&aulario=<?= urlencode($aulario_id) ?>"
alt="<?= htmlspecialchars($nombre) ?>" alt="Foto de <?= htmlspecialchars($nombre) ?>"
style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px;"> style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px;">
<?php else: ?> <?php else: ?>
<div style="width: 50px; height: 50px; background: #f0f0f0; display: flex; align-items: center; justify-content: center; border-radius: 5px; border: 2px dashed #ccc;"> <div style="width: 50px; height: 50px; background: #f0f0f0; display: flex; align-items: center; justify-content: center; border-radius: 5px; border: 2px dashed #ccc;">

View File

@@ -22,7 +22,7 @@ $aulario = json_decode(file_get_contents("/DATA/entreaulas/Centros/$centro_id/Au
</a> </a>
<?php if (in_array("entreaulas:docente", $_SESSION["auth_data"]["permissions"] ?? [])): ?> <?php if (in_array("entreaulas:docente", $_SESSION["auth_data"]["permissions"] ?? [])): ?>
<a href="/entreaulas/alumnos.php?aulario=<?= urlencode($aulario_id) ?>" class="btn btn-info grid-item"> <a href="/entreaulas/alumnos.php?aulario=<?= urlencode($aulario_id) ?>" class="btn btn-info grid-item">
<img src="/static/arasaac/alumnos.png" height="125" style="background: white; padding: 5px; border-radius: 10px;"> <img src="/static/arasaac/alumnos.png" height="125" style="background: white; padding: 5px; border-radius: 10px;" alt="Icono de gestión de alumnos">
<br> <br>
Gestión de Alumnos Gestión de Alumnos
</a> </a>