1
0
This commit is contained in:
Daniel Tartavel 2022-09-21 14:47:18 +02:00
parent d90446535f
commit afbe4c7400
14 changed files with 416 additions and 10 deletions

7
gestion/.htaccess Normal file
View File

@ -0,0 +1,7 @@
Options -Indexes
AuthName "back_office"
AuthBasicProvider file
AuthType Basic
AuthUserFile "/var/www/html/vote/gestionsite/.htpasswd"
require valid-user

1
gestion/.htpasswd Normal file
View File

@ -0,0 +1 @@
daniel:$apr1$67uwe85A$ygTTmLOR/DxIJgPMqGVox.

73
gestion/entete.php Normal file
View File

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Kevin PITA - Daniel Tartavel">
<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">
<!-- Custom CSS -->
<link href="../css/freelancer.css" rel="stylesheet">
<!-- 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">
<!-- 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>
<body id="page-top" class="index">
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<!--button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button-->
<a class="navbar-brand" href="#page-top">LALIS</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="hidden">
<a href="https://lalis.fr/index.html#page-top"></a>
</li>
<li class="page-scroll">
<a href="https://lalis.fr/index.html#content">Présentation</a>
</li>
<li class="page-scroll">
<a href="https://lalis.fr/index.html#about">Nos engagements</a>
</li>
<li class="page-scroll">
<a href="https://lalis.fr/index.html#horaires">Horaires</a>
</li>
<li class="page-scroll">
<a href="https://lalis.fr/index.html#contact">Contact</a>
</li>
</ul>
</div><div><a>Association loi 1901</a></div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>

78
gestion/envoiMailing.php Normal file
View File

