From 2e920a5e56b7358b0fd988d3b8b35be0e2e2602a Mon Sep 17 00:00:00 2001 From: pascalc <pascal.chevrel@free.fr> Date: Mon, 4 Mar 2013 19:46:06 +0100 Subject: [PATCH] =?UTF-8?q?enl=C3=A8ve=20les=20appels=20=C3=A0=20get=5Fser?= =?UTF-8?q?ver=5Fname()=20partout=20sauf=20dans=20un=20appel=20=C3=A0=20se?= =?UTF-8?q?ndMail(),=20r=C3=A9=C3=A9criture=20de=20la=20fonction=20pour=20?= =?UTF-8?q?cet=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminstuds.php | 244 ++++++++++++++++++++++++------------------------- bandeaux.php | 79 ++++++++-------- exportpdf.php | 10 +- fonctions.php | 48 ++++------ index.php | 12 +-- 5 files changed, 190 insertions(+), 203 deletions(-) diff --git a/adminstuds.php b/adminstuds.php index bd7adce0..019f7916 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -10,10 +10,10 @@ //Ce logiciel est régi par la licence CeCILL-B soumise au droit français et //respectant les principes de diffusion des logiciels libres. Vous pouvez //utiliser, modifier et/ou redistribuer ce programme sous les conditions -//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA +//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA //sur le site "http://www.cecill.info". // -//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez +//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez //pris connaissance de la licence CeCILL-B, et que vous en avez accepté les //termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE. // @@ -26,10 +26,10 @@ //borghesi@unistra.fr // //This software is governed by the CeCILL-B license under French law and -//abiding by the rules of distribution of free software. You can use, +//abiding by the rules of distribution of free software. You can use, //modify and/ or redistribute the software under the terms of the CeCILL-B //license as circulated by CEA, CNRS and INRIA at the following URL -//"http://www.cecill.info". +//"http://www.cecill.info". // //The fact that you are presently reading this means that you have had //knowledge of the CeCILL-B license and that you accept its terms. You can @@ -62,12 +62,12 @@ if (preg_match(";[\w\d]{24};i", $numsondageadmin)) { $sql = 'SELECT * FROM sondage WHERE id_sondage_admin = '.$connect->Param('numsondageadmin'); $sql = $connect->Prepare($sql); $sondage = $connect->Execute($sql, array($numsondageadmin)); - + if ($sondage !== false) { $sql = 'SELECT * FROM sujet_studs WHERE id_sondage = '.$connect->Param('numsondage'); $sql = $connect->Prepare($sql); $sujets = $connect->Execute($sql, array($numsondage)); - + $sql = 'SELECT * FROM user_studs WHERE id_sondage = '.$connect->Param('numsondage').' order by id_users'; $sql = $connect->Prepare($sql); $user_studs = $connect->Execute($sql, array($numsondage)); @@ -82,8 +82,8 @@ if (!$sondage || $sondage->RecordCount() != 1){ logo(); bandeau_tete(); bandeau_titre(_("Error!")); - - + + echo '<div class=corpscentre>'."\n"; print "<H2>" . _("This poll doesn't exist !") . "</H2><br><br>"."\n"; print "" . _("Back to the homepage of ") . " <a href=\"index.php\"> ".NOMAPPLICATION."</A>. "."\n"; @@ -91,7 +91,7 @@ if (!$sondage || $sondage->RecordCount() != 1){ echo '</div>'."\n"; # sur_bandeau_pied(); bandeau_pied(); - + echo'</body>'."\n"; echo '</html>'."\n"; die(); @@ -112,7 +112,7 @@ if (isset($_POST["boutonnouveautitre"]) || isset($_POST["boutonnouveautitre_x"]) $nouveautitre = htmlentities(html_entity_decode($_POST['nouveautitre'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); $sql = 'UPDATE sondage SET titre = '.$connect->Param('nouveautitre').' WHERE id_sondage = '.$connect->Param('numsondage'); $sql = $connect->Prepare($sql); - + //envoi du mail pour prevenir l'admin de sondage if ($connect->Execute($sql, array($nouveautitre, $numsondage))) { sendEmail( $adresseadmin, @@ -123,18 +123,18 @@ if (isset($_POST["boutonnouveautitre"]) || isset($_POST["boutonnouveautitre_x"]) } } } - + // si le bouton est activé, quelque soit la valeur du champ textarea if (isset($_POST["boutonnouveauxcommentaires"]) || isset($_POST["boutonnouveauxcommentaires_x"])) { if(issetAndNoEmpty('nouveautitre') === false) { $err |= COMMENT_EMPTY; } else { $commentaires = htmlentities(html_entity_decode($_POST['nouveauxcommentaires'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); - + //modification de la base SQL avec les nouveaux commentaires $sql = 'UPDATE sondage SET commentaires = '.$connect->Param('commentaires').' WHERE id_sondage = '.$connect->Param('numsondage'); $sql = $connect->Prepare($sql); - + if ($connect->Execute($sql, array($commentaires, $numsondage))) { //envoi du mail pour prevenir l'admin de sondage sendEmail( $adresseadmin, @@ -152,11 +152,11 @@ if (isset($_POST["boutonnouvelleadresse"]) || isset($_POST["boutonnouvelleadress $err |= INVALID_EMAIL; } else { $nouvelleadresse = htmlentities(html_entity_decode($_POST['nouvelleadresse'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); - + //modification de la base SQL avec la nouvelle adresse $sql = 'UPDATE sondage SET mail_admin = '.$connect->Param('nouvelleadresse').' WHERE id_sondage = '.$connect->Param('numsondage'); $sql = $connect->Prepare($sql); - + if ($connect->Execute($sql, array($nouvelleadresse, $numsondage))) { //envoi du mail pour prevenir l'admin de sondage sendEmail( $_POST['nouvelleadresse'], @@ -180,24 +180,24 @@ if (isset($_POST["ajoutsujet"]) || isset($_POST["ajoutsujet_x"])) { bandeau_tete(); bandeau_titre(_("Make your polls")); sous_bandeau(); - + //on recupere les données et les sujets du sondage - + echo '<div class="corps">'."\n"; - + echo '<form name="formulaire" action="'.getUrlSondage($numsondageadmin, true).'" method="POST" onkeypress="javascript:process_keypress(event)">'."\n"; - + echo '<div class="">'."\n"; echo "<H2>" . _("Column's adding") . "</H2><br><br>"."\n"; - + if ($dsondage->format=="A"||$dsondage->format=="A+"){ echo _("Add a new column") .' :<br> <input type="text" name="nouvellecolonne" size="40">'; echo '<br><br>'; echo '<button class="button red retour" type="submit" value="retoursondage" name="retoursondage_x"><strong>Retourner au sondage</strong></button>'."\n"; echo '<button type="submit" name="ajoutercolonne_x" value="Ajouter une colonne" class="button green poursuivre" alt="Valider"><strong>Valider</strong></button>'."\n"; } else { - //ajout d'une date avec creneau horaire + //ajout d'une date avec creneau horaire echo _("You can add a new scheduling date to your poll.<br> If you just want to add a new hour to an existant date, put the same date and choose a new hour.") .'<br><br> '."\n"; echo _("Add a date") .' :<br><br>'."\n"; echo '<select name="nouveaujour"> '."\n"; @@ -214,7 +214,7 @@ if (isset($_POST["ajoutsujet"]) || isset($_POST["ajoutsujet_x"])) { } echo '</SELECT>'."\n"; - + echo '<select name="nouvelleannee"> '."\n"; echo '<OPTION VALUE="vide"></OPTION>'."\n"; for ($i = date("Y"); $i < (date("Y") + 5); $i++) { @@ -264,10 +264,10 @@ if (isset($_POST["ajoutsujet"]) || isset($_POST["ajoutsujet_x"])) { bandeau_pied(); - + echo'</body>'."\n"; echo '</html>'."\n"; - die(); + die(); } if (isset($_POST["suppressionsondage_x"])) { @@ -290,9 +290,9 @@ if (isset($_POST["suppressionsondage_x"])) { echo '</div>'."\n"; echo '<div class="separateur"> </div>'; - + bandeau_pied(); - + echo'</body>'."\n"; echo '</html>'."\n"; die(); @@ -306,9 +306,9 @@ if (isset($_POST["confirmesuppression"]) || isset($_POST["confirmesuppression_x" if ( remove_sondage( $connect, $numsondage ) ) { // on ecrit dans le fichier de logs la suppression du sondage error_log($date . " SUPPRESSION: $dsondage->id_sondage\t$dsondage->format\t$dsondage->nom_admin\t$dsondage->mail_admin\n", 3, 'admin/logs_studs.txt'); - + //envoi du mail a l'administrateur du sondage - sendEmail( $adresseadmin, + sendEmail( $adresseadmin, _("[ADMINISTRATOR] Removing of your poll") . ' ' . NOMAPPLICATION, _("You have removed your poll. \nYou can make new polls with this link") . " :\n\n".get_server_name()."index.php \n\n" . @@ -321,10 +321,10 @@ if (isset($_POST["confirmesuppression"]) || isset($_POST["confirmesuppression_x" logo(); bandeau_tete(); bandeau_titre(_("Make your polls")); - + echo '<div class="corps corpscentre">'."\n"; print "<H2>" . _("Your poll has been removed!") . "</H2><br><br>"; - print _("Back to the homepage of ") . ' <a href="'.get_server_name().'index.php"> '.NOMAPPLICATION.'</a>.'."\n"; + print _("Back to the homepage of ") . ' <a href="/"> '.NOMAPPLICATION.'</a>.'."\n"; echo '<br><br><br>'."\n"; echo '</div>'."\n"; sur_bandeau_pied(); @@ -343,20 +343,20 @@ if(isset($_POST['ajoutcomment']) || isset($_POST['ajoutcomment_x'])) { } else { $comment_user = htmlentities(html_entity_decode($_POST["commentuser"], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); } - + if(issetAndNoEmpty('comment') === false) { $err |= COMMENT_EMPTY; } if (issetAndNoEmpty('comment') && !is_error(COMMENT_EMPTY) && !is_error(NO_POLL) && !is_error(COMMENT_USER_EMPTY)) { $comment = htmlentities(html_entity_decode($_POST["comment"], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); - + $sql = 'INSERT INTO comments (id_sondage, comment, usercomment) VALUES ('. $connect->Param('id_sondage').','. $connect->Param('comment').','. $connect->Param('comment_user').')'; $sql = $connect->Prepare($sql); - + $comments = $connect->Execute($sql, array($numsondage, $comment, $comment_user)); if ($comments === false) { $err |= COMMENT_INSERT_FAILED; @@ -377,11 +377,11 @@ sous_bandeau(); echo '<div class="corps">'."\n"; - + echo '<div class="presentationdate"> '."\n"; //affichage du titre du sondage -$titre=str_replace("\\","",$dsondage->titre); +$titre=str_replace("\\","",$dsondage->titre); echo '<H2>'.$titre.'</H2>'."\n"; //affichage du nom de l'auteur du sondage @@ -391,7 +391,7 @@ echo _("Initiator of the poll") .' : '.stripslashes($dsondage->nom_admin).'<br>' if ($dsondage->commentaires){ echo '<br>'. _("Comments") .' :<br>'."\n"; $commentaires=$dsondage->commentaires; - $commentaires=str_replace("\\","",$commentaires); + $commentaires=str_replace("\\","",$commentaires); echo stripslashes(nl2br($commentaires)); echo '<br>'."\n"; } @@ -410,7 +410,7 @@ if (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"])) { if (issetAndNoEmpty('nom')){ $nouveauchoix = ''; $erreur_prenom = false; - + for ($i=0;$i<$nbcolonnes;$i++){ //si la checkbox est cochée alors valeur est egale à 1 if (isset($_POST["choix$i"])){ @@ -419,21 +419,21 @@ if (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"])) { $nouveauchoix.="0"; } } - + $nom = htmlentities(html_entity_decode($_POST["nom"], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); while($user = $user_studs->FetchNextObject(false)) { if ($nom == $user->nom){ $erreur_prenom="yes"; } } - + // Ecriture des choix de l'utilisateur dans la base if (!$erreur_prenom) { $sql = 'INSERT INTO user_studs (nom, id_sondage, reponses) VALUES ('. $connect->Param('nom').','. $connect->Param('numsondage').','. $connect->Param('nouveauchoix').')'; - + $sql = $connect->Prepare($sql); $connect->Execute($sql, array($nom, $numsondage, $nouveauchoix)); } @@ -444,12 +444,12 @@ if (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"])) { //action quand on ajoute une colonne au format AUTRE if (isset($_POST["ajoutercolonne_x"]) && issetAndNoEmpty('nouvellecolonne') && ($dsondage->format == "A" || $dsondage->format == "A+")) { $nouveauxsujets=$dsujet->sujet; - + //on rajoute la valeur a la fin de tous les sujets deja entrés $nouveauxsujets.=","; $nouveauxsujets.=str_replace(","," ",$_POST["nouvellecolonne"]); $nouveauxsujets = htmlentities(html_entity_decode($nouveauxsujets, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); - + //mise a jour avec les nouveaux sujets dans la base $sql = 'UPDATE sujet_studs SET sujet = '.$connect->Param('nouveauxsujets').' WHERE id_sondage = '.$connect->Param('numsondage'); $sql = $connect->Prepare($sql); @@ -466,43 +466,43 @@ if (isset($_POST["ajoutercolonne_x"]) && issetAndNoEmpty('nouvellecolonne') && ( //action quand on ajoute une colonne au format DATE if (isset($_POST["ajoutercolonne_x"]) && ($dsondage->format == "D" || $dsondage->format == "D+")) { $nouveauxsujets=$dsujet->sujet; - + if (isset($_POST["nouveaujour"]) && $_POST["nouveaujour"] != "vide" && isset($_POST["nouveaumois"]) && $_POST["nouveaumois"] != "vide" && isset($_POST["nouvelleannee"]) && $_POST["nouvelleannee"] != "vide") { - + $nouvelledate=mktime(0, 0, 0, $_POST["nouveaumois"], $_POST["nouveaujour"], $_POST["nouvelleannee"]); - + if (isset($_POST["nouvelleheuredebut"]) && $_POST["nouvelleheuredebut"]!="vide"){ $nouvelledate.="@"; $nouvelledate.=$_POST["nouvelleheuredebut"]; $nouvelledate.="h"; - + if ($_POST["nouvelleminutedebut"]!="vide") { $nouvelledate.=$_POST["nouvelleminutedebut"]; } } - + if (isset($_POST["nouvelleheurefin"]) && $_POST["nouvelleheurefin"]!="vide"){ $nouvelledate.="-"; $nouvelledate.=$_POST["nouvelleheurefin"]; $nouvelledate.="h"; - + if ($_POST["nouvelleminutefin"]!="vide") { $nouvelledate.=$_POST["nouvelleminutefin"]; } } - + if($_POST["nouvelleheuredebut"] == "vide" || (isset($_POST["nouvelleheuredebut"]) && isset($_POST["nouvelleheurefin"]) && (($_POST["nouvelleheuredebut"] < $_POST["nouvelleheurefin"]) || (($_POST["nouvelleheuredebut"] == $_POST["nouvelleheurefin"]) && ($_POST["nouvelleminutedebut"] < $_POST["nouvelleminutefin"]))))) { $erreur_ajout_date = false; } else { $erreur_ajout_date = "yes"; } - + //on rajoute la valeur dans les valeurs $datesbase = explode(",",$dsujet->sujet); $taillebase = sizeof($datesbase); - + //recherche de l'endroit de l'insertion de la nouvelle date dans les dates deja entrées dans le tableau if ($nouvelledate < $datesbase[0]) { $cleinsertion = 0; @@ -516,7 +516,7 @@ if (isset($_POST["ajoutercolonne_x"]) && ($dsondage->format == "D" || $dsondage- } } } - + array_splice($datesbase, $cleinsertion, 0, $nouvelledate); $cle = array_search($nouvelledate, $datesbase); $dateinsertion = ''; @@ -524,15 +524,15 @@ if (isset($_POST["ajoutercolonne_x"]) && ($dsondage->format == "D" || $dsondage- $dateinsertion.=","; $dateinsertion.=$datesbase[$i]; } - + $dateinsertion = substr("$dateinsertion", 1); - + //mise a jour avec les nouveaux sujets dans la base if (isset($erreur_ajout_date) && !$erreur_ajout_date){ $sql = 'UPDATE sujet_studs SET sujet = '.$connect->Param('dateinsertion').' WHERE id_sondage = '.$connect->Param('numsondage'); $sql = $connect->Prepare($sql); $connect->Execute($sql, array($dateinsertion, $numsondage)); - + if ($nouvelledate > strtotime($dsondage->date_fin)) { $date_fin=$nouvelledate+200000; $sql = 'UPDATE sondage SET date_fin = '.$connect->Param('date_fin').' WHERE id_sondage = '.$connect->Param('numsondage'); @@ -540,35 +540,35 @@ if (isset($_POST["ajoutercolonne_x"]) && ($dsondage->format == "D" || $dsondage- $connect->Execute($sql, array($date_fin, $numsondage)); } } - + //mise a jour des reponses actuelles correspondant au sujet ajouté $sql = 'UPDATE user_studs SET reponses = '.$connect->Param('reponses').' WHERE nom = '.$connect->Param('nom').' AND id_users='.$connect->Param('id_users'); $sql = $connect->Prepare($sql); while ($data = $user_studs->FetchNextObject(false)) { $ensemblereponses=$data->reponses; $newcar = ''; - + //parcours de toutes les réponses actuelles for ($j = 0; $j < $nbcolonnes; $j++) { $car=substr($ensemblereponses,$j,1); - + //si les reponses ne concerne pas la colonne ajoutée, on concatene if ($j==$cle) { $newcar.="0"; } - + $newcar.=$car; } - + //mise a jour des reponses utilisateurs dans la base if (isset($erreur_ajout_date) && !$erreur_ajout_date){ $connect->Execute($sql, array($newcar, $data->nom, $data->id_users)); } } - + //envoi d'un mail pour prévenir l'administrateur du changement $adresseadmin = $dsondage->mail_admin; - + sendEmail( $adresseadmin, _("[ADMINISTRATOR] New column for your poll"), _("You have added a new column in your poll. \nYou can inform the voters of this change with this link"). @@ -585,12 +585,12 @@ for ($i = 0; $i < $nblignes; $i++) { $compteur=0; $sql = 'DELETE FROM user_studs WHERE nom = '.$connect->Param('nom').' AND id_users = '.$connect->Param('id_users'); $sql = $connect->Prepare($sql); - + while ($data=$user_studs->FetchNextObject(false)) { if ($compteur==$i){ $connect->Execute($sql, array($data->nom, $data->id_users)); } - + $compteur++; } } @@ -608,7 +608,7 @@ while ($dcomment = $comment_user->FetchNextObject(false)) { $sql = $connect->Prepare($sql); $connect->Execute($sql, array($dcomment->id_comment)); } - + $i++; } @@ -622,7 +622,7 @@ for ($i = 0; $i < $nblignes; $i++) { $ligneamodifier=$i; $testligneamodifier="true"; } - + //test pour voir si une ligne est a modifier if (isset($_POST["validermodifier$i"]) || isset($_POST['validermodifier'.$i.'_x'])) { $modifier=$i; @@ -642,9 +642,9 @@ if ($testmodifier) { $nouveauchoix.="0"; } } - + $compteur=0; - + while ($data=$user_studs->FetchNextObject(false)) { //mise a jour des données de l'utilisateur dans la base SQL if ($compteur==$modifier) { @@ -652,7 +652,7 @@ if ($testmodifier) { $sql = $connect->Prepare($sql); $connect->Execute($sql, array($nouveauchoix, $data->nom, $data->id_users)); } - + $compteur++; } } @@ -664,7 +664,7 @@ for ($i = 0; $i < $nbcolonnes; $i++) { $toutsujet = explode(",",$dsujet->sujet); $j = 0; $nouveauxsujets = ''; - + //parcours de tous les sujets actuels while (isset($toutsujet[$j])) { //si le sujet n'est pas celui qui a été effacé alors on concatene @@ -672,22 +672,22 @@ for ($i = 0; $i < $nbcolonnes; $i++) { $nouveauxsujets .= ','; $nouveauxsujets .= $toutsujet[$j]; } - + $j++; } - + //on enleve la virgule au début $nouveauxsujets = substr("$nouveauxsujets", 1); - + //nettoyage des reponses actuelles correspondant au sujet effacé $compteur = 0; $sql = 'UPDATE user_studs SET reponses = '.$connect->Param('reponses').' WHERE nom = '.$connect->Param('nom').' AND id_users = '.$connect->Param('id_users'); $sql = $connect->Prepare($sql); - + while ($data = $user_studs->FetchNextObject(false)) { $newcar = ''; $ensemblereponses = $data->reponses; - + //parcours de toutes les réponses actuelles for ($j = 0; $j < $nbcolonnes; $j++) { $car=substr($ensemblereponses, $j, 1); @@ -696,13 +696,13 @@ for ($i = 0; $i < $nbcolonnes; $i++) { $newcar .= $car; } } - + $compteur++; - + //mise a jour des reponses utilisateurs dans la base $connect->Execute($sql, array($newcar, $data->nom, $data->id_users)); } - + //mise a jour des sujets dans la base $sql = 'UPDATE sujet_studs SET sujet = '.$connect->Param('nouveauxsujets').' WHERE id_sondage = '.$connect->Param('numsondage'); $sql = $connect->Prepare($sql); @@ -720,7 +720,7 @@ if ($sondage !== false) { $sql = 'SELECT * FROM sujet_studs WHERE id_sondage = '.$connect->Param('numsondage'); $sql = $connect->Prepare($sql); $sujets = $connect->Execute($sql, array($numsondage)); - + $sql = 'SELECT * FROM user_studs WHERE id_sondage = '.$connect->Param('numsondage').' order by id_users'; $sql = $connect->Prepare($sql); $user_studs = $connect->Execute($sql, array($numsondage)); @@ -736,8 +736,8 @@ if ($sondage !== false) { print "" . _("Back to the homepage of ") . " <a href=\"index.php\"> ".NOMAPPLICATION."</A>. "."\n"; echo '<br><br><br><br>'."\n"; echo '</div>'."\n"; - - + + bandeau_pied(); echo'</body>'."\n"; echo '</html>'."\n"; @@ -776,27 +776,27 @@ echo '</tr>'."\n"; //si le sondage est un sondage de date if ($dsondage->format=="D"||$dsondage->format=="D+") { - + //affichage des sujets du sondage echo '<tr>'."\n"; echo '<td></td>'."\n"; echo '<td></td>'."\n"; - + //affichage des années $colspan=1; for ($i = 0; $i < count($toutsujet); $i++) { $current = $toutsujet[$i]; - + if (strpos($toutsujet[$i], '@') !== false) { $current = substr($toutsujet[$i], 0, strpos($toutsujet[$i], '@')); } - + if (isset($toutsujet[$i+1]) && strpos($toutsujet[$i+1], '@') !== false) { $next = substr($toutsujet[$i+1], 0, strpos($toutsujet[$i+1], '@')); } elseif (isset($toutsujet[$i+1])) { $next = $toutsujet[$i+1]; } - + if (isset($toutsujet[$i+1]) && strftime("%Y",$current) == strftime("%Y",$next)){ $colspan++; } else { @@ -804,28 +804,28 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") { $colspan=1; } } - + echo '<td class="annee"><input type="image" name="ajoutsujet" src="images/add-16.png" alt="' . _('Add') . '"></td>'."\n"; echo '</tr>'."\n"; echo '<tr>'."\n"; echo '<td></td>'."\n"; echo '<td></td>'."\n"; - + //affichage des mois $colspan = 1; for ($i = 0; $i < count($toutsujet); $i++) { $current = $toutsujet[$i]; - + if (strpos($toutsujet[$i], '@') !== false) { $current = substr($toutsujet[$i], 0, strpos($toutsujet[$i], '@')); } - + if (isset($toutsujet[$i+1]) && strpos($toutsujet[$i+1], '@') !== false) { $next = substr($toutsujet[$i+1], 0, strpos($toutsujet[$i+1], '@')); } elseif (isset($toutsujet[$i+1])) { $next = $toutsujet[$i+1]; } - + if (isset($toutsujet[$i+1]) && strftime("%B", $current) == strftime("%B", $next) && strftime("%Y", $current) == strftime("%Y", $next)){ $colspan++; } else { @@ -834,32 +834,32 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") { } else { echo '<td colspan='.$colspan.' class="mois">'.strftime("%B",$current).'</td>'."\n"; } - + $colspan=1; } } - + echo '<td class="mois"><input type="image" name="ajoutsujet" src="images/add-16.png" alt="' . _('Add') . '"></td>'."\n"; echo '</tr>'."\n"; echo '<tr>'."\n"; echo '<td></td>'."\n"; echo '<td></td>'."\n"; - + //affichage des jours $colspan = 1; for ($i = 0; $i < count($toutsujet); $i++) { $current = $toutsujet[$i]; - + if (strpos($toutsujet[$i], '@') !== false) { $current = substr($toutsujet[$i], 0, strpos($toutsujet[$i], '@')); } - + if (isset($toutsujet[$i+1]) && strpos($toutsujet[$i+1], '@') !== false) { $next = substr($toutsujet[$i+1], 0, strpos($toutsujet[$i+1], '@')); } elseif (isset($toutsujet[$i+1])) { $next = $toutsujet[$i+1]; } - + if (isset($toutsujet[$i+1]) && strftime("%a %e",$current)==strftime("%a %e",$next)&&strftime("%B",$current)==strftime("%B",$next)){ $colspan++; } else { @@ -868,20 +868,20 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") { } else { echo '<td colspan='.$colspan.' class="jour">'.strftime("%a %e",$current).'</td>'."\n"; } - + $colspan=1; } } - + echo '<td class="jour"><input type="image" name="ajoutsujet" src="images/add-16.png" alt="' . _('Add') . '"></td>'."\n"; echo '</tr>'."\n"; - + //affichage des horaires if (strpos($dsujet->sujet,'@') !== false) { echo '<tr>'."\n"; echo '<td></td>'."\n"; echo '<td></td>'."\n"; - + for ($i = 0; isset($toutsujet[$i]); $i++) { $heures=explode("@", $toutsujet[$i]); if (isset($heures[1])) { @@ -890,22 +890,22 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") { echo '<td class="heure"></td>'."\n"; } } - + echo '<td class="heure"><input type="image" name="ajoutsujet" src="images/add-16.png" alt="' . _('Add') . '"></td>'."\n"; echo '</tr>'."\n"; } } else { $toutsujet=str_replace("°","'",$toutsujet); - + //affichage des sujets du sondage echo '<tr>'."\n"; echo '<td></td>'."\n"; echo '<td></td>'."\n"; - + for ($i = 0; isset($toutsujet[$i]); $i++) { echo '<td class="sujet">'.stripslashes($toutsujet[$i]).'</td>'."\n"; } - + echo '<td class="sujet"><input type="image" name="ajoutsujet" src="images/add-16.png" alt="' . _('Add') . '"></td>'."\n"; echo '</tr>'."\n"; } @@ -917,14 +917,14 @@ $compteur = 0; while ($data = $user_studs->FetchNextObject(false)) { $ensemblereponses = $data->reponses; - + echo '<tr>'."\n"; echo '<td><input type="image" name="effaceligne'.$compteur.'" value="Effacer" src="images/cancel.png" alt="Icone efface"></td>'."\n"; - + //affichage du nom $nombase=str_replace("°","'",$data->nom); echo '<td class="nom">'.stripslashes($nombase).'</td>'."\n"; - + //si la ligne n'est pas a changer, on affiche les données if (!$testligneamodifier) { for ($k = 0; $k < $nbcolonnes; $k++) { @@ -940,7 +940,7 @@ while ($data = $user_studs->FetchNextObject(false)) { } } } else { //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs - + //si c'est bien la ligne a modifier on met les checkbox if ($compteur == "$ligneamodifier") { for ($j = 0; $j < $nbcolonnes; $j++) { @@ -954,7 +954,7 @@ while ($data = $user_studs->FetchNextObject(false)) { } else { //sinon on affiche les lignes normales for ($k = 0; $k < $nbcolonnes; $k++) { $car = substr($ensemblereponses, $k, 1); - + if ($car == "1") { echo '<td class="ok">OK</td>'."\n"; if (isset($somme[$k]) === false) { @@ -967,12 +967,12 @@ while ($data = $user_studs->FetchNextObject(false)) { } } } - + //a la fin de chaque ligne se trouve les boutons modifier if (!$testligneamodifier=="true") { echo '<td class=somme><input type="image" name="modifierligne'.$compteur.'" value="Modifier" src="images/info.png" alt="Icone infos"></td>'."\n"; } - + //demande de confirmation pour modification de ligne for ($i = 0; $i < $nblignes; $i++) { if (isset($_POST["modifierligne$i"]) || isset($_POST['modifierligne'.$i.'_x'])) { @@ -981,7 +981,7 @@ while ($data = $user_studs->FetchNextObject(false)) { } } } - + $compteur++; echo '</tr>'."\n"; } @@ -1009,7 +1009,7 @@ for ($i = 0; $i < $nbcolonnes + 1; $i++) { if ($i == "0") { $meilleurecolonne = $somme[$i]; } - + if (isset($somme[$i]) && $somme[$i] > $meilleurecolonne){ $meilleurecolonne = $somme[$i]; } @@ -1028,11 +1028,11 @@ for ($i = 0; $i < $nbcolonnes; $i++) { } else { $affichesomme = ''; } - + if ($affichesomme == "") { $affichesomme = "0"; } - + if (isset($somme[$i]) === true && isset($meilleurecolonne) === true && $somme[$i] == $meilleurecolonne){ echo '<td class="somme">'.$affichesomme.'</td>'."\n"; } else { @@ -1098,10 +1098,10 @@ $meilleursujet = ''; for ($i = 0; $i < $nbcolonnes; $i++) { if (isset($somme[$i]) === true && isset($meilleurecolonne) === true && $somme[$i] == $meilleurecolonne){ $meilleursujet.=", "; - + if ($dsondage->format == "D" || $dsondage->format == "D+") { $meilleursujetexport = $toutsujet[$i]; - + if (strpos($toutsujet[$i], '@') !== false) { $toutsujetdate = explode("@", $toutsujet[$i]); if ($_SESSION["langue"] == "EN") { @@ -1119,7 +1119,7 @@ for ($i = 0; $i < $nbcolonnes; $i++) { } else { $meilleursujet.=$toutsujet[$i]; } - + $compteursujet++; } } @@ -1181,13 +1181,13 @@ $sql = $connect->Prepare($sql); $comment_user = $connect->Execute($sql, array($numsondage)); if ($comment_user->RecordCount() != 0) { print "<br><b>" . _("Comments") . " :</b><br>\n"; - + $i = 0; while ( $dcomment=$comment_user->FetchNextObject(false)) { print "<input type=\"image\" name=\"suppressioncomment$i\" src=\"images/cancel.png\" alt=\"supprimer commentaires\"> ". stripslashes($dcomment->usercomment) ." : ".stripslashes($dcomment->comment) ." <br>"; $i++; } - + echo '<br>'; } @@ -1208,7 +1208,7 @@ echo _("Remove your poll") .' : <input type="image" name="suppressionsondage" va echo '</form>'."\n"; if ($dsondage->format == "D" || $dsondage->format == "D+") { - echo '<form name="formulaire2" action="'.get_server_name().'exportpdf.php" method="POST" onkeypress="javascript:process_keypress(event)" class="formulaire2">'."\n"; + echo '<form name="formulaire2" action="/exportpdf.php" method="POST" onkeypress="javascript:process_keypress(event)" class="formulaire2">'."\n"; echo _("Generate the convocation letter (.PDF), choose the place to meet and validate") .'<br>'; echo '<input type="text" name="lieureunion" size="100" value="" />'; echo '<input type="hidden" name="sondage" value="$numsondageadmin" />'; diff --git a/bandeaux.php b/bandeaux.php index 7f2af3e3..bcd2b203 100644 --- a/bandeaux.php +++ b/bandeaux.php @@ -1,4 +1,4 @@ -<?php +<?php //========================================================================== // //Université de Strasbourg - Direction Informatique @@ -10,10 +10,10 @@ //Ce logiciel est régi par la licence CeCILL-B soumise au droit français et //respectant les principes de diffusion des logiciels libres. Vous pouvez //utiliser, modifier et/ou redistribuer ce programme sous les conditions -//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA +//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA //sur le site "http://www.cecill.info". // -//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez +//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez //pris connaissance de la licence CeCILL-B, et que vous en avez accepté les //termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE. // @@ -26,10 +26,10 @@ //borghesi@unistra.fr // //This software is governed by the CeCILL-B license under French law and -//abiding by the rules of distribution of free software. You can use, +//abiding by the rules of distribution of free software. You can use, //modify and/ or redistribute the software under the terms of the CeCILL-B //license as circulated by CEA, CNRS and INRIA at the following URL -//"http://www.cecill.info". +//"http://www.cecill.info". // //The fact that you are presently reading this means that you have had //knowledge of the CeCILL-B license and that you accept its terms. You can @@ -37,16 +37,15 @@ // //========================================================================== -// pour get_server_name() include_once('fonctions.php'); function framanav() { if (file_exists($_SERVER['DOCUMENT_ROOT']."/framanav/nav.inc.html")) { - echo "\n".'<!-- Framanav --> '."\n";; - echo '<script src="/framanav/scripts/jquery.min.js" type="text/javascript"></script>'."\n"; - include_once($_SERVER['DOCUMENT_ROOT']."/framanav/nav.inc.html"); - echo '<!-- /Framanav --> '."\n"; + echo "\n".'<!-- Framanav --> '."\n";; + echo '<script src="/framanav/scripts/jquery.min.js" type="text/javascript"></script>'."\n"; + include_once($_SERVER['DOCUMENT_ROOT']."/framanav/nav.inc.html"); + echo '<!-- /Framanav --> '."\n"; } } @@ -73,7 +72,7 @@ function gAnalytics() { function logo () { if(defined('LOGOBANDEAU')) { - echo '<div class="logo"><img src="'.get_server_name().LOGOBANDEAU.'" height="74" alt="logo"></div>'."\n"; + echo '<div class="logo"><img src="/' . LOGOBANDEAU . '" height="74" alt="logo"></div>'."\n"; } } @@ -83,11 +82,11 @@ function bandeau_tete() { if ( IMAGE_TITRE ) { - echo '<div class="bandeau"><a href="'.get_server_name().'" title="Accueil '.NOMAPPLICATION.'"><img src="'.get_server_name().IMAGE_TITRE.'" title="Accueil '.NOMAPPLICATION.'" alt="'.NOMAPPLICATION.'"></a></div>'."\n"; + echo '<div class="bandeau"><a href="/" title="Accueil '.NOMAPPLICATION.'"><img src="/' . IMAGE_TITRE. '" title="Accueil '.NOMAPPLICATION.'" alt="'.NOMAPPLICATION.'"></a></div>'."\n"; } else { - echo '<div class="bandeau"><a href="'.get_server_name().'" title="Accueil '.NOMAPPLICATION.'">'.NOMAPPLICATION.'</a></div>'."\n"; + echo '<div class="bandeau"><a href="/" title="Accueil '.NOMAPPLICATION.'">'.NOMAPPLICATION.'</a></div>'."\n"; } ; @@ -104,12 +103,12 @@ function bandeau_titre($titre) function liste_lang() { global $ALLOWED_LANGUAGES; - + $str = ''; foreach ($ALLOWED_LANGUAGES as $k => $v ) { $str .= '<a class="button small gray" href="' . $_SERVER['PHP_SELF'] . '?lang=' . $k . '">' . $v . '</a>' . "\n" ; } - + return $str; } @@ -118,12 +117,12 @@ function liste_lang() function sous_bandeau() { /*echo '<div class="sousbandeau">' . - '<a href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' . + '<a href="/">'. _("Home") .'</a>' . '<a href="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' . - '<a href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' . - //'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented - '<a href="' . get_server_name() . 'apropos.php">'. _("About") .'</a>' . - '<a href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' . + '<a href="/contacts.php">'. _("Contact") .'</a>' . + //'<a href="/sources/sources.php">'. _("Sources") .'</a>' . //not implemented + '<a href="/apropos.php">'. _("About") .'</a>' . + '<a href="/admin/index.php">'. _("Admin") .'</a>' . '<span class="sousbandeau sousbandeaulangue">' . liste_lang() . '</span>'. '</div>' . "\n";*/ @@ -133,25 +132,25 @@ function sous_bandeau() function sous_bandeau_admin() { echo '<div class="sousbandeau">' . - '<a class="button small gray" href="' . get_server_name() . 'index.php">'. _("Home") .'</a>'; - + '<a class="button small gray" href="/">'. _("Home") .'</a>'; + if(is_readable('logs_studs.txt')) { - echo '<a class="button small gray" href="' . get_server_name() . 'logs_studs.txt">'. _("Logs") .'</a>'; + echo '<a class="button small gray" href="/logs_studs.txt">'. _("Logs") .'</a>'; } - - echo '<a class="button small gray" href="' . get_server_name() . '../scripts/nettoyage_sondage.php">'. _("Cleaning") .'</a>' . + + echo '<a class="button small gray" href="/../scripts/nettoyage_sondage.php">'. _("Cleaning") .'</a>' . '<span class="sousbandeau sousbandeaulangue">' . liste_lang() . '</span>'. '</div>'."\n"; - - gAnalytics(); + + gAnalytics(); } function sous_bandeau_choix() { /*echo '<div class="sousbandeau">' . - '<a href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' . + '<a href="/">'. _("Home") .'</a>' . '</div>'."\n";*/ } @@ -168,16 +167,16 @@ function bandeau_pied() //echo '<div class="bandeaupied">'. _("Université de Strasbourg. Creation: Guilhem BORGHESI. 2008-2009") .'</div>'."\n"; echo '<div class="separateur"> </div>'; echo '<div class="sousbandeau">' . - '<a class="button small gray" href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' . + '<a class="button small gray" href="/">'. _("Home") .'</a>' . '<a class="button small gray" href="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' . - '<a class="button small gray" href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' . - //'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented - '<a class="button small gray" href="' . get_server_name() . 'apropos.php">'. _("About") .'</a>' . - //'<a class="button small gray" href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' . + '<a class="button small gray" href="/contacts.php">'. _("Contact") .'</a>' . + //'<a href="/sources/sources.php">'. _("Sources") .'</a>' . //not implemented + '<a class="button small gray" href="/apropos.php">'. _("About") .'</a>' . + //'<a class="button small gray" href="/admin/index.php">'. _("Admin") .'</a>' . '<span class="sousbandeau sousbandeaulangue">' . liste_lang() . '</span>'. '</div>' . "\n"; - gAnalytics(); + gAnalytics(); } @@ -187,14 +186,14 @@ function bandeau_pied_mobile() '<div class="bandeaupiedmobile">'. _("Université de Strasbourg. Creation: Guilhem BORGHESI. 2008-2009") .'</div>'."\n";*/ echo '<div class="separateur"> </div>'; echo '<div class="sousbandeau">' . - '<a class="button small gray" href="' . get_server_name() . 'index.php">'. _("Home") .'</a>' . + '<a class="button small gray" href="/">'. _("Home") .'</a>' . '<a class="button small gray" href="' . getUrlSondage('aqg259dth55iuhwm').'">'. _("Example") .'</a>' . - '<a class="button small gray" href="' . get_server_name() . 'contacts.php">'. _("Contact") .'</a>' . - //'<a href="' . get_server_name() . 'sources/sources.php">'. _("Sources") .'</a>' . //not implemented - '<a class="button small gray" href="' . get_server_name() . 'apropos.php">'. _("About") .'</a>' . - //'<a class="button small gray" href="' . get_server_name() . 'admin/index.php">'. _("Admin") .'</a>' . + '<a class="button small gray" href="/contacts.php">'. _("Contact") .'</a>' . + //'<a href="/sources/sources.php">'. _("Sources") .'</a>' . //not implemented + '<a class="button small gray" href="/apropos.php">'. _("About") .'</a>' . + //'<a class="button small gray" href="/admin/index.php">'. _("Admin") .'</a>' . '<span class="sousbandeau sousbandeaulangue">' . liste_lang() . '</span>'. '</div>' . "\n"; - gAnalytics(); + gAnalytics(); } diff --git a/exportpdf.php b/exportpdf.php index 68d5edfa..2f37f7e3 100644 --- a/exportpdf.php +++ b/exportpdf.php @@ -10,10 +10,10 @@ //Ce logiciel est régi par la licence CeCILL-B soumise au droit français et //respectant les principes de diffusion des logiciels libres. Vous pouvez //utiliser, modifier et/ou redistribuer ce programme sous les conditions -//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA +//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA //sur le site "http://www.cecill.info". // -//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez +//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez //pris connaissance de la licence CeCILL-B, et que vous en avez accepté les //termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE. // @@ -26,10 +26,10 @@ //borghesi@unistra.fr // //This software is governed by the CeCILL-B license under French law and -//abiding by the rules of distribution of free software. You can use, +//abiding by the rules of distribution of free software. You can use, //modify and/ or redistribute the software under the terms of the CeCILL-B //license as circulated by CEA, CNRS and INRIA at the following URL -//"http://www.cecill.info". +//"http://www.cecill.info". // //The fact that you are presently reading this means that you have had //knowledge of the CeCILL-B license and that you accept its terms. You can @@ -78,7 +78,7 @@ $PDF->Text(140,240,utf8_decode($dsondage->nom_admin)); $PDF->SetFont('Arial','B',8); // TODO: translate -$PDF->Text(35,275,"Cette lettre de convocation a été générée automatiquement par ".NOMAPPLICATION." sur ".get_server_name()); +$PDF->Text(35,275,"Cette lettre de convocation a été générée automatiquement par ".NOMAPPLICATION." sur ". $_SERVER['SERVER_NAME']); //Sortie $PDF->Output(); diff --git a/fonctions.php b/fonctions.php index db738a42..7f25b441 100644 --- a/fonctions.php +++ b/fonctions.php @@ -10,10 +10,10 @@ //Ce logiciel est régi par la licence CeCILL-B soumise au droit français et //respectant les principes de diffusion des logiciels libres. Vous pouvez //utiliser, modifier et/ou redistribuer ce programme sous les conditions -//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA +//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA //sur le site "http://www.cecill.info". // -//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez +//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez //pris connaissance de la licence CeCILL-B, et que vous en avez accepté les //termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE. // @@ -26,10 +26,10 @@ //borghesi@unistra.fr // //This software is governed by the CeCILL-B license under French law and -//abiding by the rules of distribution of free software. You can use, +//abiding by the rules of distribution of free software. You can use, //modify and/ or redistribute the software under the terms of the CeCILL-B //license as circulated by CEA, CNRS and INRIA at the following URL -//"http://www.cecill.info". +//"http://www.cecill.info". // //The fact that you are presently reading this means that you have had //knowledge of the CeCILL-B license and that you accept its terms. You can @@ -53,47 +53,35 @@ function connexion_base() return $DB; } - function get_server_name() { - $scheme = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https' : 'http'; - - $get = explode('/', dirname($_SERVER["SCRIPT_NAME"])); - $folder = explode('/', str_replace('\\', '/', dirname(__FILE__))); - $communs = array_intersect($get, $folder); - $base = implode('/', $communs); - $url = sprintf("%s://%s%s", $scheme, STUDS_URL, $base); - - if (!preg_match("|/$|", $url)) { - $url = $url."/"; - } - - return $url; + $scheme = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http'; + return $scheme . '//' . $_SERVER['SERVER_NAME'] . '/'; } function get_sondage_from_id($id) { global $connect; - + // Ouverture de la base de données if(preg_match(";^[\w\d]{16}$;i",$id)) { $sql = 'SELECT sondage.*,sujet_studs.sujet FROM sondage LEFT OUTER JOIN sujet_studs ON sondage.id_sondage = sujet_studs.id_sondage WHERE sondage.id_sondage = '.$connect->Param('id_sondage'); - + $sql = $connect->Prepare($sql); $sondage=$connect->Execute($sql, array($id)); - + if ($sondage === false) { return false; } - + $psondage = $sondage->FetchObject(false); $psondage->date_fin = strtotime($psondage->date_fin); return $psondage; } - + return false; } @@ -104,7 +92,7 @@ function is_error($cerr) if ( $err == 0 ) { return false; } - + return (($err & $cerr) != 0 ); } @@ -129,9 +117,9 @@ function print_header($js = false, $nom_sondage = '') <title>'.NOMAPPLICATION.'</title>'; } echo ' - <link rel="stylesheet" type="text/css" href="'.get_server_name().'style.css"> - <link rel="stylesheet" type="text/css" href="'.get_server_name().'print.css" media="print">'; - + <link rel="stylesheet" type="text/css" href="/style.css"> + <link rel="stylesheet" type="text/css" href="/print.css" media="print">'; + echo '</head>'; } @@ -157,7 +145,7 @@ function check_table_sondage() function validateEmail($email) { $pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD'; - + return (bool)preg_match($pattern, $email); } @@ -206,7 +194,7 @@ function issetAndNoEmpty($name, $tableau = null) if ($tableau === null) { $tableau = $_POST; } - + return (isset($tableau[$name]) === true && empty($tableau[$name]) === false); } @@ -232,7 +220,7 @@ function getUrlSondage($id, $admin = false) $url = get_server_name().'studs.php?sondage='.$id; } } - + return $url; } diff --git a/index.php b/index.php index adb6a6ee..e81c2cf5 100644 --- a/index.php +++ b/index.php @@ -10,10 +10,10 @@ //Ce logiciel est régi par la licence CeCILL-B soumise au droit français et //respectant les principes de diffusion des logiciels libres. Vous pouvez //utiliser, modifier et/ou redistribuer ce programme sous les conditions -//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA +//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA //sur le site "http://www.cecill.info". // -//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez +//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez //pris connaissance de la licence CeCILL-B, et que vous en avez accepté les //termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE. // @@ -26,10 +26,10 @@ //borghesi@unistra.fr // //This software is governed by the CeCILL-B license under French law and -//abiding by the rules of distribution of free software. You can use, +//abiding by the rules of distribution of free software. You can use, //modify and/ or redistribute the software under the terms of the CeCILL-B //license as circulated by CEA, CNRS and INRIA at the following URL -//"http://www.cecill.info". +//"http://www.cecill.info". // //The fact that you are presently reading this means that you have had //knowledge of the CeCILL-B license and that you accept its terms. You can @@ -72,7 +72,7 @@ echo '<div class=corps>'."\n"; #echo '<p>'. _("Making polls to schedule meetings or events, quickly and easily. <br> You can also run polls to determine what will be your next meeting place, the meeting topic or anything like the country you would like to visit during your next holidays.") .'</p>'."\n".'<br>'."\n"; #echo '<div class="nouveau_sondage"><b>'. _("Make a poll") .'</b>'; # '<span>' . -# '<a href="' . get_server_name() . 'infos_sondage.php"><img alt="' . _('Make a poll') . '" src="images/next-32.png" /></a>' . +# '<a href="/infos_sondage.php"><img alt="' . _('Make a poll') . '" src="images/next-32.png" /></a>' . # '</span>'; #echo '</div>' . "\n"; @@ -97,4 +97,4 @@ echo '</form>'."\n"; bandeau_pied(); echo '</body>'."\n"; -echo '</html>'."\n"; \ No newline at end of file +echo '</html>'."\n"; -- GitLab