Merge branch 'master' into 'master'

Création fichier config + prise en compte paramètres config + correction bugs

* Correction de bugs. Mauvais formalisme de date sur Windows (e53043b2) ; Objet du message lors de la notification par email (eb5677e4)
* Ajout d'un fichier de config (config.inc.php)
* Prise en compte des quelques paramètres du fichier de config dans le code

==> permet à l'admin de paramétrer plus finement le comportement de l'outil.

Je compte continuer à rendre plus paramétrable framadate mais seulement si vous partagez la même vision que moi : je ne compte pas faire un fork dans mon coin ;-)

See merge request !12
This commit is contained in:
JosephK 2014-11-13 10:56:41 +01:00
commit db7d21b326
14 changed files with 236 additions and 95 deletions

View File

@ -76,21 +76,25 @@ if (!$sondage || $sondage->RecordCount() != 1){
$dsujet=$sujets->FetchObject(false); $dsujet=$sujets->FetchObject(false);
$dsondage=$sondage->FetchObject(false); $dsondage=$sondage->FetchObject(false);
// Send email (only once during the session) to alert admin of the change he made // Send email (only once during the session) to alert admin of the change he made. ==> two modifications (comment, title, description, ...) on differents polls in the same session will generate only one mail.
$email_admin = $dsondage->mail_admin; $email_admin = $dsondage->mail_admin;
$poll_title = $dsondage->titre;
function send_mail_admin() { function send_mail_admin() {
global $email_admin; global $email_admin;
global $poll_title;
global $numsondageadmin; global $numsondageadmin;
if(config_get('use_smtp')==true){
if(!isset($_SESSION["mail_admin_sent"])) { if(!isset($_SESSION["mail_admin_sent"])) {
Utils::sendEmail( $email_admin, Utils::sendEmail( $email_admin,
_("[ADMINISTRATOR] New settings for your poll") . ' ' . stripslashes( $dsondage->titre ), _("[ADMINISTRATOR] New settings for your poll") . ' ' . stripslashes( $poll_title ),
_("You have changed the settings of your poll. \nYou can modify this poll with this link") . _("You have changed the settings of your poll. \nYou can modify this poll with this link") .
" :\n\n" . Utils::getUrlSondage($numsondageadmin, true) . "\n\n" . " :\n\n" . Utils::getUrlSondage($numsondageadmin, true) . "\n\n" .
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION _("Thanks for your confidence.") . "\n" . NOMAPPLICATION
); );
$_SESSION["mail_admin_sent"]=true; $_SESSION["mail_admin_sent"]=true;
} }
}
} }
//si la valeur du nouveau titre est valide et que le bouton est activé //si la valeur du nouveau titre est valide et que le bouton est activé
@ -105,7 +109,9 @@ if (isset($_POST["boutonnouveautitre"])) {
//Email sent to the admin //Email sent to the admin
if ($connect->Execute($sql, array($nouveautitre, $numsondage))) { if ($connect->Execute($sql, array($nouveautitre, $numsondage))) {
//if(config_get('use_smtp')==true){
send_mail_admin(); send_mail_admin();
//}
} }
} }
} }

49
app/inc/config.inc.php Normal file
View File

@ -0,0 +1,49 @@
<?php
/**
* This software is governed by the CeCILL-B license. If a copy of this license
* is not distributed with this file, you can obtain one at
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
*
* Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
* Authors of Framadate/OpenSondate: Framasoft (https://git.framasoft.org/framasoft/framadate)
*
* =============================
*
* Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
* ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
*
* Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
* Auteurs de Framadate/OpenSondage : Framasoft (https://git.framasoft.org/framasoft/framadate)
*/
/**
* general configuration
*/
//use email for polls creation/modification/responses notification
$use_smtp = true;
/**
* index.php
*/
//display "how to use" section
$show_what_is_that = true;
//display technical information about the software
$show_the_software = true;
//display "developpement and administration" information
$show_cultivate_your_garden = true;
/**
* choix_autre.php
*/
//default values for the new poll duration (number of days).
$default_poll_duration = 30;
//user can add link or URL when creating his poll.
$user_can_add_link_or_url = false;

