Esempio n. 1
0
function prod_cart($projet, $projection, $mode, $nb_carte)
{
    /*FONCTION DE PRODUCTION DE CARTE EN MASSE*/
    include "_INCLUDE/commun.inc.php";
    if (securite($projet) == "ok") {
        /*création ou test du fichier de log*/
        $result_verif = verif($projet, $output);
        /*Affichage*/
        if ($mode == "html") {
            echo "nb carte produites : " . $result_verif[1] . "<BR>";
        } else {
            echo "";
        }
        if ($mode == "html") {
            echo "PROJET : " . $projet . "<BR>";
        } else {
            echo "";
        }
        /* $req_liste_taxon récupère la liste de taxon en fonction du projet*/
        $query = $req_liste_taxon[$projet] . " " . $result_verif[0];
        echo "{$query}<BR>";
        $reponse = query_bdd($query, 2);
        $table = $reponse[0];
        $nom = $reponse[1];
        /*Construction de l'URL utilisé pour produire la carte*/
        /*$URL initialisé dans .sql_config.inc*/
        $URL = $URL_qgisserver;
        $URL .= "{$projet}.out.qgs";
        $URL .= $source[$projet] . $layer[$projet];
        /*Affichage*/
        if ($mode == "html") {
            $nb_carte_prod = $nb_carte;
        } else {
            $nb_carte_prod = count($table);
        }
        if (!empty($table[0])) {
            for ($i = 0; $i < $nb_carte_prod; $i++) {
                /*Création du nouveau fichier projet avec le taxon à interroger*/
                $file = file_get_contents("{$input}/{$projet}.qgs");
                $texte = str_replace("100024", $table[$i], $file);
                file_put_contents("{$input}/{$projet}.out.qgs", $texte);
                /*Soucis d'encodage*/
                $espece = nettoyerChaine($nom[$i]);
                $espece = utf8_decode($espece);
                /*Affichage*/
                if ($mode == "html") {
                    echo "{$table[$i]}<BR>";
                } else {
                    echo "Taxon {$table[$i]} \n ";
                }
                if ($mode == "html") {
                    echo "{$URL}<BR>";
                } else {
                    echo "{$URL}\n";
                }
                /*Enregistrement de l'image*/
                if (file_get_contents($URL)) {
                    $taxprod = "ok";
                    $img = file_get_contents($URL);
                    file_put_contents("{$output}/{$projet}/" . $espece . "_" . $short[$projet] . "_" . $table[$i] . ".jpg", $img);
                    imagethumb("{$output}/{$projet}/" . $espece . "_" . $short[$projet] . "_" . $table[$i] . ".jpg", "{$output}/{$projet}/" . $espece . "_" . $short[$projet] . "_thumb_" . $table[$i] . ".jpg", 400);
                } else {
                    $taxprod = "no";
                }
                /*Nettoyage et log*/
                unlink("{$input}/{$projet}.out.qgs");
                if ($taxprod == "ok") {
                    file_put_contents("{$output}/{$projet}/cartes_taxons_produit_{$projet}.txt", "'{$table[$i]}'\n", FILE_APPEND);
                }
                /*activation affichage*/
                $buffer = strlen($table[$i]) + 3;
                flush_buffers($buffer);
            }
        }
    }
}
Esempio n. 2
0
 //check if its an ajax request, exit if not
 if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) and strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
     $send_mail = false;
     echo json_encode($send_mail);
     exit;
     //exit script outputting json data
 } else {
     function nettoyerChaine($chaine)
     {
         $caracteres = array('À' => '&Agrave;', 'Á' => '&Acute;', 'Â' => '&Acirc;', 'Ä' => '&Auml;', 'à' => '&agrave;', 'á' => '&aacute;', 'â' => '&acirc;', 'ä' => '&auml;', 'È' => '&Egrave;', 'É' => '&Ecute;', 'Ê' => '&Ecirc;', 'Ë' => '&Euml;', 'è' => '&egrave;', 'é' => '&eacute;', 'ê' => '&ecirc;', 'ë' => '&euml;', 'Ì' => '&Igrave;', 'Í' => '&Icute;', 'Î' => '&Icirc;', 'Ï' => '&Iuml;', 'ì' => '&igrave;', 'í' => '&iacute;', 'î' => '&icirc;', 'ï' => '&iuml;', 'Ò' => '&Ograve;', 'Ó' => '&Ocute;', 'Ô' => '&Ocirc;', 'Ö' => '&Ouml;', 'ò' => '&ograve;', 'ó' => '&oacute;', 'ô' => '&ocirc;', 'ö' => '&ouml;', 'Ù' => '&Ugrave;', 'Ú' => '&Ucute;', 'Û' => '&Ucirc;', 'Ü' => '&Uuml;', 'ù' => '&ugrave;', 'ú' => '&uacute;', 'û' => '&ucirc;', 'ü' => '&uuml;');
         $chaine = strtr($chaine, $caracteres);
         return $chaine;
     }
     $name = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
     $email = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);
     $message = nettoyerChaine(filter_var($_POST["specialite"], FILTER_SANITIZE_STRING));
     $message_body = "<u><h3>Nom : </h3></u>{$name}<br />";
     $message_body .= "<u><h3>Email : </h3></u>{$email}<br />";
     $message_body .= "<u><h3>Message</h3></u><p><i>{$message}</i></p>";
     $mail = new PHPMailer();
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->SMTPDebug = 3;
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Host = 'mx1.hostinger.fr';
     // SMTP host
     $mail->Port = 587;
     // SMTP open port
     $mail->Username = '******';
     // SMTP username