diff --git a/gestionsite/.htaccess b/gestionsite/.htaccess deleted file mode 100644 index 8b5a076..0000000 --- a/gestionsite/.htaccess +++ /dev/null @@ -1,7 +0,0 @@ -Options -Indexes -AuthName "back_office" -AuthBasicProvider file -AuthType Basic -AuthUserFile "/var/www/html/vote/gestionsite/.htpasswd" -require valid-user - diff --git a/gestionsite/.htpasswd b/gestionsite/.htpasswd deleted file mode 100644 index e4ed400..0000000 --- a/gestionsite/.htpasswd +++ /dev/null @@ -1 +0,0 @@ -daniel:$apr1$67uwe85A$ygTTmLOR/DxIJgPMqGVox. diff --git a/gestionsite/entete.php b/gestionsite/entete.php deleted file mode 100644 index fee51e3..0000000 --- a/gestionsite/entete.php +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - Lyon Association Libre Informatique Solidaire - - - - - - - - - - - - - - - - - - - - - - diff --git a/gestionsite/envoiMailing.php b/gestionsite/envoiMailing.php deleted file mode 100644 index 054b06b..0000000 --- a/gestionsite/envoiMailing.php +++ /dev/null @@ -1,79 +0,0 @@ -
- - -
-
-
-
-

VOTE

'); - -$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('
- -

Êtes-vous sûr de vouloir envoyer le Mailing pour la votation : ' . $votation['libelle'] .'

-

-
- - - -
-
- '); - }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 '
' . $adherent['email'] . ' ' . $adherent['firstname'] . ' ' . $adherent['lastname'] . EOLH . nl2br($text) . '
'; - 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("

Annulation de l'envoi du Mailing pour la votation : " . $votation['libelle'] . "

-

"); - } - - print('
-
-
-
'); -} -require_once("footer.html"); -?> diff --git a/gestionsite/footer.html b/gestionsite/footer.html deleted file mode 100644 index cbedafb..0000000 --- a/gestionsite/footer.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - -
- - - -
- - - - - - - - - - - - - - - - - - - diff --git a/gestionsite/index.php b/gestionsite/index.php deleted file mode 100644 index 9dfb4c4..0000000 --- a/gestionsite/index.php +++ /dev/null @@ -1,30 +0,0 @@ -
- - -
-
-
-
-

Gestion du site

-
-
- -
-
'); - -require_once './footer.html'; -?> diff --git a/gestionsite/modifVotation.php b/gestionsite/modifVotation.php deleted file mode 100644 index b896943..0000000 --- a/gestionsite/modifVotation.php +++ /dev/null @@ -1,54 +0,0 @@ -
- - -
-
-
-
-

Choisissez une votations à modifier

' . 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('
-
-
-
'); -require_once './footer.html'; -?> diff --git a/gestionsite/saisieVotation.php b/gestionsite/saisieVotation.php deleted file mode 100644 index c92a8da..0000000 --- a/gestionsite/saisieVotation.php +++ /dev/null @@ -1,44 +0,0 @@ -
- - -
-
'); -print('
-
-

Nouvelle votation

-

'); - -$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('

-
- -
-
'); -require_once("footer.html"); - -?> diff --git a/gestionsite/saisieVotes.php b/gestionsite/saisieVotes.php deleted file mode 100644 index 8556167..0000000 --- a/gestionsite/saisieVotes.php +++ /dev/null @@ -1,68 +0,0 @@ -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('

- -
-
') . EOL; -print('
-
-

Nouveau vote pour la votation'); - -if (empty($idVotation)) -{ - choixVotation($path, 0, false); -}else -{ - print(": " . $votationName . '

' . 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('
-
-
-
'); -require_once("footer.html"); - -?> diff --git a/methods/schulzeResults.php b/methods/schulzeResults.php index 3dddc95..baed706 100644 --- a/methods/schulzeResults.php +++ b/methods/schulzeResults.php @@ -28,32 +28,54 @@ class schulze } } + function stringify($votes) + { + $r = array(); + foreach($votes as $vote) + { + $r[] = implode($vote); + } + return $r; + } + + function votify($votes) + { + $r = array(); + foreach($votes as $vote) + { + $r[] = explode($vote); + } + return $r; + } + function test($v) { $w = array(); $i = 0; $j = 0; - - asort($v); + $v = stringify($v); + sort($v); print_r($v); for($i = 0;$i < count($v) - 1;$i++) { - if ($i == 0) { - - $w[$j]['vote'] = $v[$i]; - $w[$j]['n'] = 1; + $w[$j]["vote"] = $v[$i]; + $w[$j]["n"] = 1; $j += 1; } - if ($v[$i] == $v[$i+1]) + if ($v[$i] === $v[$i+1]) { - $w[$J]["n"] += 1; + $x = array_search($v[$i], $w); + $w[$x]["n"] += 1; }else { - $w[$j++] = $v[$i+1]; + $w[$j]["vote"] = $v[$i+1]; + $w[$j]["n"] = 1; + $j += 1; } } + $w = votify($w); print_r($w); }