24
app/inc/functions.inc.php Normal file
View File

@ -0,0 +1,24 @@
<?php
/**
* This software is governed by the CeCILL-B license. If a copy of this license
* is not distributed with this file, you can obtain one at
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
*
* Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
* Authors of Framadate/OpenSondate: Framasoft (https://git.framasoft.org/framasoft/framadate)
*
* =============================
*
* Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
* ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
*
* Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
* Auteurs de Framadate/OpenSondage : Framasoft (https://git.framasoft.org/framasoft/framadate)
*/
function config_get($p_option){
include('config.inc.php');
if (isset(${$p_option})){
return ${$p_option};
}
}

View File

@ -25,7 +25,7 @@ require_once __DIR__ . '/../../vendor/autoload.php';
include_once __DIR__ . '/constants.php'; include_once __DIR__ . '/constants.php';
include_once __DIR__ . '/i18n.php'; include_once __DIR__ . '/i18n.php';
include_once __DIR__ . '/functions.inc.php';
$connect = NewADOConnection(BASE_TYPE); $connect = NewADOConnection(BASE_TYPE);
$connect->Connect(SERVEURBASE, USERBASE, USERPASSWD, BASE); $connect->Connect(SERVEURBASE, USERBASE, USERPASSWD, BASE);

View File

@ -23,17 +23,21 @@ include_once __DIR__ . '/app/inc/init.php';
// bandeaux de titre // bandeaux de titre
function bandeau_titre($titre) function bandeau_titre($titre)
{ {
global $ALLOWED_LANGUAGES;
$img = ( IMAGE_TITRE ) ? '<img src="'. Utils::get_server_name(). IMAGE_TITRE. '" alt="'.NOMAPPLICATION.'">' : ''; $img = ( IMAGE_TITRE ) ? '<img src="'. Utils::get_server_name(). IMAGE_TITRE. '" alt="'.NOMAPPLICATION.'">' : '';
echo ' echo '
<header role="banner"> <header role="banner">';
<form method="post" action="#"> if(count($ALLOWED_LANGUAGES)>1){
echo '<form method="post" action="#">
<div class="input-group input-group-sm pull-right col-md-2 col-xs-4"> <div class="input-group input-group-sm pull-right col-md-2 col-xs-4">
<select name="lang" class="form-control" title="'. _("Select the language") .'" >' . liste_lang() . '</select> <select name="lang" class="form-control" title="'. _("Select the language") .'" >' . liste_lang() . '</select>
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" class="btn btn-default btn-sm" title="'. _("Change the language") .'">OK</button> <button type="submit" class="btn btn-default btn-sm" title="'. _("Change the language") .'">OK</button>
</span> </span>
</div> </div>
</form> </form>';
}
echo '
<h1><a href="'.str_replace('/admin','', Utils::get_server_name()).'" title="'._("Home").' - '.NOMAPPLICATION.'">'.$img.'</a></h1> <h1><a href="'.str_replace('/admin','', Utils::get_server_name()).'" title="'._("Home").' - '.NOMAPPLICATION.'">'.$img.'</a></h1>
<h2 class="lead"><i>'. $titre .'</i></h2> <h2 class="lead"><i>'. $titre .'</i></h2>
<hr class="trait" /> <hr class="trait" />

View File

@ -28,7 +28,7 @@ if (file_exists('bandeaux_local.php')) {
} }
// Step 1/3 : error if $_SESSION from info_sondage are not valid // Step 1/3 : error if $_SESSION from info_sondage are not valid
if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmpty('nom', $_SESSION) === false || Utils::issetAndNoEmpty('adresse', $_SESSION) === false) { if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmpty('nom', $_SESSION) === false || ((config_get('use_smtp')) ? Utils::issetAndNoEmpty('adresse', $_SESSION) === false : false)) {
Utils::print_header ( _("Error!") ); Utils::print_header ( _("Error!") );
bandeau_titre(_("Error!")); bandeau_titre(_("Error!"));
@ -57,8 +57,6 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
$temp_results=substr($temp_results,1); $temp_results=substr($temp_results,1);
$_SESSION["toutchoix"]=$temp_results; $_SESSION["toutchoix"]=$temp_results;
// Expiration date → after 6 months if not filled or in bad format
$_SESSION["champdatefin"]=time()+15552000;
if (Utils::issetAndNoEmpty('champdatefin')) { if (Utils::issetAndNoEmpty('champdatefin')) {
$registredate = explode("/",$_POST["champdatefin"]); $registredate = explode("/",$_POST["champdatefin"]);
@ -93,9 +91,16 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
Utils::print_header ( _("Removal date and confirmation (3 on 3)") ); Utils::print_header ( _("Removal date and confirmation (3 on 3)") );
bandeau_titre(_("Removal date and confirmation (3 on 3)")); bandeau_titre(_("Removal date and confirmation (3 on 3)"));
$removal_date=strftime(_("%A, den %e. %B %Y"), time()+15552000); // Expiration date is initialised with config parameter. Value will be modified in step 4 if user has defined an other date
$_SESSION["champdatefin"]= time()+ (86400 * config_get('default_poll_duration')); //60 secondes * 60 minutes * 24 heures * config
// Sumary $date_format = _("%A, den %e. %B %Y"); //locale replacement
if (strtoupper(substr(PHP_OS,0,3))=='WIN'){ //%e can't be used on Windows platform, use %#d instead
$date_format = preg_replace('#(?<!%)((?:%%)*)%e#','\1%#d', $date_format); //replace %e by %#d for windows
}
$removal_date="(".strftime($date_format, ($_SESSION["champdatefin"])).")";//textual date
// Summary
$summary = '<ol>'; $summary = '<ol>';
for ($i=0;$i<count($_SESSION['choices']);$i++) { for ($i=0;$i<count($_SESSION['choices']);$i++) {
@ -137,7 +142,7 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
'. $summary .' '. $summary .'
</div> </div>
<div class="alert alert-info"> <div class="alert alert-info">
<p>' . _("Your poll will be automatically removed after 6 months:") . ' <strong>'.$removal_date.'</strong>.<br />' . _("You can fix another removal date for it.") .'</p> <p>' . _("Your poll will be automatically removed after"). " " . config_get('default_poll_duration') . " " . _("days") . ' <strong>'.$removal_date.'</strong>.<br />' . _("You can fix another removal date for it.") .'</p>
<div class="form-group"> <div class="form-group">
<label for="champdatefin" class="col-sm-5 control-label">'. _("Removal date (optional)") .'</label> <label for="champdatefin" class="col-sm-5 control-label">'. _("Removal date (optional)") .'</label>
<div class="col-sm-6"> <div class="col-sm-6">
@ -175,9 +180,11 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
echo ' echo '
<div class="alert alert-info"> <div class="alert alert-info">
<p>'. _("To make a generic poll you need to propose at least two choices between differents subjects.") .'</p> <p>'. _("To make a generic poll you need to propose at least two choices between differents subjects.") .'</p>
<p>'. _("You can add or remove additional choices with the buttons") .' <span class="glyphicon glyphicon-minus text-info"></span><span class="sr-only">'. _("Remove") .'</span> <span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add") .'</span></p> <p>'. _("You can add or remove additional choices with the buttons") .' <span class="glyphicon glyphicon-minus text-info"></span><span class="sr-only">'. _("Remove") .'</span> <span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add") .'</span></p>';
<p>'. _("It's possible to propose links or images by using "). '<a href="http://'.$lang.'.wikipedia.org/wiki/Markdown">'. _("the Markdown syntax") .'</a>.</p> if(config_get('user_can_add_link_or_url')){
</div>'."\n"; echo ' <p>'. _("It's possible to propose links or images by using "). '<a href="http://'.$lang.'.wikipedia.org/wiki/Markdown">'. _("the Markdown syntax") .'</a>.</p>';
}
echo ' </div>'."\n";
// Fields choices : 5 by default // Fields choices : 5 by default
$nb_choices = (isset($_SESSION['choices'])) ? max(count($_SESSION['choices']), 5) : 5; $nb_choices = (isset($_SESSION['choices'])) ? max(count($_SESSION['choices']), 5) : 5;
@ -187,8 +194,11 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
<div class="form-group choice-field"> <div class="form-group choice-field">
<label for="choice'.$i.'" class="col-sm-2 control-label">'. _("Choice") .' '.($i+1).'</label> <label for="choice'.$i.'" class="col-sm-2 control-label">'. _("Choice") .' '.($i+1).'</label>
<div class="col-sm-10 input-group"> <div class="col-sm-10 input-group">
<input type="text" class="form-control" name="choices[]" size="40" value="'.$choice_value.'" id="choice'.$i.'" /> <input type="text" class="form-control" name="choices[]" size="40" value="'.$choice_value.'" id="choice'.$i.'" />';
<span class="input-group-addon btn-link md-a-img" title="'. _("Add a link or an image") .' - '. _("Choice") .' '.($i+1).'" ><span class="glyphicon glyphicon-picture"></span> <span class="glyphicon glyphicon-link"></span></span> if(config_get('user_can_add_link_or_url')){
echo '<span class="input-group-addon btn-link md-a-img" title="'. _("Add a link or an image") .' - '. _("Choice") .' '.($i+1).'" ><span class="glyphicon glyphicon-picture"></span> <span class="glyphicon glyphicon-link"></span></span>';
}
echo '
</div> </div>
</div>'."\n"; </div>'."\n";
} }

View File

@ -45,8 +45,9 @@ function ajouter_sondage()
$sondage=random(16); $sondage=random(16);
$sondage_admin=$sondage.random(8); $sondage_admin=$sondage.random(8);
$date_fin = ($_SESSION["champdatefin"]) ? $_SESSION["champdatefin"] : $date_fin=time()+15552000; //$date_fin = ($_SESSION["champdatefin"]) ? $_SESSION["champdatefin"] : $date_fin=time()+ (86400 * config_get('default_poll_duration'));
$date_fin = $_SESSION["champdatefin"]; //always provided by choix_autre.php
$_SESSION["champdatefin"]=""; //clean param cause 2 polls created by the same user in the same session can be affected by this param during the 2nd creation.
$sql = 'INSERT INTO sondage $sql = 'INSERT INTO sondage
(id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde) (id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde)
VALUES ( VALUES (
@ -67,6 +68,7 @@ function ajouter_sondage()
$sql = $connect->Prepare($sql); $sql = $connect->Prepare($sql);
$connect->Execute($sql, array($sondage, $_SESSION['toutchoix'])); $connect->Execute($sql, array($sondage, $_SESSION['toutchoix']));
if(config_get('use_smtp')==true){
$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 = _("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 .= "\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 .= stripslashes(html_entity_decode($_SESSION["nom"],ENT_QUOTES,"UTF-8"))." " . _("hast just created a poll called") . " : \"".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES))."\".\n";
@ -82,7 +84,7 @@ function ajouter_sondage()
Utils::sendEmail( "$_SESSION[adresse]", "[".NOMAPPLICATION."][" . _("Author's message") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message_admin, $_SESSION['adresse'] ); Utils::sendEmail( "$_SESSION[adresse]", "[".NOMAPPLICATION."][" . _("Author's message") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message_admin, $_SESSION['adresse'] );
Utils::sendEmail( "$_SESSION[adresse]", "[".NOMAPPLICATION."][" . _("For sending to the polled users") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message, $_SESSION['adresse'] ); Utils::sendEmail( "$_SESSION[adresse]", "[".NOMAPPLICATION."][" . _("For sending to the polled users") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message, $_SESSION['adresse'] );
} }
}
error_log(date('H:i:s d/m/Y:') . ' CREATION: '.$sondage."\t".$_SESSION[formatsondage]."\t".$_SESSION[nom]."\t".$_SESSION[adresse]."\t \t".$_SESSION[toutchoix]."\n", 3, 'admin/logs_studs.txt'); error_log(date('H:i:s d/m/Y:') . ' CREATION: '.$sondage."\t".$_SESSION[formatsondage]."\t".$_SESSION[nom]."\t".$_SESSION[adresse]."\t \t".$_SESSION[toutchoix]."\n", 3, 'admin/logs_studs.txt');
Utils::cleaning_polls($connect, 'admin/logs_studs.txt'); Utils::cleaning_polls($connect, 'admin/logs_studs.txt');

