echo '<tr align=center><td>' . _("Poll ID") . '</td><td>' . _("Format") . '</td><td>' . _("Title") . '</td><td>' . _("Author") . '</td><td>' . _("Expiration's date") . '</td><td>' . _("Users") . '</td><td colspan=3>' . _("Actions") . '</td>' . "\n"; $i = 0; while ($dsondage = $sondage->FetchNextObject(false)) { /* possible en 1 bonne requête dans $sondage */ $sujets = $connect->Execute("select * from sujet_studs where id_sondage='{$dsondage->id_sondage}'"); $dsujets = $sujets->FetchObject(false); $user_studs = $connect->Execute("select * from user_studs where id_sondage='{$dsondage->id_sondage}'"); $nbuser = $user_studs->RecordCount(); echo '<tr align=center><td>' . $dsondage->id_sondage . '</td><td>' . $dsondage->format . '</td><td>' . stripslashes($dsondage->titre) . '</td><td>' . stripslashes($dsondage->nom_admin) . '</td>'; if (strtotime($dsondage->date_fin) > time()) { echo '<td>' . date("d/m/y", strtotime($dsondage->date_fin)) . '</td>'; } else { echo '<td><font color=#FF0000>' . date("d/m/y", strtotime($dsondage->date_fin)) . '</font></td>'; } echo '<td>' . $nbuser . '</td>' . "\n"; echo '<td><a href="' . getUrlSondage($dsondage->id_sondage) . '">' . _("See the poll") . '</a></td>' . "\n"; echo '<td><a href="' . getUrlSondage($dsondage->id_sondage_admin, true) . '">' . _("Change the poll") . '</a></td>' . "\n"; echo '<td><input type="submit" name="supprimersondage' . $dsondage->id_sondage . '" value="' . _("Remove the poll") . '"></td>' . "\n"; echo '</tr>' . "\n"; $i++; } echo '</table>' . "\n"; echo '</div>' . "\n"; // fin du formulaire et de la page web echo '</form>' . "\n"; echo '<div class="separateur"> </div>'; echo '</body>' . "\n"; echo '</html>' . "\n"; // si on annule la suppression, rafraichissement de la page if (issetAndNoEmpty('annulesuppression') === true) { }
if ($numerojour >= $jourAJ && $_SESSION["mois"] == $moisAJ && $_SESSION["annee"] == $anneeAJ || $_SESSION["mois"] > $moisAJ && $_SESSION["annee"] == $anneeAJ || $_SESSION["annee"] > $anneeAJ) { print '<td align="center" class="libre"><input type="submit" class="bouton ON" name="choixjourajout[]" value="' . $numerojour . '"></td>' . "\n"; } else { //bouton gris print '<td align="center" class="avant">' . $numerojour . '</td>' . "\n"; } } } } //fin du tableau print '</tr>' . "\n"; print '</table>' . "\n"; print '</div></div>' . "\n"; print '<div class="bodydate"><div class="center">' . "\n"; // affichage de tous les jours choisis if (issetAndNoEmpty('totalchoixjour', $_SESSION) || $erreur) { //affichage des jours print '<br>' . "\n"; print '<div align="left">'; print '<strong>' . $langs->trans("SelectedDays") . ':</strong>' . "<br>\n"; print $langs->trans("SelectDayDesc") . "<br>\n"; print '</div><br>'; print '<table>' . "\n"; print '<tr>' . "\n"; print '<td></td>' . "\n"; for ($i = 0; $i < $_SESSION["nbrecaseshoraires"]; $i++) { $j = $i + 1; print '<td classe="somme"><div class="center">' . $langs->trans("Time") . ' ' . $j . '</div></td>' . "\n"; } if ($_SESSION["nbrecaseshoraires"] < 10) { print '<td classe="somme"><input type="image" name="ajoutcases" src="../img/add-16.png"></td>' . "\n";
echo _("Name") . ' : <input type=text name="commentuser"><br>' . "\n"; echo '<textarea name="comment" rows="2" cols="40"></textarea>' . "\n"; echo '<input type="image" name="ajoutcomment" value="Ajouter un commentaire" src="images/accept.png" alt="Valider"><br>' . "\n"; //suppression du sondage echo '<br>' . "\n"; echo _("Remove your poll") . ' : <input type="image" name="suppressionsondage" value="' . _("Remove the poll") . '" src="images/cancel.png" alt="' . _('Cancel') . '"><br><br>' . "\n"; echo '</form>' . "\n"; if ($dsondage->format == "D" || $dsondage->format == "D+") { 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" />'; echo '<input type="hidden" name="meilleursujet" value="$meilleursujetexport" />'; echo '<input type="image" name="exportpdf" value="Export en PDF" src="images/accept.png" alt="Export PDF"><br><br>'; echo '</form>' . "\n"; // '<font color="#FF0000">'. _("Enter a meeting place!") .'</font><br><br>'."\n"; } // TODO if (isset($_POST["exportpdf_x"]) && !issetAndNoEmpty('lieureunion')) { echo '<font color="#FF0000">' . _("Enter a meeting place!") . '</font><br><br>' . "\n"; } echo '<a name="bas"></a>' . "\n"; echo '<br><br>' . "\n"; //fin de la partie GESTION et beandeau de pied echo '</p>' . "\n"; echo '</div>'; echo '<div class="separateur"> </div>'; bandeau_pied_mobile(); echo '</form>' . "\n"; echo '</body>' . "\n"; echo '</html>' . "\n";
$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; } } } // Action quand on clique le bouton participer $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)); $nbcolonnes = substr_count($dsondage->sujet, ',') + 1; if (!is_error(NO_POLL) && (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"]))) { //Si le nom est bien entré if (issetAndNoEmpty('nom') === false) { $err |= NAME_EMPTY; } if (!is_error(NAME_EMPTY) && (!(USE_REMOTE_USER && isset($_SERVER['REMOTE_USER'])) || $_POST["nom"] == $_SESSION["nom"])) { $nouveauchoix = ''; for ($i = 0; $i < $nbcolonnes; $i++) { // Si la checkbox est enclenchée alors la valeur est 1 if (isset($_POST["choix{$i}"]) && $_POST["choix{$i}"] == '1') { $nouveauchoix .= "1"; } else { // sinon c'est 0 $nouveauchoix .= "0"; } } $nom = substr($_POST["nom"], 0, 64); // protection contre les XSS : htmlentities
//ajout de cases supplementaires echo '<table><tr>' . "\n"; echo '<td>' . _("5 choices more") . '</td><td><input type="image" name="ajoutcases" value="Retour" src="images/add-16.png"></td>' . "\n"; echo '</tr></table>' . "\n"; echo '<br>' . "\n"; //echo '<table><tr>'."\n"; //echo '<td>'. _("Next") .'</td><td><input type="image" name="fin_sondage_autre" value="Créer le sondage" src="images/next-32.png"></td>'."\n"; //echo '</tr></table>'."\n"; if (!isset($_POST["fin_sondage_autre_x"])) { echo '<button name="fin_sondage_autre_x" value="' . _('Next') . '" type="submit" class="button green poursuivre"><strong>' . _('Next') . '</strong> </button>'; echo '<div style="clear:both"></div>'; } //test de remplissage des cases $testremplissage = ''; for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) { if (isset($_POST["choix"]) && issetAndNoEmpty($i, $_POST["choix"])) { $testremplissage = "ok"; } } //message d'erreur si aucun champ renseigné if ($testremplissage != "ok" && (isset($_POST["fin_sondage_autre"]) || isset($_POST["fin_sondage_autre_x"]))) { print "<br><font color=\"#FF0000\">" . _("Enter at least one choice") . "</font><br><br>" . "\n"; $erreur = true; } //message d'erreur si mauvaise date if ($testdate === false) { print "<br><font color=\"#FF0000\">" . _("Date must be have the format DD/MM/YYYY") . "</font><br><br>" . "\n"; } if ($erreur_injection) { print "<font color=#FF0000>" . _("Characters \" < and > are not permitted") . "</font><br><br>\n"; }
echo '<input type="text" name="adresse" size="40" maxlength="64" value="' . $_SESSION["adresse"] . '"></td>' . "\n"; } if (!$_SESSION["adresse"] && issetAndNoEmpty("poursuivre")) { print "<td><font color=\"#FF0000\">" . _("Enter an email address") . " </font></td>" . "\n"; } elseif ($erreur_adresse && issetAndNoEmpty("poursuivre")) { print "<td><font color=\"#FF0000\">" . _("The address is not correct! (You should enter a valid email address in order to receive the link to your poll)") . "</font></td>" . "\n"; } echo '</tr>' . "\n"; echo '</table>' . "\n"; //focus javascript sur le premier champ echo '<script type="text/javascript">' . "\n"; echo 'document.formulaire.titre.focus();' . "\n"; echo '</script>' . "\n"; #echo '<br>'. _("The fields marked with * are required!") .'<br><br>'."\n"; #affichage du cochage par défaut if (!$_SESSION["studsplus"] && !issetAndNoEmpty('creation_sondage_date') && !issetAndNoEmpty('creation_sondage_autre') && !issetAndNoEmpty('creation_sondage_date_x') && !issetAndNoEmpty('creation_sondage_autre_x')) { $_SESSION["studsplus"] = "+"; } if ($_SESSION["studsplus"] == "+") { $cocheplus = "checked"; } echo '<input type=checkbox name=studsplus ' . $cocheplus . ' id="studsplus"><label for="studsplus">' . _(" Voters can modify their vote themselves.") . '</label><br>' . "\n"; if ($_SESSION["mailsonde"]) { $cochemail = "checked"; } echo '<input type=checkbox name=mailsonde ' . $cochemail . ' id="mailsonde"><label for="mailsonde">' . _(" To receive an email for each new vote.") . '</label><br>' . "\n"; //affichage des boutons pour choisir sondage date ou autre if ($_GET['choix_sondage'] == 'date') { $choix = "creation_sondage_date"; } elseif ($_GET['choix_sondage'] == 'autre') { $choix = "creation_sondage_autre";
echo '<br/><br/>'; // patch crado : on attribue les noms de boutons avec _x pour faire croire qu'on a cliqué sur une image echo '<button name="retourhoraires_x" value="retourhoraires" type="submit" class="button red retour"><strong>' . _('Back to hours') . '</strong> </button>'; echo '<button name="confirmation_x" value="confirmation" type="submit" class="button green poursuivre"><strong>' . _('Create the poll') . '</strong> </button>'; echo '<div style="clear:both"></div>'; } echo '</tr>' . "\n"; echo '</table>' . "\n"; echo '<a name=bas></a>' . "\n"; //fin du formulaire et bandeau de pied echo '</form>' . "\n"; //bandeau de pied //echo '<br><br><br><br>'."\n"; echo '</div>' . "\n"; echo '</div>'; // ajout pyg pour cohérence graphique bandeau_pied_mobile(); echo '</body>' . "\n"; echo '</html>' . "\n"; //bouton de nettoyage de tous les jours choisis if (issetAndNoEmpty('reset')) { for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) { for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { unset($_SESSION["horaires{$i}"][$j]); } } unset($_SESSION["totalchoixjour"]); unset($_SESSION["nbrecaseshoraires"]); echo '<meta http-equiv="refresh" content="0">'; } }