@ -0,0 +1,78 @@
<?php
require_once '../session_init.php';
require_once 'config.inc.php';
require_once 'db.class.php';
require_once 'entete.php';
$idVotation =$_GET["id"];
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>');
$db = new db();
$dolibarr = new dbDolibarr();
if (empty($idVotation))
{
choixVotation('./envoiMailing.php') ;
}else
{
//chargement des données de la votation
$db->query("SELECT *, UNIX_TIMESTAMP( DATE_ADD(dateFin, INTERVAL 1 DAY)) as tf, UNIX_TIMESTAMP(dateFin) as df, UNIX_TIMESTAMP(dateDebut) as dd FROM liste_votations WHERE id=" . $idVotation);
$votation = $db->result->fetch_array();
if(empty($_GET['status']))
{
print('<form method="get" action="envoiMailing.php">
<input type="hidden" name="id" value="' . $idVotation . '">
<pre><h4>Êtes-vous sûr de vouloir envoyer le Mailing pour la votation : ' . $votation['libelle'] .'</h4>
</pre><br>
<div>
<input type="submit" name="status" value="Oui">
<input type="submit" name="status" value="Non">
<input type="submit" name="status" value="Test">
</div>
</form>
');
}elseif($_GET['status'] == 'Oui' OR $_GET['status'] == 'Test')
{
// message
//chargement de la liste des adhérents
$dolibarr->query("SELECT login, firstname, lastname, email FROM llx_adherent");
$adherents = $dolibarr->result->fetch_all(MYSQLI_ASSOC);
$dolibarr->close();
$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 . "\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;
print '<pre>' . $adherent['email'] . ' ' . $adherent['firstname'] . ' ' . $adherent['lastname'] . EOLH . nl2br($text) . '</pre>';
if ( $_GET['status'] == 'Oui')
{
//print $text;
envoiMail($adherent['email'], $sujet, $text, $html=false, $cc='', $bcc='');
//envoiMail('dtux@free.fr', $sujet, $text, $html=false, $cc='', $bcc='');
}
}
}else
{
print("<pre><h4>Annulation de l'envoi du Mailing pour la votation : " . $votation['libelle'] . "</h4>
</pre><br>");
}
print(' </div>
</div>
</div>
</section>');
}
require_once("footer.html");
?>

56
gestion/footer.html Normal file
View File

@ -0,0 +1,56 @@
<!-- Footer -->
<footer class="text-center">
<div class="footer-above">
<div class="container">
<div class="row">
<div class="footer-col col-md-4">
<h5>adresse</h5>
<p>7 place Louis Chazette<br>69001 Lyon</p>
</div>
<div class="footer-col col-md-4">
<h5>LALIS</h5>
<p>Lyon Association Libre Informatique Solidaire</p>
</div>
<div class="footer-col col-md-4">
<h5>Mail</h5>
<p>contact[arobase]lalis.fr</p>
</div>
</div>
</div>
</div>
<div class="footer-below">
<div class="container">
<div class="row">
<div class="col-lg-12">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/zero/1.0/88x31.png" />
</div>
</div>
</div>
</div>
</footer>
<div class="scroll-top page-scroll visible-xs visible-sm">
<a class="btn btn-primary" href="#page-top">
<i class="fa fa-chevron-up"></i>
</a>
</div>
<script src="../js/lalis.js"></script>
<script src="../js/jquery.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="../js/classie.js"></script>
<script src="../js/cbpAnimatedHeader.js"></script>
<script src="../js/jqBootstrapValidation.js"></script>
<script src="../js/contact_me.js"></script>
<script src="../js/freelancer.js"></script>
</body>
</html>

30
gestion/index.php Normal file
View File

@ -0,0 +1,30 @@
<?php
require_once '../session_init.php';
require_once 'config.inc.php';
require_once 'entete.php';
print(' <br><br>
<!-- lalis Grid Section -->
<section id="content">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h3>Gestion du site</h3>
</div>
</div>
<div class="row">
<ul>
<li><a href="../vote.resultat.php">liste des votations</a></li>
<li><a href="saisieVotation.php">nouvelle votations</a></li>
<li><a href="saisieVotes.php">Ajouter des votes à une votations</a></li>
<li><a href="modifVotation.php">Modifier une votation</a></li>
<li><a href="envoiMailing.php">Envoyer le mailing</a></li>
<li><a href="modifVotation.php?action=cloture">Clôturer une votation</a></li>
</ul>
</div>
</div>
</section>');
require_once './footer.html';
?>

53
gestion/modifVotation.php Normal file
View File

@ -0,0 +1,53 @@
<?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';
$action = $_GET["action"];
$idVotation = $_GET["id"];
print('<br><br>
<!-- lalis Grid Section -->
<section id="content">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h4>Choisissez une votations à modifier</h4>' . EOL);
$db = new db();
if (empty($action))
{
$action="modif";
choixVotation('./modifVotation.php') ;
}else
{
if ($action == "cloture")
{
if (empty($idVotation))
{
// choix de la votation à cloturer
choixVotation('./modifVotation.php', 0);
}else
{
//TODO alert "Do you want to delete ..."
$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>
</div>
</div>
</section>');
require_once './footer.html';
?>

View File

@ -0,0 +1,43 @@
<?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>');
$titre = getpost("titre");
$libelle = getpost("libelle");
$dateDebut = getpost("dateDebut");
$dateFin = getpost("dateFin");
if ($titre !== null and $libelle!== null and $dateDebut!== null and $dateFin !== null)
{
$db = new db();
$query = "INSERT INTO liste_votations VALUES(0, '" . $titre . "', '" . $libelle . "', '0', '" . $dateDebut . "', '" . $dateFin . "')"; // clotûre
$db->query($query);
$db->close();
// TODO retour à l'index
}else
{
votationForm($path, $titre, $libelle, $dateDebut, $dateFin);
}
print(' </div>
</div>
</form>
</div>
</section>');
require_once("footer.html");
?>

67
gestion/saisieVotes.php Normal file
View File

@ -0,0 +1,67 @@
<?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"];
$db = new db();
function queryVotationName($db, $idVotation) :string
{
$query = "SELECT libelle FROM liste_votations WHERE id='" . $idVotation . "'";
$db->query($query);
$votationLine = $db->result->fetch_assoc();
return $votationLine["libelle"];
}
$idVotation = getpost("id");
if (!empty($idVotation))
{
$_SESSION["idVotation"] = $idVotation;
$votationName = queryVotationName($db, $idVotation);
}elseif (array_key_exists("idVotation", $_SESSION))
{
if (!empty($_SESSION["idVotation"]))
{
$idVotation = $_SESSION["idVotation"];
$votationName = queryVotationName($db, $idVotation);
}
}
print('<br><br>
<!-- lalis Grid Section -->
<section id="content">
<div class="container">') . EOL;
print(' <div class="row">
<div class="col-lg-12 text-center">
<h3>Nouveau vote pour la votation');
if (empty($idVotation))
{
choixVotation($path, 0, false);
}else
{
print(": " . $votationName . '</h3>' . EOL);
$method = getpost("method");
$libelle = getpost("libelle");
if (empty($method) or empty($libelle))
{
votesForm($path);
}else
{
$query = "INSERT INTO liste_votes ('libelle', 'method', 'id_votation') VALUES ('" . $libelle . "', '" . $method . "', '" . $idVotation . "')";
print($query);
//$db->query($query);
}
}
$db->close();
print(' </div>
</div>
</div>
</section>');
require_once("footer.html");
?>

View File

@ -19,11 +19,13 @@ $site = "Lalis";
$dossier = "/sftp";
$basedir = dirname( $_SERVER['DOCUMENT_ROOT'] ) . $dossier;
$base_url = "https://lalis69.ddns.net:10443";
$url_admin = $base_url . "/gestionsite";
$base_url = "https://lalis69.ddns.net:10443/vote";
$url_admin = $base_url . "/gestion";
$accueil = $base_url . "/index.html";
if (empty( $_SERVER["PHP_AUTH_USER"]))
{
$_SERVER["PHP_AUTH_USER"] = 'script';
}
$webSite = "https://lalis.fr";
?>

View File

@ -2,7 +2,6 @@
ini_set('session.use_strict_mode','true');
ini_set('session.cookie_secure','true');
ini_set('session.hash_function','md5');
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('serialize_precision', 8);
@ -13,8 +12,6 @@ $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/vote";
$webSite = "https://lalis.fr";
session_set_cookie_params ( 0, $cookiesparams["path"], $cookiesparams["domain"], true, true );
session_start();
?>

View File

@ -1,5 +1,5 @@
<?php
session_start();
require_once 'session_init.php';
require_once 'config.inc.php';
require_once 'db.class.php';

View File

@ -1,5 +1,4 @@
<?php
session_start();
require "session_init.php";
require "config.inc.php";
require "db.class.php";

View File

@ -1,5 +1,5 @@
<?php
session_start();
require_once 'session_init.php';
require_once 'config.inc.php';
require_once 'db.class.php';