ajout saisieModification
This commit is contained in:
parent
84f2210ee7
commit
4ed66047f0
@ -52,7 +52,7 @@ if (empty($idVotation))
|
||||
|
||||
$sujet = "[LALIS] Convocation à un vote";
|
||||
$textDebut = "Bonjour,\nL'association Lalis vous invite à un vote du " . formatteDate('fr', $votation['dd'], 'Europe/Paris') . " 0h00 au " . formatteDate('fr', $votation['df'], 'Europe/Paris') . " minuit.\nMotif du vote : " . $votation['libelle'] . "\n\nPour voter, cliquez sur le lien suivant :\nhttps://lalis69.ddns.net:10443/vote.form.php?v=" . $idVotation . "&id=";
|
||||
$textFin = "\n\nNous vous rappelons que pour pouvoir voter, vous devez être à jour de cotisation à la date du vote.\nLes résultats seront visibles dès le " . formatteDate('fr', $votation['tf'], 'Europe/Paris') . " par le lien suivant : https://lalis69.ddns.net:10443/vote.resultat.php?id=" . $idVotation . "\n\nPour Lalis, Le Président, David Larochette.";
|
||||
$textFin = "\n\nNous vous rappelons que pour pouvoir voter, vous devez être à jour de cotisation à la date du vote.\nLes résultats seront visibles dès le " . formatteDate('fr', $votation['tf'], 'Europe/Paris') . " par le lien suivant : https://lalis69.ddns.net:10443/vote.resultat.php?id=" . $idVotation . "\nAttention: ce lien contient votre identifiant de vote, ne le transmettez, sinon la personne pourra voter à votre place.\n\nPour Lalis, Le Président, David Larochette.";
|
||||
foreach($adherents as $adherent)
|
||||
{
|
||||
$text = $textDebut . base64_encode($adherent['login']) . $textFin;
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require_once '../session_init.php';
|
||||
require_once 'session_init.php';
|
||||
require_once 'config.inc.php';
|
||||
require_once 'db.class.php';
|
||||
require_once './entete.php';
|
||||
require_once 'entete.php';
|
||||
require_once 'fonctions.inc.php';
|
||||
|
||||
$action = $_GET["action"];
|
||||
@ -35,10 +35,15 @@ if (empty($action))
|
||||
}else
|
||||
{
|
||||
//TODO alert "Do you want to delete ..."
|
||||
$query = "UPDATE liste_votations SET status=0 WHERE id=" . $db->protect($idVotation); // clotûre
|
||||
$query = "UPDATE liste_votations SET status=0 WHERE id='" . $db->protect($idVotation) . "'"; // clotûre
|
||||
$db->query($query);
|
||||
}
|
||||
}elseif ($action == "modif")
|
||||
{
|
||||
//TODO
|
||||
votationForm($path, $titre, $libelle, $dateDebut, $dateFin, $status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print(' </div>
|
||||
|
32
gestionsite/saisieVotation.php
Normal file
32
gestionsite/saisieVotation.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require_once 'session_init.php';
|
||||
require_once 'config.inc.php';
|
||||
require_once 'db.class.php';
|
||||
require_once 'entete.php';
|
||||
require_once 'fonctions.inc.php';
|
||||
|
||||
$path = $_SERVER["PHP_SELF"];
|
||||
print('<br><br>
|
||||
<!-- lalis Grid Section -->
|
||||
|
||||
<section id="content">
|
||||
<div class="container">';
|
||||
print(' <div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h3>Nouvelle votation</h3>
|
||||
<h4>');
|
||||
|
||||
if (array_key_exists("titre"), $_GET)
|
||||
{
|
||||
|
||||
}
|
||||
votationForm($path);
|
||||
print(' </div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>');
|
||||
require_once("footer.html");
|
||||
|
||||
?>
|
@ -11,23 +11,19 @@
|
||||
|
||||
<title>Lyon Association Libre Informatique Solidaire</title>
|
||||
|
||||
<!-- Bootstrap Core CSS - Uses Bootswatch Flatly Theme: http://bootswatch.com/flatly/ -->
|
||||
<link href="css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Bootstrap Core CSS - Uses Bootswatch Flatly Theme: http://bootswatch.com/flatly/ >
|
||||
<link href="css/bootstrap.min.css" rel="stylesheet"-->
|
||||
|
||||
<!-- Custom CSS -->
|
||||
<link href="css/freelancer.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom Fonts -->
|
||||
<!-- Custom Fonts >
|
||||
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css"-->
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
@ -51,22 +47,22 @@
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="hidden">
|
||||
<a href="<?php echo $site_path;?>/index.html#page-top"></a>
|
||||
<a href="<?php echo $webSite;?>/index.html#page-top"></a>
|
||||
</li>
|
||||
<li class="page-scroll">
|
||||
<a href="<?php echo $site_path;?>/index.html#content">Présentation</a>
|
||||
<a href="<?php echo $webSite;?>/index.html#content">Présentation</a>
|
||||
</li>
|
||||
<li class="page-scroll">
|
||||
<a href="<?php echo $site_path;?>/index.html#about">Nos engagements</a>
|
||||
<a href="<?php echo $webSite;?>/index.html#about">Nos engagements</a>
|
||||
</li>
|
||||
<li class="page-scroll">
|
||||
<a href="<?php echo $site_path;?>/index.html#horaires">Horaires</a>
|
||||
<a href="<?php echo $webSite;?>/index.html#horaires">Horaires</a>
|
||||
</li>
|
||||
<li class="page-scroll">
|
||||
<a href="<?php echo $site_path;?>/index.html#contact">Contact</a>
|
||||
<a href="<?php echo $webSite;?>/index.html#contact">Contact</a>
|
||||
</li>
|
||||
<li class="page-scroll">
|
||||
<a href="<?php echo $site_path;?>/votations.php">Votations</a>
|
||||
<a href="<?php echo $webSite;?>/votations.php">Votations</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div><div><a>Association loi 1901</a></div>
|
||||
|
@ -30,7 +30,7 @@ function getpost( $var )
|
||||
return $_POST[$var];
|
||||
}else
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,28 +44,6 @@ function mb_ucfirst($str)
|
||||
return $char . $str;
|
||||
}
|
||||
|
||||
function getLang( $lang, $gestion=false )
|
||||
{
|
||||
$dico = array();
|
||||
if ( empty($lang) )
|
||||
{
|
||||
$lang="en";
|
||||
}
|
||||
$langPath ='lang/'.$lang;
|
||||
if ($gestion)
|
||||
$langPath = "../" . $langPath;
|
||||
if (($fh = fopen($langPath, 'r') ))
|
||||
{
|
||||
$str = fgets($fh);
|
||||
fclose($fh);
|
||||
$dico = json_decode($str, true);
|
||||
return $dico;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function choixVotation($path, $methode=2) //2 = toutes les votations 1 = votations en cours 0 = votations cloturées
|
||||
{
|
||||
global $db, $base_url, $action;
|
||||
@ -103,47 +81,17 @@ function choixVotation($path, $methode=2) //2 = toutes les votations 1 = votat
|
||||
</form>';
|
||||
}
|
||||
|
||||
/*
|
||||
function envoiMailold($destinataire, $sujet, $text, $html=false, $cc='', $bcc='')
|
||||
function votationForm($path, $titre="", $libelle="", $dateDebut="", $DateFin="", $status=0)
|
||||
{
|
||||
require_once 'swiftmailer/autoload.php';
|
||||
//require_once 'include/swiftmailer/swiftmailer/lib/swift_init.php';
|
||||
$transport = (new Swift_SmtpTransport('mail.gandi.net', 465, 'ssl'))
|
||||
->setUsername('contact@lalis.fr')
|
||||
->setPassword('Gu>V$fiM{bQ^!x+FAHF+R.}bl');
|
||||
$mailer = new Swift_Mailer($transport);
|
||||
$message = (new Swift_Message($sujet))
|
||||
->setFrom(["contact@lalis.fr"])
|
||||
->setTo([$destinataire])
|
||||
->setCharset('utf-8');
|
||||
$type = $message->getHeaders()->get('Content-Type');
|
||||
if ($html)
|
||||
{
|
||||
// setParameters() takes an associative array
|
||||
$type->setValue('text/html');
|
||||
$type->setParameter('charset', 'utf-8');
|
||||
$str = nl2br($text);
|
||||
$text = "<html><head></head>\n<body>" . $str . "</body></html>";
|
||||
log_write(__FILE__ . EOL . __LINE__ . EOL . wordwrap($text, 1000, "\r\n"), INFO);
|
||||
}else
|
||||
{
|
||||
$type->setValue('text/plain');
|
||||
$type->setParameter('charset', 'utf-8');
|
||||
$text = str_replace("\n","\r\n", $text);
|
||||
//TODO vérification du formulaire en javascript
|
||||
print('<form method="get" action="' . $path . '">');
|
||||
print('<label for="titre">' . _("Titre") .'</label><br><input type="text" id="titre" name="titre" value="'. $titre . '">') . EOLH;
|
||||
print('<label for="libelle">' . _("Description") . '</label><br><input type="text" id="libelle" name="libelle" value="'. $libelle . '">') . EOLH;
|
||||
print('<label for="dateDebut">' . _("Date de début de la période de vote") . '</label><br><input type="date" id="dateDebut" name="dateDebut" value="'. $dateDebut . '">') . EOLH;
|
||||
print('<label for="dateFin">' . _("Date de fin de la période de vote") . '</label><br><input type="date" id="dateFin" name="dateFin" value="'. $dateFin . '">') . EOLH;
|
||||
print('<input type="submit" formaction="index.php" value="' . _("Annuler") . '">') . EOLH;
|
||||
print('<input type="submit" value="' . _("Envoyer") . '">') . EOLH;
|
||||
}
|
||||
$message->setBody($text);
|
||||
//add date header
|
||||
$headers = $message->getHeaders();
|
||||
$headers->addDateHeader('Your-Header', new DateTimeImmutable('3 days ago'));
|
||||
if (!$mailer->send($message, $failures))
|
||||
{
|
||||
echo "Failures:";
|
||||
print_r($failures);
|
||||
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" . $destinataire . EOL . $sujet . EOL . print_r($failure, true) . EOL . wordwrap($text, 1000 , "\r\n"), ERROR);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
function envoiMail($destinataire, $sujet, $text, $html=false, $cc='', $bcc='')
|
||||
{
|
||||
@ -166,7 +114,6 @@ function envoiMail($destinataire, $sujet, $text, $html=false, $cc='', $bcc='')
|
||||
$text = str_replace("\n","\r\n", $text);
|
||||
}
|
||||
|
||||
|
||||
//Server settings
|
||||
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
||||
$mail->isSMTP(); //Send using SMTP
|
||||
|
46
index.php
46
index.php
@ -1,55 +1,9 @@
|
||||
<?php
|
||||
|
||||
require "session_init.php";
|
||||
require "config.inc.php";
|
||||
require "db.class.php";
|
||||
require_once 'entete.php';
|
||||
|
||||
$idVotant=$_GET["id"];
|
||||
$votation=$_GET["v"];
|
||||
$vote=$_GET["vote"];
|
||||
|
||||
$db = new db();
|
||||
|
||||
print('<br><br>
|
||||
<!-- lalis Grid Section -->
|
||||
|
||||
<section id="content">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h3>VOTE</h3>');
|
||||
|
||||
$query = 'SELECT * FROM liste_votes WHERE idVotation="' . $db->protect( $votation) .'"';
|
||||
$result = $db->query($query);
|
||||
$listeVotes = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
|
||||
foreach ($vote as $key => $value)
|
||||
{
|
||||
$result = $db->vote($votation, $idVotant, $key, $value );
|
||||
|
||||
if ($result == '')
|
||||
{
|
||||
$idVote = array_search($key, array_column($listeVotes, 'id'));
|
||||
echo '<h4>' . $listeVotes[$idVote]['libelle'] . ' : vote pris en compte</h4>' .EOLH;
|
||||
log_write($idVotant . ' a voté');
|
||||
}else
|
||||
{
|
||||
print ('<h4>ERREUR: vote non pris en compte</h4>') . EOLH;
|
||||
if (strpos($result, 'Duplicate') !== false)
|
||||
{
|
||||
print ("<h5>L'erreur est normale si vous avez essayé de recharger la page");
|
||||
}
|
||||
print("<h5>Adressez-vous aux responsables de l'association, ils ont déjà été averti de l'erreur</h5>" . EOLH);
|
||||
log_error( "vote non pris en compte : idVotant=$idVotant, id_Votation=$votation, key=$key, value=$value");
|
||||
}
|
||||
//echo "$key => $value";
|
||||
}
|
||||
$db->close();
|
||||
print(' </div>
|
||||
</div>
|
||||
</div>
|
||||
</section>');
|
||||
|
||||
|
||||
?>
|
||||
|
@ -8,11 +8,11 @@ ini_set('display_startup_errors', 1);
|
||||
ini_set('serialize_precision', 8);
|
||||
error_reporting(E_ALL);
|
||||
date_default_timezone_set("Europe/Paris");
|
||||
$base_path = "/var/www/html";
|
||||
$base_path = "/var/www/html/vote";
|
||||
set_include_path(get_include_path() . ':' .$base_path . '/include');
|
||||
$cookiesparams = session_get_cookie_params();
|
||||
//session_set_cookie_params ( 0, $cookiesparams["path"], $cookiesparams["domain"], true, true );
|
||||
//session_start();
|
||||
$site_path="https://lalis69.ddns.net:10443";
|
||||
|
||||
$site_path = "https://lalis69.ddns.net:10443/vote";
|
||||
$webSite = "https://lalis.fr";
|
||||
?>
|
||||
|
55
vote.php
Normal file
55
vote.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
require "session_init.php";
|
||||
require "config.inc.php";
|
||||
require "db.class.php";
|
||||
require_once 'entete.php';
|
||||
|
||||
if (array_key_exists("id", $_GET)) $idVotant = $_GET["id"];
|
||||
if (array_key_exists("v", $_GET)) $votation = $_GET["v"];
|
||||
if (array_key_exists("vote", $_GET)) $vote = $_GET["vote"];
|
||||
|
||||
$db = new db();
|
||||
|
||||
print('<br><br>
|
||||
<!-- lalis Grid Section -->
|
||||
|
||||
<section id="content">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h3>VOTE</h3>');
|
||||
|
||||
$query = 'SELECT * FROM liste_votes WHERE idVotation="' . $db->protect( $votation) .'"';
|
||||
$result = $db->query($query);
|
||||
$listeVotes = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
|
||||
foreach ($vote as $key => $value)
|
||||
{
|
||||
$result = $db->vote($votation, $idVotant, $key, $value );
|
||||
|
||||
if ($result == '')
|
||||
{
|
||||
$idVote = array_search($key, array_column($listeVotes, 'id'));
|
||||
echo '<h4>' . $listeVotes[$idVote]['libelle'] . ' : vote pris en compte</h4>' .EOLH;
|
||||
log_write($idVotant . ' a voté');
|
||||
}else
|
||||
{
|
||||
print ('<h4>ERREUR: vote non pris en compte</h4>') . EOLH;
|
||||
if (strpos($result, 'Duplicate') !== false)
|
||||
{
|
||||
print ("<h5>L'erreur est normale si vous avez essayé de recharger la page");
|
||||
}
|
||||
print("<h5>Adressez-vous aux responsables de l'association, ils ont déjà été averti de l'erreur</h5>" . EOLH);
|
||||
log_error( "vote non pris en compte : idVotant=$idVotant, id_Votation=$votation, key=$key, value=$value");
|
||||
}
|
||||
//echo "$key => $value";
|
||||
}
|
||||
$db->close();
|
||||
print(' </div>
|
||||
</div>
|
||||
</div>
|
||||
</section>');
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user