El plazo para la presentación de candidaturas ha finalizado.
break; case "fin_s1": // Declare our $errors variable we will be using later to store any errors $error = ''; // Setup our basic variables $input_categoria = strip_tags($_POST['subCategoria']); $input_quien = strip_tags($_POST['quien']); $input_pais = strip_tags($_POST['pais']); $input_candidatura = strip_tags($_POST['candidatura']); $input_url = valida_url(strip_tags($_POST['url'])); $input_video = strip_tags($_POST['video']); $input_twitter = strip_tags($_POST['twitter']); $input_fb = strip_tags($_POST['facebook']); $input_rss_imagen = strip_tags($_POST['rss-imagen']); $input_linkedin = strip_tags($_POST['linkedin']); $input_texto = strip_tags(acute($_POST['texto'])); $input_nombre = strip_tags($_POST['nombre']); $input_apellidos = strip_tags($_POST['apellidos']); $input_empresa = strip_tags($_POST['empresa']); $input_email = strip_tags($_POST['email_user']); $input_email2 = strip_tags($_POST['email_user2']); $input_tel = strip_tags($_POST['tel']); $input_texto2 = strip_tags($_POST['texto2']); $input_imagen = strip_tags($_POST['imagen']); // Compruebo si los enlaces a las redes sociales son validos if ($input_twitter) { $input_twitter = validar_rss($input_twitter, 'twitter'); if ($input_twitter === false) { $error['twitter'] = "El enlace a twitter no es valido"; } } // Compruebo si los enlaces a las redes sociales son validos if ($input_fb) { $input_fb = validar_rss($input_fb, 'facebook'); if ($input_fb === false) { $error['facebook'] = "El enlace a facebook no es valido"; } } $_SESSION['categoria_s'] = $input_categoria; $_SESSION['quien_s'] = $input_quien; $_SESSION['pais_s'] = $input_pais; $_SESSION['candidatura_s'] = $input_candidatura; $_SESSION['url_s'] = $input_url; $_SESSION['video_s'] = $input_video; $_SESSION['twitter_s'] = $input_twitter; $_SESSION['facebook_s'] = $input_fb; $_SESSION['rss-imagen'] = $input_rss_imagen; $_SESSION['linkedin'] = $input_linkedin; $_SESSION['texto_s'] = $input_texto; $_SESSION['nombre_s'] = $input_nombre; $_SESSION['apellidos_s'] = $input_apellidos; $_SESSION['empresa_s'] = $input_empresa; $_SESSION['email_user_s'] = $input_email; $_SESSION['email_user2_s'] = $input_email2; $_SESSION['tel_s'] = $input_tel; $_SESSION['texto2_s'] = $input_texto2; $_SESSION['imagen_s'] = basename($_FILES['imagen']['name']); // We'll check and see if any of the required fields are empty //if( strlen($input_categoria) < 2 ) $error['categoria'] = 'Introduzca una categoría por favor.'; if( strlen($input_quien) < 2 ) $error['quien'] = 'Introduzca quién opta al premio por favor.'; //if( strlen($input_pais) < 2 ) $error['pais'] = 'Introduzca un país por favor.'; if( strlen($input_candidatura) < 2 ) $error['candidatura'] = 'Introduzca el nombre de la candidatura por favor.'; if( strlen($input_url) < 2 ) $error['url'] = 'Introduzca una página web por favor.'; //if( strlen($_FILES['input_imagen']['name']) < 2 ) $error['imagen'] = 'FICHERO: '.$input_imagen.'
NOMBRE: '.$_FILES['input_imagen']['name'].'
'; if( strlen($input_texto) < 5 ) $error['texto'] = 'Introduzca las razones por las que esta candidatura debería de ser reconocida por favor.'; if( strlen($input_texto) > 3000 ) $error['texto2'] = 'Texto introducido demasiado largo. Acorte el texto por favor.'; if( strlen($input_nombre) < 2 ) $error['nombre'] = 'Introduzca su nombre por favor.'; if( strlen($input_apellidos) < 2 ) $error['apellidos'] = 'Introduzca sus apellidos por favor.'; if( strlen($input_empresa) < 2 ) $error['empresa'] = 'Introduzca el nombre de su organización o empresa por favor.'; if( strlen($input_texto2) > 3000 ) $error['texto2'] = 'Texto introducido demasiado largo. Acorte el texto por favor.'; //if( strlen($input_tel) < 2 ) $error['tel'] = 'Escriba un teléfono de contacto por favor. Esta información no se publicará.'; // Make sure the email is valid if( !filter_var($input_email, FILTER_VALIDATE_EMAIL) ) $error['email'] = 'Escriba un email válido por favor.'; if( !filter_var($input_email2, FILTER_VALIDATE_EMAIL) ) $error['email2'] = 'Escriba un email válido por favor.'; // Comparar los dos email if( $input_email != $input_email2 ) $error['email'] = 'No coinciden los emails. Vuelva a escribir esta información por favor.'; $query_nom_cat="SELECT titre FROM spip_rubriques WHERE id_rubrique=$input_categoria AND id_secteur=5 AND titre NOT LIKE 'z_%'"; $q_nom_cat = spip_query($query_nom_cat); if ($row = spip_fetch_array($q_nom_cat)) $nombre_categoria = $row['titre']; else $error['nombre_categoria'] = '
La categoría no coincide
'; switch($input_categoria) { case 245: $prefijo = "app_"; break; case 228: $prefijo = "pub_"; break; case 255: $prefijo = "soc_"; break; case 238: $prefijo = "vid_"; break; case 219: $prefijo = "web_"; break; } $query_nom_pais="SELECT titre FROM spip_mots WHERE id_groupe=2 AND id_mot=$input_pais"; $q_nom_pais = spip_query($query_nom_pais); if ($row = spip_fetch_array($q_nom_pais)) $nombre_pais = $row['titre']; //$error['nombre_pais'] = '
QUERY: '.$query_nom_pais_cortesia.' - Debe introducir un país
'; //$error['nombre_categoria'] = '
ERROR'; // Set a subject & check if custom subject exist $subject = "DDI" . $edicion_en_curso . " - Premios Alta - $input_candidatura - $input_nombre $input_apellidos"; if( $input_subject ) $subject .= ": $nombre_categoria"; $message = "CATEGORIA: $nombre_categoria\n"; $message .= "PAIS: $nombre_pais\n"; $message .= "CANDIDATURA: $input_candidatura\n"; $message .= "URL: $input_url\n"; $message .= "VIDEO: $input_video\n"; $message .= "TWITTER: $input_twitter\n"; $message .= "FACEBOOK: $input_fb\n"; $message .= "POR QUÉ: \n".acute($input_texto)."\n"; $message .= "--------\n"; $message .= "QUIEN: $input_quien\n"; $message .= "NOMBRE: $input_nombre\n"; $message .= "APELLIDOS: $input_apellidos\n"; $message .= "EMPRESA: $input_empresa\n"; $message .= "EMAIL: $input_email\n"; $message .= "TELEFONO: $input_tel\n"; $message .= "DATOS ADICIONALES: \n$input_texto2\n"; /* IMAGEN */ // Tipo de archivos permitidos sin el punto $allowtypes=array("gif", "jpg", "jpeg", "png"); // Maximum file size for attachments in bytes NOT Bytes for simplicity. MAKE SURE your php.ini can handel it, // post_max_size, upload_max_filesize, file_uploads, max_execution_time! // 2048kb = 2MB, 1024kb = 1MB, 512kb = 1/2MB etc.. //$max_file_size="3096"; $tamano_max = 2000000; $ancho_logo = 910; $alto_logo = 650; $ancho_diapo = 910; $alto_diapo = 650; if ((empty($_FILES["imagen"])) || ($_FILES['imagen']['error']) > 0) { $error['error_imagen'] = 'ERROR en la imagen - '.print_r($_FILES['imagen']['error']); } else { // basename -- Returns filename component of path $filename = basename($_FILES['imagen']['name']); $ext = strtolower(substr($filename, strrpos($filename, '.') + 1)); $lon_ext = strlen($ext)+1; $nom_img = substr($filename, 0, -$lon_ext); //echo "NOM_IMG: ".$nom_img; //$error['nom_img'] = 'HOLA'; $filesize=$_FILES['imagen']['size']; $max_bytes=$max_file_size*1024; //Check if the file type uploaded is a valid file type. if (!in_array($ext, $allowtypes)) { $error['extension'] = '
Tipo de imagen no permitida
'; // check the size of each file } elseif($filesize > $tamano_max) { $error['tamano_imagen'] = 'El tamaño de la imagen es demasiado grande.'; } } // Now check to see if there are any errors if( !$error ) { setlocale (LC_TIME, "es_ES"); $hora = strftime ("%H:%M:%S"); $fecha = strftime("%Y-%m-%d"); $date = $fecha." ".$hora; $accepter_forum = "pos"; $export = "oui"; $langue_choisie = "oui"; $id_secteur = 5; $id_rubrique = $input_categoria; $lang_alta = "es"; $valores = array( 'surtitre' => "2", 'titre' => $input_candidatura, 'soustitre' => $input_empresa, 'descriptif' => $input_nombre." ".$input_apellidos, 'chapo' => $input_tel, 'url_site' => $input_url, 'nom_site' => $input_email, 'texte' => $input_texto, 'ps' => $input_texto2, 'id_rubrique' => $id_rubrique, 'id_secteur' => $id_secteur, 'statut' => "prop", 'date' => $date, 'date_redac' => $date, 'accepter_forum' => $accepter_forum, 'langue_choisie' => $langue_choisie, 'export' => $export, 'lang' => $lang_alta, 'email_contacto' => $input_email, 'pais' => $nombre_pais, 'video' => $input_video, 'twitter' => $input_twitter, 'quien' => $input_quien, 'facebook' => $input_fb, 'rss_img' => $input_rss_imagen, 'linkedin' => $input_linkedin ); sql_insertq("spip_articles", $valores); $s = spip_query("SELECT id_article FROM spip_articles WHERE titre='$input_candidatura' AND statut='prop' AND date='$date' AND id_rubrique='$id_rubrique'"); $row = spip_fetch_array($s); $id_article = $row['id_article']; if ($id_article) { // Le asigno el autor con ID=1 (programacion) sql_insertq('spip_auteurs_liens', array('id_auteur' => 1, 'id_objet' => $id_article, 'objet' => 'article')); // Le asigno la palabra clave pais sql_insertq('spip_mots_liens', array('id_mot' => $input_pais, 'id_objet' => $id_article, 'objet' => 'article')); // Le asigno la palabra clave año (2016) sql_insertq('spip_mots_liens', array('id_mot' => 268, 'id_objet' => $id_article, 'objet' => 'article')); // Si viene URL del Vídeo lo añado como documento if (!empty($input_video)) { $id_vignette = 0; $extension = "html"; $mode = "document"; $media = "file"; $distant="oui"; $statut="publie"; $fichier=$input_video; $brise=0; $valores = array( 'id_vignette' => $id_vignette, 'extension' => $extension, 'titre' => $input_candidatura, 'date' => $date, 'fichier' => $fichier, 'taille' => "", 'media' => $media, 'mode' => $mode, 'distant' => $distant, 'statut' => $statut, 'date_publication' => "1970-01-01 01:00:00", 'brise' => $brise, 'maj' => $date ); sql_insertq("spip_documents", $valores); $q2 = spip_query("SELECT id_document FROM spip_documents WHERE titre='$input_candidatura' AND statut='$statut' AND date='$date' AND mode='$mode'"); $row = spip_fetch_array($q2); $id_document = $row['id_document']; // Le asigno el articulo al que pertenece este documento sql_insertq('spip_documents_liens', array('id_document' => $id_document, 'id_objet' => $id_article, 'objet' => 'article')); } // FIN si viene vídeo $uploaddir_logo = 'IMG/'; $uploaddir_diapo = 'IMG/'.$ext."/"; $uploadfile = $uploaddir_diapo . $prefijo.$id_article . "_a." . $ext; $uploadfile_p = $uploaddir_logo . "arton" . $id_article . "." . $ext; // if (move_uploaded_file($_FILES['imagen']['tmp_name'], $uploadfile_p)) // { //echo "El archivo es válido y fue cargado exitosamente.\n"; // No errors, send mail using conditional to ensure it was sent //if (!copy($uploadfile_p, $uploadfile)) //{ // echo "Error al copiar $archivo...\n"; //} //else //{ include('class.upload.php'); $handle = new upload($_FILES['imagen']['tmp_name']); if($handle->uploaded) { // Get size of image $width = $handle->image_src_x; $height = $handle->image_src_y; if ($width > $height) { $handle->image_x = 910; // Ensure the height of the image is calculated based on ratio $handle->image_ratio_y = true; } if ($width == $height) { $handle->image_x = 910; // Ensure the height of the image is calculated based on ratio $handle->image_ratio_y = true; } if ($width < $height) { $handle->image_y = 650; // Ensure the height of the image is calculated based on ratio $handle->image_ratio_x = true; } // Set the new filename of the uploaded image $handle->file_new_name_body = "arton" . $id_article; // Make sure the image is resized $handle->image_resize = true; // Process the image resize and save the uploaded file to the directory $handle->process('IMG'); // Proceed if image processing completed sucessfully if($handle->processed) { // Your image has been resized and saved $img_subida = 1; // Reset the properties of the upload object $handle->clean(); $error2 = "OK"; }else{ // Write the error to the screen // echo 'error : ' . $handle->error; $img_subida = 0; echo '
Se ha encontrado un error en la redimensión 1!
'; } } else { echo 'Se ha encontrado un error en la redimensión 1!
'; } /* list($ancho, $alto, $tipo, $atr) = getimagesize($uploadfile); //echo "ANCHO: ".$ancho." ALTO: ".$alto." TIPO: ".$tipo." ATR: ".$atr; if ($ancho > $ancho_diapo || $alto > $alto_diapo) { if ($ancho > $alto) { $porc = ($ancho_diapo * 100)/$ancho; $alto = ($alto * $porc)/100; $ancho = $ancho_diapo; } if ($ancho < $alto) { $porc = ($alto_diapo * 100)/$alto; $ancho = ($ancho * $porc)/100; $alto = $alto_diapo; } if ($ancho == $alto) { $ancho = $ancho_diapo; $alto = $ancho_diapo; } } $forcedwidth_diapo=$ancho; $forcedheight_diapo=$alto; $resolucion=100; $error1 = resizeToFile($tipo,$uploadfile,$forcedwidth_diapo,$forcedheight_diapo,$uploadfile,$resolucion); if ($error1!="OK") echo '
Se ha encontrado un error en la redimensión 1!
'; if ($ancho > $ancho_logo || $alto > $alto_logo) { if ($ancho > $alto) { $porc = ($ancho_logo * 100)/$ancho; $alto = ($alto * $porc)/100; $ancho = $ancho_logo; } if ($ancho < $alto) { $porc = ($alto_logo * 100)/$alto; $ancho = ($ancho * $porc)/100; $alto = $alto_logo; } if ($ancho == $alto) { $ancho = $ancho_logo; $alto = $ancho_logo; } } $forcedwidth_logo=$ancho; $forcedheight_logo=$alto; $resolucion=100; $error2 = resizeToFile($tipo,$uploadfile_p,$forcedwidth_logo,$forcedheight_logo,$uploadfile_p,$resolucion); echo '$error2
'; */ if ($error2!="OK") echo 'Se ha encontrado un error en la redimensión 2!
'; $id_vignette = 0; $extension = $ext; $mode = "image"; $media = "image"; $distant="non"; $statut="publie"; $fichier=$ext."/".$prefijo.$id_article . "_a." . $ext; $brise=0; $valores = array( 'id_vignette' => $id_vignette, 'extension' => $extension, 'titre' => $input_candidatura, 'date' => $date, 'fichier' => $fichier, 'taille' => $filesize, 'largeur' => $forcedwidth_diapo, 'hauteur' => $forcedheight_diapo, 'media' => $media, 'mode' => $mode, 'distant' => $distant, 'statut' => $statut, 'date_publication' => "1970-01-01 01:00:00", 'brise' => $brise, 'maj' => $date ); sql_insertq("spip_documents", $valores); $q3 = spip_query("SELECT id_document FROM spip_documents WHERE titre='$input_candidatura' AND statut='$statut' AND date='$date' AND mode='$mode' "); $row = spip_fetch_array($q3); $id_document2 = $row['id_document']; // Le asigno el articulo al que pertenece este documento sql_insertq('spip_documents_liens', array('id_document' => $id_document2, 'id_objet' => $id_article, 'objet' => 'article')); // Get email address require_once 'php/config.php'; $message .= "IMAGEN: http://diadeinternet.org/" . $edicion_en_curso . "/IMG/arton".$id_article.".".$ext."\n"; $message .= "\n---\nACEPTAR CANDIDATURA\n\n"; $message .= "http://diadeinternet.org/2017/?page=prem_status_candidatura&id_article=".$id_article."&id_rubrique=".$id_rubrique."\n"; $message .= "\n---\nEste email fue enviado desde el formulario de alta de candidaturas."; $cabeceras = 'From: '.$input_email; // $your_email_address = 'carlos.ruiz.cues@gmail.com,'; // $error_mail = f_mandar_email($your_email_address, $subject, acute($message), $cabeceras); $error_mail = f_manda_mail($your_email_address, $subject, acute($message), $cabeceras); if ($error_mail == 0) { echo 'La candidatura se ha enviado correctamente!
'; ?>Se ha encontrado una incidencia en el envío (mail)!!
'; } //} //} //else //{ // echo "Ha habido un error en el proceso de carga de la imagen
\n
Se ha encontrado una incidencia en el envío de los datos
'; } else { // Errors were found, output all errors to the user $response = (isset($error['categoria'])) ? $error['categoria'] . "\n" : null; $response .= (isset($error['nombre_categoria'])) ? $error['nombre_categoria'] . "
\n" : null; $response .= (isset($error['nombre_pais'])) ? $error['nombre_pais'] . "
\n" : null; $response .= (isset($error['quien'])) ? $error['quien'] . "
\n" : null; $response .= (isset($error['candidatura'])) ? $error['candidatura'] . "
\n" : null; $response .= (isset($error['url'])) ? $error['url'] . "
\n" : null; $response .= (isset($error['pais'])) ? $error['pais'] . "
\n" : null; $response .= (isset($error['texto'])) ? $error['texto'] . "
\n" : null; $response .= (isset($error['texto2'])) ? $error['texto2'] . "
\n" : null; $response .= (isset($error['nombre'])) ? $error['nombre'] . "
\n" : null; $response .= (isset($error['apellidos'])) ? $error['apellidos'] . "
\n" : null; $response .= (isset($error['empresa'])) ? $error['empresa'] . "
\n" : null; $response .= (isset($error['email'])) ? $error['email'] . "
\n" : null; $response .= (isset($error['texto3'])) ? $error['texto3'] . "
\n" : null; $response .= (isset($error['BD'])) ? $error['BD'] . "
\n" : null; //$response .= (isset($error['tel'])) ? $error['tel'] . "
\n" : null; $response .= (isset($error['imagen'])) ? $error['imagen'] . "
\n" : null; $response .= (isset($error['tamano_imagen'])) ? $error['tamano_imagen'] . "
\n" : null; $response .= (isset($error['error_imagen'])) ? $error['error_imagen'] . "
\n" : null; $response .= (isset($error['extension'])) ? $error['extension'] . "
\n" : null; $response .= (isset($error['facebook'])) ? $error['facebook'] . "
\n" : null; $response .= (isset($error['twitter'])) ? $error['twitter'] . "
\n" : null; echo "
$response
"; ?>