// Add voter to session $_SESSION["savevoter"] = $nom . ',' . (empty($_SESSION["savevoter"]) ? '' : $_SESSION["savevoter"]); // Save voter $listofvoters = explode(',', $_SESSION["savevoter"]); if ($object->mailsonde) { if ($object->fk_user_creat) { $userstatic = new User($db); $userstatic->fetch($object->fk_user_creat); $email = $userstatic->email; } else { $email = $object->mail_admin; } //Linked user may not have an email set if ($email) { include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; $body = $langs->trans('EmailSomeoneVoted', $nom, getUrlSondage($numsondage, true)); $cmailfile = new CMailFile("[" . MAIN_APPLICATION_TITLE . "] " . $langs->trans("Poll") . ': ' . $object->titre, $email, $conf->global->MAIN_MAIL_EMAIL_FROM, $body); $result = $cmailfile->sendfile(); } } } else { dol_print_error($db); } } } else { setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), 'errors'); } } // Update vote $testmodifier = false; $testligneamodifier = false;
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) { }
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"; die; } //on recupere les données et les sujets du sondage $dsujet = $sujets->FetchObject(false); $dsondage = $sondage->FetchObject(false); $toutsujet = explode(",", $dsujet->sujet); $toutsujet = str_replace("@", "<br>", $toutsujet); $toutsujet = str_replace("°", "'", $toutsujet); $nbcolonnes = substr_count($dsujet->sujet, ',') + 1; echo '<form name="formulaire" action="' . getUrlSondage($numsondageadmin, true) . '" method="POST" onkeypress="javascript:process_keypress(event)">' . "\n"; echo '<div class="cadre"> ' . "\n"; echo _('As poll administrator, you can change all the lines of this poll with <img src="images/info.png" alt="infos">.<br> You can, as well, remove a column or a line with <img src="images/cancel.png" alt="Cancel">. <br>You can also add a new column with <img src="images/add-16.png" alt="Add column">.<br> Finally, you can change the informations of this poll like the title, the comments or your email address.') . "\n"; echo '<br><br>' . "\n"; //debut de l'affichage de résultats echo '<table class="resultats">' . "\n"; //reformatage des données des sujets du sondage $toutsujet = explode(",", $dsujet->sujet); echo '<tr>' . "\n"; echo '<td></td>' . "\n"; echo '<td></td>' . "\n"; //boucle pour l'affichage des boutons de suppression de colonne for ($i = 0; isset($toutsujet[$i]); $i++) { echo '<td class=somme><input type="image" name="effacecolonne' . $i . '" value="Effacer la colonne" src="images/cancel.png"></td>' . "\n"; } echo '</tr>' . "\n";
//recuperation des nouveaux choix de l'utilisateur if (isset($_POST["choix{$i}"]) && $_POST["choix{$i}"] == 1) { $nouveauchoix .= "1"; } else { $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) { $sql = 'UPDATE user_studs SET reponses=' . $connect->Param('nouveauchoix') . ' WHERE nom=' . $connect->Param('nom') . ' AND id_users=' . $connect->Param('id_users'); $sql = $connect->Prepare($sql); $connect->Execute($sql, array($nouveauchoix, $data->nom, $data->id_users)); if ($dsondage->mailsonde == "yes") { sendEmail("{$dsondage->mail_admin}", "[" . NOMAPPLICATION . "] " . _("Poll's participation") . " : " . html_entity_decode($dsondage->titre, ENT_QUOTES, 'UTF-8'), "\"" . html_entity_decode($data->nom, ENT_QUOTES, 'UTF-8') . "\"" . "" . _("has filled a line.\nYou can find your poll at the link") . " :\n\n" . getUrlSondage($numsondage) . " \n\n" . _("Thanks for your confidence.") . "\n" . NOMAPPLICATION); } } $compteur++; } } //recuperation des utilisateurs du sondage $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)); //reformatage des données des sujets du sondage $toutsujet = explode(",", $dsondage->sujet); //patch pyg pour réordonner les dates ajoutees a posteriori //sort($toutsujet, SORT_NUMERIC); //si le sondage est un sondage de date if ($dsondage->format == "D" || $dsondage->format == "D+") {
function bandeau_pied_mobile() { /*echo '<div class="surbandeaupiedmobile"></div>'."\n" . '<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="/">' . _("Home") . '</a>' . '<a class="button small gray" href="' . getUrlSondage('aqg259dth55iuhwm') . '">' . _("Example") . '</a>' . '<a class="button small gray" href="/contacts.php">' . _("Contact") . '</a>' . '<a class="button small gray" href="/apropos.php">' . _("About") . '</a>' . '<span class="sousbandeau sousbandeaulangue">' . liste_lang() . '</span>' . '</div>' . "\n"; gAnalytics(); }
function ajouter_sondage() { $sondage = random(16); $sondage_admin = $sondage . random(8); if ($_SESSION["formatsondage"] == "A" || $_SESSION["formatsondage"] == "A+") { //extraction de la date de fin choisie if ($_SESSION["champdatefin"]) { if ($_SESSION["champdatefin"] > time() + 250000) { $date_fin = $_SESSION["champdatefin"]; } } else { $date_fin = time() + 15552000; } } if ($_SESSION["formatsondage"] == "D" || $_SESSION["formatsondage"] == "D+") { //Calcul de la date de fin du sondage $taille_tableau = sizeof($_SESSION["totalchoixjour"]) - 1; $date_fin = $_SESSION["totalchoixjour"][$taille_tableau] + 200000; } if (is_numeric($date_fin) === false) { $date_fin = time() + 15552000; } global $connect; $sql = 'INSERT INTO sondage (id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde) VALUES ( ' . $connect->Param('id_sondage') . ', ' . $connect->Param('commentaires') . ', ' . $connect->Param('mail_admin') . ', ' . $connect->Param('nom_admin') . ', ' . $connect->Param('titre') . ', ' . $connect->Param('id_sondage_admin') . ', FROM_UNIXTIME(' . $date_fin . '), ' . $connect->Param('format') . ', ' . $connect->Param('mailsonde') . ' )'; $sql = $connect->Prepare($sql); $res = $connect->Execute($sql, array($sondage, $_SESSION['commentaires'], $_SESSION['adresse'], $_SESSION['nom'], $_SESSION['titre'], $sondage_admin, $_SESSION['formatsondage'], $_SESSION['mailsonde'])); $sql = 'INSERT INTO sujet_studs values (' . $connect->Param('sondage') . ', ' . $connect->Param('choix') . ')'; $sql = $connect->Prepare($sql); $connect->Execute($sql, array($sondage, $_SESSION['toutchoix'])); $message = _("This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll."); $message .= "\n\n"; $message .= stripslashes(html_entity_decode($_SESSION["nom"], ENT_QUOTES, "UTF-8")) . " " . _("hast just created a poll called") . " : \"" . stripslashes(htmlspecialchars_decode($_SESSION["titre"], ENT_QUOTES)) . "\".\n"; $message .= _("Thanks for filling the poll at the link above") . " :\n\n%s\n\n" . _("Thanks for your confidence") . ",\n" . NOMAPPLICATION; $message_admin = _("This message should NOT be sended to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above"); $message_admin .= " :\n\n" . "%s \n\n" . _("Thanks for your confidence") . ",\n" . NOMAPPLICATION; $message = sprintf($message, getUrlSondage($sondage)); $message_admin = sprintf($message_admin, getUrlSondage($sondage_admin, true)); if (validateEmail($_SESSION['adresse'])) { sendEmail("{$_SESSION['adresse']}", "[" . NOMAPPLICATION . "][" . _("Author's message") . "] " . _("Poll") . " : " . stripslashes(htmlspecialchars_decode($_SESSION["titre"], ENT_QUOTES)), $message_admin, $_SESSION['adresse']); sendEmail("{$_SESSION['adresse']}", "[" . NOMAPPLICATION . "][" . _("For sending to the polled users") . "] " . _("Poll") . " : " . stripslashes(htmlspecialchars_decode($_SESSION["titre"], ENT_QUOTES)), $message, $_SESSION['adresse']); } $date = date('H:i:s d/m/Y:'); error_log($date . " CREATION: {$sondage}\t{$_SESSION['formatsondage']}\t{$_SESSION['nom']}\t{$_SESSION['adresse']}\t \t{$_SESSION['toutchoix']}\n", 3, 'admin/logs_studs.txt'); header("Location:" . getUrlSondage($sondage)); exit; session_unset(); }