ajout saisieModification
This commit is contained in:
parent
84f2210ee7
commit
4ed66047f0
@ -52,7 +52,7 @@ if (empty($idVotation))
|
|||||||
|
|
||||||
$sujet = "[LALIS] Convocation à un vote";
|
$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=";
|
$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)
|
foreach($adherents as $adherent)
|
||||||
{
|
{
|
||||||
$text = $textDebut . base64_encode($adherent['login']) . $textFin;
|
$text = $textDebut . base64_encode($adherent['login']) . $textFin;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once '../session_init.php';
|
require_once 'session_init.php';
|
||||||
require_once 'config.inc.php';
|
require_once 'config.inc.php';
|
||||||
require_once 'db.class.php';
|
require_once 'db.class.php';
|
||||||
require_once './entete.php';
|
require_once 'entete.php';
|
||||||
require_once 'fonctions.inc.php';
|
require_once 'fonctions.inc.php';
|
||||||
|
|
||||||
$action = $_GET["action"];
|
$action = $_GET["action"];
|
||||||
@ -35,10 +35,15 @@ if (empty($action))
|
|||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
//TODO alert "Do you want to delete ..."
|
//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);
|
$db->query($query);
|
||||||
}
|
}
|
||||||
|
}elseif ($action == "modif")
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
votationForm($path, $titre, $libelle, $dateDebut, $dateFin, $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print(' </div>
|
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>
|
<title>Lyon Association Libre Informatique Solidaire</title>
|
||||||
|
|
||||||
<!-- Bootstrap Core CSS - Uses Bootswatch Flatly Theme: http://bootswatch.com/flatly/ -->
|
<!-- Bootstrap Core CSS - Uses Bootswatch Flatly Theme: http://bootswatch.com/flatly/ >
|
||||||
<link href="css/bootstrap.min.css" rel="stylesheet">
|
<link href="css/bootstrap.min.css" rel="stylesheet"-->
|
||||||
|
|
||||||
<!-- Custom CSS -->
|
<!-- Custom CSS -->
|
||||||
<link href="css/freelancer.css" rel="stylesheet">
|
<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="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=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 -->
|
<!-- 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:// -->
|
<!-- 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>
|
</head>
|
||||||
|
|
||||||
@ -51,22 +47,22 @@
|
|||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li class="hidden">
|
<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>
|
||||||
<li class="page-scroll">
|
<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>
|
||||||
<li class="page-scroll">
|
<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>
|
||||||
<li class="page-scroll">
|
<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>
|
||||||
<li class="page-scroll">
|
<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>
|
||||||
<li class="page-scroll">
|
<li class="page-scroll">
|
||||||
<a href="<?php echo $site_path;?>/votations.php">Votations</a>
|
<a href="<?php echo $webSite;?>/votations.php">Votations</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div><div><a>Association loi 1901</a></div>
|
</div><div><a>Association loi 1901</a></div>
|
||||||
|
@ -30,7 +30,7 @@ function getpost( $var )
|
|||||||
return $_POST[$var];
|
return $_POST[$var];
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,28 +44,6 @@ function mb_ucfirst($str)
|
|||||||
return $char . $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
|
function choixVotation($path, $methode=2) //2 = toutes les votations 1 = votations en cours 0 = votations cloturées
|
||||||
{
|
{
|
||||||
global $db, $base_url, $action;
|
global $db, $base_url, $action;
|
||||||
@ -103,47 +81,17 @@ function choixVotation($path, $methode=2) //2 = toutes les votations 1 = votat
|
|||||||
</form>';
|
</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
function votationForm($path, $titre="", $libelle="", $dateDebut="", $DateFin="", $status=0)
|
||||||
function envoiMailold($destinataire, $sujet, $text, $html=false, $cc='', $bcc='')
|
|
||||||
{
|
{
|
||||||
require_once 'swiftmailer/autoload.php';
|
//TODO vérification du formulaire en javascript
|
||||||
//require_once 'include/swiftmailer/swiftmailer/lib/swift_init.php';
|
print('<form method="get" action="' . $path . '">');
|
||||||
$transport = (new Swift_SmtpTransport('mail.gandi.net', 465, 'ssl'))
|
print('<label for="titre">' . _("Titre") .'</label><br><input type="text" id="titre" name="titre" value="'. $titre . '">') . EOLH;
|
||||||
->setUsername('contact@lalis.fr')
|
print('<label for="libelle">' . _("Description") . '</label><br><input type="text" id="libelle" name="libelle" value="'. $libelle . '">') . EOLH;
|
||||||
->setPassword('Gu>V$fiM{bQ^!x+FAHF+R.}bl');
|
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;
|
||||||
$mailer = new Swift_Mailer($transport);
|
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;
|
||||||
$message = (new Swift_Message($sujet))
|
print('<input type="submit" formaction="index.php" value="' . _("Annuler") . '">') . EOLH;
|
||||||
->setFrom(["contact@lalis.fr"])
|
print('<input type="submit" value="' . _("Envoyer") . '">') . EOLH;
|
||||||
->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);
|
|
||||||
}
|
|
||||||
$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='')
|
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);
|
$text = str_replace("\n","\r\n", $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Server settings
|
//Server settings
|
||||||
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
||||||
$mail->isSMTP(); //Send using SMTP
|
$mail->isSMTP(); //Send using SMTP
|
||||||
|
46
index.php
46
index.php
@ -1,55 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require "session_init.php";
|
require "session_init.php";
|
||||||
require "config.inc.php";
|
require "config.inc.php";
|
||||||
require "db.class.php";
|
require "db.class.php";
|
||||||
require_once 'entete.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);
|
ini_set('serialize_precision', 8);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
date_default_timezone_set("Europe/Paris");
|
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');
|
set_include_path(get_include_path() . ':' .$base_path . '/include');
|
||||||
$cookiesparams = session_get_cookie_params();
|
$cookiesparams = session_get_cookie_params();
|
||||||
//session_set_cookie_params ( 0, $cookiesparams["path"], $cookiesparams["domain"], true, true );
|
//session_set_cookie_params ( 0, $cookiesparams["path"], $cookiesparams["domain"], true, true );
|
||||||
//session_start();
|
//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