View File

@ -33,6 +33,7 @@ session_start();
// affichage de la page // affichage de la page
Utils::print_header( _("Home") ); Utils::print_header( _("Home") );
bandeau_titre(_("Make your polls")); bandeau_titre(_("Make your polls"));
echo ' echo '
<div class="row"> <div class="row">
<div class="col-md-6 text-center"> <div class="col-md-6 text-center">
@ -51,8 +52,14 @@ echo '
</div> </div>
</div> </div>
<hr /> <hr />
<div class="row"> <div class="row">';
<div class="col-md-4"> $nbcol = config_get('show_what_is_that') + config_get('show_the_software') + config_get('show_cultivate_your_garden');
if ($nbcol > 0){
$colmd = 12/$nbcol; // 3 =>col-md-4, 2 =>col-md-6, 1 =>col-md-12.
//echo "mon test : ".$nbActivation;
}
if(config_get('show_what_is_that') == true){
echo '<div class="col-md-'.$colmd.'">
<h3>'. _('What is that?') . '</h3> <h3>'. _('What is that?') . '</h3>
<p class="text-center"><span class="glyphicon glyphicon-question-sign" style="font-size:50px"></span></p> <p class="text-center"><span class="glyphicon glyphicon-question-sign" style="font-size:50px"></span></p>
<p>'. _('Framadate is an online service for planning an appointment or make a decision quickly and easily. No registration is required.') .'</p> <p>'. _('Framadate is an online service for planning an appointment or make a decision quickly and easily. No registration is required.') .'</p>
@ -64,8 +71,11 @@ echo '
<li>'. _('Discuss and make a decision') . '</li> <li>'. _('Discuss and make a decision') . '</li>
</ol> </ol>
<p>'. _('Do you want to ') . '<a href="' . Utils::getUrlSondage('aqg259dth55iuhwm').'">'. _("view an example?") .'</a></p> <p>'. _('Do you want to ') . '<a href="' . Utils::getUrlSondage('aqg259dth55iuhwm').'">'. _("view an example?") .'</a></p>
</div> </div>';
<div class="col-md-4"> }
if(config_get('show_the_software') == true){
echo '<div class="col-md-'.$colmd.'">
<h3>'. _('The software') .'</h3> <h3>'. _('The software') .'</h3>
<p class="text-center"><span class="glyphicon glyphicon-cloud" style="font-size:50px"></span></p> <p class="text-center"><span class="glyphicon glyphicon-cloud" style="font-size:50px"></span></p>
<p>'. _('Framadate was initially based on '). '<a href="https://sourcesup.cru.fr/projects/studs/">Studs</a>'. _(' a software developed by the University of Strasbourg. Today, it is devevoped by the association Framasoft') .'.</p> <p>'. _('Framadate was initially based on '). '<a href="https://sourcesup.cru.fr/projects/studs/">Studs</a>'. _(' a software developed by the University of Strasbourg. Today, it is devevoped by the association Framasoft') .'.</p>
@ -78,15 +88,19 @@ echo '
<li>Opera 11+</li> <li>Opera 11+</li>
</ul> </ul>
<p>'. _('It is governed by the ').'<a href="http://www.cecill.info">'. _('CeCILL-B license').'</a>.</p> <p>'. _('It is governed by the ').'<a href="http://www.cecill.info">'. _('CeCILL-B license').'</a>.</p>
</div> </div>';
<div class="col-md-4"> }
if(config_get('show_cultivate_your_garden') == true){
echo '<div class="col-md-'.$colmd.'">
<h3>'. _('Cultivate your garden') .'</h3> <h3>'. _('Cultivate your garden') .'</h3>
<p class="text-center"><span class="glyphicon glyphicon-tree-deciduous" style="font-size:50px"></span></p> <p class="text-center"><span class="glyphicon glyphicon-tree-deciduous" style="font-size:50px"></span></p>
<p>'. _('To participate in the software development, suggest improvements or simply download it, please visit ') .'<a href="https://git.framasoft.org/framasoft/framadate">'._('the development site').'</a>.</p> <p>'. _('To participate in the software development, suggest improvements or simply download it, please visit ') .'<a href="https://git.framasoft.org/framasoft/framadate">'._('the development site').'</a>.</p>
<br /> <br />
<p>'. _('If you want to install the software for your own use and thus increase your independence, we help you on:') .'</p> <p>'. _('If you want to install the software for your own use and thus increase your independence, we help you on:') .'</p>
<p class="text-center"><a href="http://framacloud.org/cultiver-son-jardin/installation-de-framadate/" class="btn btn-success"><span class="glyphicon glyphicon-tree-deciduous"></span> framacloud.org</a></p> <p class="text-center"><a href="http://framacloud.org/cultiver-son-jardin/installation-de-framadate/" class="btn btn-success"><span class="glyphicon glyphicon-tree-deciduous"></span> framacloud.org</a></p>
</div> </div>';
</div>'."\n"; }
echo '</div>'."\n";
bandeau_pied(); bandeau_pied();

View File

@ -77,9 +77,11 @@ if (Utils::issetAndNoEmpty("poursuivre")){
unset($_SESSION["mailsonde"]); unset($_SESSION["mailsonde"]);
$_SESSION["mailsonde"] = ($mailsonde !== null) ? true : false; $_SESSION["mailsonde"] = ($mailsonde !== null) ? true : false;
if (config_get('use_smtp')==true){
if (Utils::isValidEmail($adresse) === false) { if (Utils::isValidEmail($adresse) === false) {
$erreur_adresse = true; $erreur_adresse = true;
} }
}
if (preg_match(';<|>|";',$titre)) { if (preg_match(';<|>|";',$titre)) {
$erreur_injection_titre = true; $erreur_injection_titre = true;
@ -94,7 +96,14 @@ if (Utils::issetAndNoEmpty("poursuivre")){
} }
// Si pas d'erreur dans l'adresse alors on change de page vers date ou autre // Si pas d'erreur dans l'adresse alors on change de page vers date ou autre
if ($titre && $nom && $adresse && !$erreur_adresse && ! $erreur_injection_titre && ! $erreur_injection_commentaires && ! $erreur_injection_nom) { if(config_get('use_smtp')==true){
$email_OK = $adresse && !$erreur_adresse;
}
else{
$email_OK = true;
}
if ($titre && $nom && $email_OK && ! $erreur_injection_titre && ! $erreur_injection_commentaires && ! $erreur_injection_nom) {
if ( $poursuivre == "creation_sondage_date" ) { if ( $poursuivre == "creation_sondage_date" ) {
header("Location:choix_date.php"); header("Location:choix_date.php");
@ -242,16 +251,19 @@ echo '
'.$input_name.' '.$input_name.'
</div> </div>
</div> </div>
'.$errors['name']['msg'].' '.$errors['name']['msg'];
if(config_get('use_smtp')==true){
echo '
<div class="form-group'.$errors['email']['class'].'"> <div class="form-group'.$errors['email']['class'].'">
<label for="email" class="col-sm-4 control-label">'. _("Your email address") .' *</label> <label for="email" class="col-sm-4 control-label">'. _("Your email address") .' *</label>
<div class="col-sm-8"> <div class="col-sm-8">
'.$input_email.' '.$input_email.'
</div> </div>
</div> </div>
'.$errors['email']['msg'].' '.$errors['email']['msg'];
}
<div class="form-group"> echo '<div class="form-group">
<div class="col-sm-offset-1 col-sm-11"> <div class="col-sm-offset-1 col-sm-11">
<div class="checkbox"> <div class="checkbox">
<label> <label>
@ -259,8 +271,9 @@ echo '
</label> </label>
</div> </div>
</div> </div>
</div> </div>';
<div class="form-group"> if(config_get('use_smtp')==true){
echo '<div class="form-group">
<div class="col-sm-offset-1 col-sm-11"> <div class="col-sm-offset-1 col-sm-11">
<div class="checkbox"> <div class="checkbox">
<label> <label>
@ -268,9 +281,10 @@ echo '
</label> </label>
</div> </div>
</div> </div>
</div> </div>';
}
<p class="text-right"> echo '<p class="text-right">
<input type="hidden" name="choix_sondage" value="'. $choix_sondage .'"/> <input type="hidden" name="choix_sondage" value="'. $choix_sondage .'"/>
<button name="poursuivre" value="'. $choix_sondage .'" type="submit" class="btn btn-success" title="'. _('Go to step 2') . '">'. _('Next') . '</button> <button name="poursuivre" value="'. $choix_sondage .'" type="submit" class="btn btn-success" title="'. _('Go to step 2') . '">'. _('Next') . '</button>
</p> </p>

Binary file not shown.

View File

@ -3,8 +3,8 @@ msgstr ""
"Project-Id-Version: Framadate 0.8\n" "Project-Id-Version: Framadate 0.8\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-23 20:52+0100\n" "POT-Creation-Date: 2014-10-23 20:52+0100\n"
"PO-Revision-Date: 2014-10-23 20:52+0100\n" "PO-Revision-Date: 2014-11-11 20:12+0100\n"
"Last-Translator: JosephK\n" "Last-Translator: mrB <mr.bricodage@gmail.com>\n"
"Language-Team: JosephK\n" "Language-Team: JosephK\n"
"Language: English\n" "Language: English\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -81,6 +81,12 @@ msgstr "%A, den %e. %B %Y"
msgid "Expiration's date" msgid "Expiration's date"
msgstr "Expiration's date" msgstr "Expiration's date"
msgid "days"
msgstr "days"
msgid "months"
msgstr "months"
########### Language selector ########### ########### Language selector ###########
msgid "Change the language" msgid "Change the language"
msgstr "Change the language" msgstr "Change the language"
@ -555,8 +561,8 @@ msgid "Removal date:"
msgstr "Removal date:" msgstr "Removal date:"
# Step 3 choix_autre.php # Step 3 choix_autre.php
msgid "Your poll will be automatically removed after 6 months:" msgid "Your poll will be automatically removed after"
msgstr "Your poll will be automatically removed after 6 months:" msgstr "Your poll will be automatically removed after"
msgid "You can fix another removal date for it." msgid "You can fix another removal date for it."
msgstr "You can fix another removal date for it." msgstr "You can fix another removal date for it."
@ -616,12 +622,15 @@ msgstr ""
msgid "Thanks for your confidence." msgid "Thanks for your confidence."
msgstr "Thanks for your confidence." msgstr "Thanks for your confidence."
msgid "\n" msgid ""
"--\n\n" "\n"
"--\n"
"\n"
 La route est longue, mais la voie est libre… »\n"  La route est longue, mais la voie est libre… »\n"
"Framasoft ne vit que par vos dons (déductibles des impôts).\n" "Framasoft ne vit que par vos dons (déductibles des impôts).\n"
"Merci d'avance pour votre soutien http://soutenir.framasoft.org." "Merci d'avance pour votre soutien http://soutenir.framasoft.org."
msgstr "\n" msgstr ""
"\n"
"\n" "\n"
"\n" "\n"
"\n" "\n"
@ -666,3 +675,4 @@ msgstr "Author's message"
msgid "For sending to the polled users" msgid "For sending to the polled users"
msgstr "For sending to the polled users" msgstr "For sending to the polled users"

Binary file not shown.

View File

@ -3,8 +3,8 @@ msgstr ""
"Project-Id-Version: Framadate 0.8\n" "Project-Id-Version: Framadate 0.8\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-23 20:52+0100\n" "POT-Creation-Date: 2014-10-23 20:52+0100\n"
"PO-Revision-Date: 2014-10-23 20:52+0100\n" "PO-Revision-Date: 2014-11-11 13:19+0100\n"
"Last-Translator: JosephK\n" "Last-Translator: mrB <mr.bricodage@gmail.com>\n"
"Language-Team: JosephK\n" "Language-Team: JosephK\n"
"Language: French\n" "Language: French\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -81,6 +81,12 @@ msgstr "%A %e %B %Y"
msgid "Expiration's date" msgid "Expiration's date"
msgstr "Date d'expiration" msgstr "Date d'expiration"
msgid "days"
msgstr "jours"
msgid "months"
msgstr "mois"
########### Language selector ########### ########### Language selector ###########
msgid "Change the language" msgid "Change the language"
msgstr "Changer la langue" msgstr "Changer la langue"
@ -555,8 +561,8 @@ msgid "Removal date:"
msgstr "Date de suppression :" msgstr "Date de suppression :"
# Step 3 choix_autre.php # Step 3 choix_autre.php
msgid "Your poll will be automatically removed after 6 months:" msgid "Your poll will be automatically removed after"
msgstr "Votre sondage sera automatiquement effacé dans 6 mois :" msgstr "Votre sondage sera automatiquement effacé dans"
msgid "You can fix another removal date for it." msgid "You can fix another removal date for it."
msgstr "Néanmoins vous pouvez décider ci-dessous d'une date plus rapprochée pour la suppression de votre sondage." msgstr "Néanmoins vous pouvez décider ci-dessous d'une date plus rapprochée pour la suppression de votre sondage."

View File

@ -173,6 +173,7 @@ if (!Utils::is_error(NO_POLL) && (isset($_POST["boutonp"]))) {
$connect->Execute($sql, array($nom, $numsondage, $nouveauchoix)); $connect->Execute($sql, array($nom, $numsondage, $nouveauchoix));
if ($dsondage->mailsonde || /* compatibility for non boolean DB */ $dsondage->mailsonde=="yes" || $dsondage->mailsonde=="true") { if ($dsondage->mailsonde || /* compatibility for non boolean DB */ $dsondage->mailsonde=="yes" || $dsondage->mailsonde=="true") {
if(config_get('use_smtp')==true){
Utils::sendEmail( "$dsondage->mail_admin", Utils::sendEmail( "$dsondage->mail_admin",
"[".NOMAPPLICATION."] "._("Poll's participation")." : ".html_entity_decode($dsondage->titre, ENT_QUOTES, 'UTF-8')."", "[".NOMAPPLICATION."] "._("Poll's participation")." : ".html_entity_decode($dsondage->titre, ENT_QUOTES, 'UTF-8')."",
html_entity_decode("\"$nom\" ", ENT_QUOTES, 'UTF-8'). html_entity_decode("\"$nom\" ", ENT_QUOTES, 'UTF-8').
@ -181,6 +182,7 @@ if (!Utils::is_error(NO_POLL) && (isset($_POST["boutonp"]))) {
_("Thanks for your confidence.") . "\n". NOMAPPLICATION ); _("Thanks for your confidence.") . "\n". NOMAPPLICATION );
} }
} }
}
} else { } else {
$err |= NAME_EMPTY; $err |= NAME_EMPTY;
} }