Add files via upload

This commit is contained in:
Fernando Méndez
2021-05-14 16:53:59 +02:00
committed by GitHub
parent fdf0a17edd
commit 62038f6f51
28 changed files with 348 additions and 167 deletions

View File

@ -84,9 +84,6 @@ class formAddCinema extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}
?>

View File

@ -33,7 +33,7 @@ class formAddFilm extends Form{
<input type="number" name="duration" id="duration" placeholder="Duración" required/><pre>'.$errorDuration.'</pre>
<input type="text" name="language" id="language" placeholder="Idioma" required/><pre>'.$errorLanguage.'</pre>
<input type="text" name="description" id="description" placeholder="Descripción" required/><pre>'.$errorDescription.'</pre>
<input type="file" name="archivo" id="archivo" /><pre>'.$errorImage.'</pre></p>
<div class="file">Imagen promocional:<input type="file" name="file" id="file" placeholder="Imagen promocional" /></div><pre>'.$errorImage.'</pre></p>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir pelicula" class="primary" />
@ -156,10 +156,6 @@ class formAddFilm extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
private function check_file_uploaded_name ($filename) {
return (bool) ((mb_ereg_match('/^[0-9A-Z-_\.]+$/i',$filename) === 1) ? true : false );
}

View File

@ -24,13 +24,12 @@ class formAddManager extends Form{
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
$errorIdCinema = self::createMensajeError($errores, 'idcinema', 'span', array('class' => 'error'));
$html = '<div class="row">
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>Selecciona usuario.</legend>'
$html = '<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>Selecciona usuario.</legend><pre>'.$errorId.'</pre>'
.$this->showUsers().
'</fieldset>
<fieldset>
<legend>Selecciona cine.</legend>'
<legend>Selecciona cine.</legend><pre>'.$errorIdCinema.'</pre>'
.$this->showCinemas().
'</fieldset>
<div class="actions">
@ -38,7 +37,7 @@ class formAddManager extends Form{
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</div>';
';
return $html;
}
@ -53,7 +52,7 @@ class formAddManager extends Form{
$idcinema = $this->test_input($datos['idcinema']) ?? null;
//||!mb_ereg_match(self::HTML5_EMAIL_REGEXP, $duration)
if (is_null($idcinema)) {
if (empty($idcinema)) {
$result['idcinema'] = "ERROR. No existe un cine con ese ID";
}
@ -88,10 +87,6 @@ class formAddManager extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
private function showUsers() {
$user = new UserDAO("complucine");
$users = $user->allUsersNotM();

View File

@ -101,10 +101,6 @@ class formAddPromotion extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}

View File

@ -18,9 +18,9 @@ class formDeleteCinema extends Form{
$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
$html = '<div class="column side"></div>
<fieldset id = "cinema_form">'.$htmlErroresGlobales.'</pre>
<fieldset id = "cinema_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar este cine?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="hidden" name="id" value='.$_POST['id'].'/><pre>'.$errorId.'</pre>
<p>Name: '.$_POST['name'].' </p>
<p>Dirección: '.$_POST['direction'].' </p>
<p>Teléfono: '.$_POST['phone'].' </p>
@ -70,9 +70,6 @@ class formDeleteCinema extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}
?>

View File

@ -29,7 +29,7 @@ class formDeleteFilm extends Form{
$html = '<div class="row">
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="hidden" name="id" value='.$_POST['id'].'/><pre>'.$errorId.'</pre>
<p>Id: '.$_POST['id'].' </p>
<p>Título: '.$_POST['tittle'].' </p>
<p>Duración: '.$_POST['duration'].' </p>
@ -80,10 +80,6 @@ class formDeleteFilm extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}

View File

@ -24,7 +24,7 @@ class formDeleteManager extends Form{
$html = '<div class="row">
<fieldset id="manager_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar este gerente?</legend>
<legend>¿Estás seguro de que quieres eliminar este gerente?</legend><pre>'.$errorId.'</pre>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Id: '.$_POST['id'].' </p>
<p>IdCinema: '.$_POST['idcinema'].' </p>
@ -75,10 +75,6 @@ class formDeleteManager extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}

View File

@ -29,7 +29,7 @@ class formDeletePromotion extends Form{
$html = '<div class="row">
<fieldset id="promotion_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>¿Estás seguro de que quieres eliminar esta promocion?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="hidden" name="id" value='.$_POST['id'].'/><pre>'.$errorId.'</pre>
<p>Id: '.$_POST['id'].' </p>
<p>Nombre: '.$_POST['tittle'].'</p>
<p>Description:'.$_POST['description'].'</p>
@ -84,12 +84,6 @@ class formDeletePromotion extends Form{
}
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}
?>

View File

@ -93,9 +93,6 @@ class formEditCinema extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}
?>

View File

@ -88,7 +88,7 @@ class formEditFilm extends Form{
$bd = new Film_DAO("complucine");
$exist = $bd-> FilmData($id);
if( mysqli_num_rows($exist) == 1){
$bd->editFilm($id,$tittle,$duration,$language,$description);
$bd->editFilm($id, $tittle, $duration, $language, $description, $img = null /* Cambiar cuando se ñaladan las imágenes */);
$_SESSION['message'] = "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
@ -110,12 +110,6 @@ class formEditFilm extends Form{
}
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}
?>

View File

@ -26,8 +26,8 @@ class formEditManager extends Form{
$html = '<div class="row">
<h1>EDITAR GERENTE ID:'.$_POST['id'].'</h1>
<fieldset id="film_form"><pre>'.$htmlErroresGlobales.'</pre>
<legend>Selecciona cine.</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>'
<legend>Selecciona cine.</legend><pre>'.$errorIdCinema.'</pre>
<input type="hidden" name="id" value='.$_POST['id'].'/><pre>'.$errorId.'</pre>'
.$this->showCinemas().
'</fieldset>
<div class="actions">
@ -83,11 +83,6 @@ class formEditManager extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
private function showCinemas() {
$cine = new Cinema_DAO("complucine");
$cinemas = $cine->allCinemaData();

View File

@ -109,10 +109,6 @@ class formEditPromotion extends Form{
return $result;
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}