Commit 218bcf09 authored by David's avatar David
Browse files

V 2.0 internationnal version !

parent 76d09330
## 2 (future) ## X (future)
- support postfix-mysql (not plain text virtual file) - support postfix-mysql (not plain text virtual file)
- javascript checkupgrade in admin page - javascript checkupgrade in admin page
## 2.0 (2018-11)
- Internationnalisation, traduction possible (fichier source dans lang/messages.pot)
- Traduction anglais / français (merci à https://github.com/matlink pour l'anglais)
## 1.4 (2018-03-19) ## 1.4 (2018-03-19)
- Interface admin avec stats, top user, possibilité de nettoyer, blacklister... - Interface admin avec stats, top user, possibilité de nettoyer, blacklister...
......
...@@ -19,11 +19,11 @@ Télécharger & décompresser les sources : ...@@ -19,11 +19,11 @@ Télécharger & décompresser les sources :
mkdir -p /www/emailPoubelle/postfix mkdir -p /www/emailPoubelle/postfix
cd /tmp cd /tmp
wget -O emailPoubelle.zip http://forge.zici.fr/p/emailpoubelle-php/source/download/master/ wget -O emailPoubelle.zip https://framagit.org/kepon/emailPoubellePhp/-/archive/master/emailPoubellePhp-master.zip
unzip emailPoubelle.zip unzip emailPoubelle.zip
cp -r emailpoubelle-php-master/* /var/www/emailPoubelle cp -r emailpoubelle-php-master/* /var/www/emailPoubelle
Configure apache virtualhost Configure apache virtualhost (ou autres serveur http)
[...] [...]
DocumentRoot /var/www/emailPoubelle/www DocumentRoot /var/www/emailPoubelle/www
[...] [...]
......
...@@ -11,9 +11,12 @@ ...@@ -11,9 +11,12 @@
define('DATA', '../var'); define('DATA', '../var');
// include directory // include directory
define('INC', '../lib'); define('INC', '../lib');
define('URLINC', './lib'); // or http://mondomaine.tld/lib
define('LANG', '../lang');
// include function // include function
include_once(INC.'/ep_function.php'); include_once(INC.'/ep_function.php');
include_once(INC.'/ep_header.php');
define('DEBUG', false); define('DEBUG', false);
......
...@@ -5,48 +5,49 @@ ...@@ -5,48 +5,49 @@
// Licence : GNU GPL v3 : http://www.gnu.org/licenses/gpl.html // Licence : GNU GPL v3 : http://www.gnu.org/licenses/gpl.html
// Author : David Mercereau - david [aro] mercereau [.] info // Author : David Mercereau - david [aro] mercereau [.] info
// Home : http://poubelle.zici.fr // Home : http://poubelle.zici.fr
// Date : 08/2013 // Date : 08/2018
// Version : 1.0 // Version : 2.0
// Depend : Postifx (postmap command) php-pdo // Depend : Postifx (postmap command) php-pdo, http serveur
//----------------------------------------------------------- //-----------------------------------------------------------
////////////////// //////////////////
// Init & check // Init & check
////////////////// //////////////////
define('VERSION', '1.4'); define('VERSION', '2.0');
if (DEBUG) { if (DEBUG) {
error_reporting(E_ALL); error_reporting(E_ALL);
ini_set('display_errors', 'On'); ini_set('display_errors', 'On');
echo '<div class="highlight-2">Debug activé <br />'; echo '<div class="highlight-2">'._("Debug enabled") .'<br />';
echo print_r($_REQUEST); echo print_r($_REQUEST);
echo '</div>'; echo '</div>';
} }
if (!defined('DOMAIN') || !defined('DATA') || !defined('DEBUG') || !defined('FICHIERALIAS') || !defined('DB')) { if (!defined('DOMAIN') || !defined('DATA') || !defined('DEBUG') || !defined('FICHIERALIAS') || !defined('DB')) {
echo '<div class="highlight-1">Erreur : Il ne semble pas que le fichier de configuration conf.php soit inclue car les constantes ne sont pas présentes.</div>'; echo '<div class="highlight-1">'._("Error : the configuration file conf.php might not be included because the constants are not declared").'.</div>';
// check writable work directory // check writable work directory
} else if (!is_writable(DATA)) { } else if (!is_writable(DATA)) {
echo '<div class="highlight-1">Erreur : le répertoire de travail ne peut pas être écrit. Merci de contacter l\'administrateur</div>'; echo '<div class="highlight-1">'._("Error : the working directory cannot be written. Please contact the admin").'</div>';
// check alias file is_writable // check alias file is_writable
} else if (!is_writable(FICHIERALIAS)) { } else if (!is_writable(FICHIERALIAS)) {
echo '<div class="highlight-1">Erreur : le fichier d\'alias ne peut pas être écrit. Merci de contacter l\'administrateur</div>'; echo '<div class="highlight-1">'._("Error : the alias file cannot be written. Please contact the admin").'</div>';
// check blacklist file is_writable // check blacklist file is_writable
} else if (defined('BLACKLIST') && !is_readable(BLACKLIST)) { } else if (defined('BLACKLIST') && !is_readable(BLACKLIST)) {
echo '<div class="highlight-1">Erreur : un fichier de blacklist est renseigné mais n\'est pas lisible. Merci de contacter l\'administrateur</div>'; echo '<div class="highlight-1">'._("Error : the blacklist file cannot be read. Please contact the admin").'</div>';
// check aliasdeny file is_writable // check aliasdeny file is_writable
} else if (defined('ALIASDENY') && !is_readable(ALIASDENY)) { } else if (defined('ALIASDENY') && !is_readable(ALIASDENY)) {
echo '<div class="highlight-1">Erreur : un fichier d\'alias interdit est renseigné mais n\'est pas lisible. Merci de contacter l\'administrateur</div>'; echo '<div class="highlight-1">'._("Error : the forbidden aliases file cannot be read. Please contact the admin").'</div>';
// maintenance mod // maintenance mod
} else if (MAINTENANCE_MODE == true && MAINTENANCE_IP != $_SERVER["REMOTE_ADDR"]) { } else if (MAINTENANCE_MODE == true && MAINTENANCE_IP != $_SERVER["REMOTE_ADDR"]) {
echo '<div class="highlight-2">Le service est en maintenance.</div>'; echo '<div class="highlight-2">'._("Service under maintenance").'</div>';
} else { } else {
if (MAINTENANCE_MODE == true) { if (MAINTENANCE_MODE == true) {
echo '<div class="highlight-2">Le service est en maintenance.</div>'; echo '<div class="highlight-2">'._("Service under maintenance").'</div>';
} }
// Connect DB // Connect DB
try { try {
if (preg_match('/^sqlite/', DB)) { if (preg_match('/^sqlite/', DB)) {
...@@ -56,7 +57,7 @@ try { ...@@ -56,7 +57,7 @@ try {
} }
$dbco->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbco->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch ( PDOException $e ) { } catch ( PDOException $e ) {
die('Connexion à la base '.$e->getMessage()); die('._("Connexion à la base ").'.$e->getMessage());
} }
// Create DB if not exists // Create DB if not exists
try { try {
...@@ -81,7 +82,7 @@ try { ...@@ -81,7 +82,7 @@ try {
comment TEXT);"); comment TEXT);");
} }
} catch ( PDOException $e ) { } catch ( PDOException $e ) {
echo '<div class="highlight-1">Erreur à l\'initialisation des tables. Merci de contacter l\'administrateur '; echo '<div class="highlight-1">'._("Error initializing tables. Please contact the admin");
if (DEBUG) { $e->getMessage(); } if (DEBUG) { $e->getMessage(); }
echo '</div>'; echo '</div>';
die(); die();
...@@ -98,9 +99,9 @@ switch ($action) { ...@@ -98,9 +99,9 @@ switch ($action) {
$get_value = urlUnGen($_GET['value']); $get_value = urlUnGen($_GET['value']);
if ($dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE id = '".$get_value['id']."' AND status = 0")->fetchColumn() != 0) { if ($dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE id = '".$get_value['id']."' AND status = 0")->fetchColumn() != 0) {
UpdateStatusAlias($get_value['id'], $get_value['alias_full'], 5); UpdateStatusAlias($get_value['id'], $get_value['alias_full'], 5);
echo '<div class="highlight-3">Votre email poubelle <b>'.$get_value['alias_full'].'</b> est maintenant actif</div>'; echo '<div class="highlight-3">'._("Your trash email address").' <b>'.$get_value['alias_full'].'</b> '._("is now enabled").'</div>';
} else { } else {
echo '<div class="highlight-1">Erreur : ID introuvable ou déjà validé</div>'; echo '<div class="highlight-1">'._("Error : unknown ID or already validated").'</div>';
} }
break; break;
case "disable" : case "disable" :
...@@ -117,10 +118,10 @@ switch ($action) { ...@@ -117,10 +118,10 @@ switch ($action) {
break; break;
case "cron" : case "cron" :
if (CRON) { if (CRON) {
echo '<div class="highlight-2">La tâche planifié est lancé</div>'; echo '<div class="highlight-2">'._("The scheduled task is running").'</div>';
LifeExpire(); LifeExpire();
} else { } else {
echo '<div class="highlight-1">Vous n\'avez pas autorisé le lancement par tâche planifié</div>'; echo '<div class="highlight-1">'._("You didn't allow the scheduled job").'</div>';
} }
break; break;
} }
...@@ -130,13 +131,13 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa ...@@ -130,13 +131,13 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa
} else if (isset($_POST['list'])) { } else if (isset($_POST['list'])) {
$email=strtolower(StripCleanToHtml($_POST['email'])); $email=strtolower(StripCleanToHtml($_POST['email']));
if (! filter_var($email, FILTER_VALIDATE_EMAIL)) { if (! filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo '<div class="highlight-1">Erreur : Adresse email incorrect</div>'; echo '<div class="highlight-1">'._("Error : email address incorrect").'</div>';
} else if (! VerifMXemail($email)) { } else if (! VerifMXemail($email)) {
echo '<div class="highlight-1">Erreur : Adresse email incorrect (2)</div>'; echo '<div class="highlight-1">'._("Error : email address incorrect").' (2)</div>';
} else if (ListeAlias($email)) { } else if (ListeAlias($email)) {
echo '<div class="highlight-3">Un email vient de vous être envoyé</div>'; echo '<div class="highlight-3">'._("An email has been sent to you").'</div>';
} else { } else {
echo '<div class="highlight-1">Erreur : aucun email actif connu</div>'; echo '<div class="highlight-1">'._("Error : no known active trash email").'</div>';
} }
} else if (isset($_POST['email']) && isset($_POST['alias'])) { } else if (isset($_POST['email']) && isset($_POST['alias'])) {
$alias=strtolower(StripCleanToHtml($_POST['alias'])); $alias=strtolower(StripCleanToHtml($_POST['alias']));
...@@ -147,58 +148,58 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa ...@@ -147,58 +148,58 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa
$alias_full=$alias.'@'.$domain; $alias_full=$alias.'@'.$domain;
// Check form // Check form
if (! filter_var($email, FILTER_VALIDATE_EMAIL)) { if (! filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo '<div class="highlight-1">Erreur : Adresse email incorrect</div>'; echo '<div class="highlight-1">'._("Error : email address incorrect").'</div>';
} else if (! VerifMXemail($email)) { } else if (! VerifMXemail($email)) {
echo '<div class="highlight-1">Erreur : Adresse email incorrect (2)</div>'; echo '<div class="highlight-1">'._("Error : email address incorrect").' (2)</div>';
} else if (! preg_match('#^[\w.-]+$#',$alias)) { } else if (! preg_match('#^[\w.-]+$#',$alias)) {
echo '<div class="highlight-1">Erreur : Format de l\'email poubelle incorrect</div>'; echo '<div class="highlight-1">'._("Error : trash email address syntax incorrect").'</div>';
} else if (!domainePresent($domain)) { } else if (!domainePresent($domain)) {
echo '<div class="highlight-1">Erreur : ce domain n\'est pas pris en charge</div>'; echo '<div class="highlight-1">'._("Error : this domain cannot be used").'</div>';
} else if (emailIsAlias($email)) { } else if (emailIsAlias($email)) {
echo '<div class="highlight-1">Erreur : votre email ne peut pas contenir un domaine "poubelle"</div>'; echo '<div class="highlight-1">'._("Error : Your email can not contain a trash domain").'</div>';
} else if (AliasDeny($alias)) { } else if (AliasDeny($alias)) {
echo '<div class="highlight-1">Erreur : email poubelle interdit</div>'; echo '<div class="highlight-1">'._("Error : trash email address forbidden").'</div>';
} else if (BlacklistEmail($email)) { } else if (BlacklistEmail($email)) {
echo '<div class="highlight-1">Erreur : vous avez été blacklisté sur ce service</div>'; echo '<div class="highlight-1">'._("Error : you have been blacklisted").'</div>';
// add // add
} elseif (isset($_POST['add'])) { } elseif (isset($_POST['add'])) {
if ($dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE alias = '".$alias_full."'")->fetchColumn() != 0) { if ($dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE alias = '".$alias_full."'")->fetchColumn() != 0) {
echo '<div class="highlight-1">Erreur : cet email poubelle est déjà utilisé</div>'; echo '<div class="highlight-1">'._("Error : this trash email already exists").'</div>';
} else if ($dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE email = '".$email."'")->fetchColumn() > ALIASLIMITBYMAIL) { } else if ($dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE email = '".$email."'")->fetchColumn() > ALIASLIMITBYMAIL) {
echo '<div class="highlight-1">Erreur : Vous avez atteind votre quota limite de '.ALIASLIMITBYMAIL.' alias sur cette application. Vous pouvez <a href="http://forge.zici.fr/p/emailpoubelle-php/">installer ce script</a> sur un serveur personnel si vous voulez plus de quota.</div>'; echo '<div class="highlight-1">'._("Error: You have reached your limit quota on this app. You can <a href=\"http://forge.zici.fr/p/emailpoubelle-php/\"> install this script </a> on a personal server if you want more quota").'.</div>';
} else { } else {
if ($dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE email = '".$email."' AND status > 0")->fetchColumn() != 0) { if ($dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE email = '".$email."' AND status > 0")->fetchColumn() != 0) {
AjouterAlias(5, $alias_full, $email, $life, $comment); AjouterAlias(5, $alias_full, $email, $life, $comment);
echo '<div class="highlight-3">Votre email poubelle <b>'.$alias_full.' > '.$email.'</b> est maintenant actif</div>'; echo '<div class="highlight-3">'._("Your trash email address").'<b> '.$alias_full.' > '.$email.'</b> '._("is now enabled").'</div>';
} else { } else {
$lastId=AjouterAlias(0, $alias_full, $email, $life, $comment); $lastId=AjouterAlias(0, $alias_full, $email, $life, $comment);
$message= "Confirmation de la création de votre redirection email poubelle : "; $message= _("Confirmation of the creation of your trash email :")."\n";
$message= $alias_full.' => '.$email."\n"; $message= $alias_full.' => '.$email."\n";
$message= "Cliquer sur le lien ci-dessous pour confirmer : \n"; $message= _("Click on the link below to validate :")."\n";
$message.= "\t * ".urlGen('validemail',$lastId,$alias_full)."\n"; $message.= "\t * ".urlGen('validemail',$lastId,$alias_full)."\n";
$message.= "\n"; $message.= "\n";
$message.= "Pour supprimer cet email poubelle vous pouvez vous rendre sur le lien ci-dessou : \n"; $message.= _("To delete this trash email, click on the link below :")."\n";
$message.= "\t * ".urlGen('delete',$lastId,$alias_full)."\n"; $message.= "\t * ".urlGen('delete',$lastId,$alias_full)."\n";
$message.= "\n"; $message.= "\n";
$message.= "Après confirmation, vous pourez suspendre temporairement cet email poubelle vous pouvez vous rendre sur le lien ci-dessou : \n"; $message.= _("After confirmation, you will be able to temporary suspend you trash email using the link below :")."\n";
$message.= "\t * ".urlGen('disable',$lastId,$alias_full)."\n"; $message.= "\t * ".urlGen('disable',$lastId,$alias_full)."\n";
SendEmail($email,'Confirmation alias '.$alias,$message); SendEmail($email,_("Alias confirmation")." ".$alias,$message);
echo '<div class="highlight-2">Votre email ('.$email.') nous étant inconnu, une confirmation vous a été envoyé par email.</div>'; echo '<div class="highlight-2">'._("Your email address").' ('.$email.') '._("is unknown, a confirmation has been sent to you.").'</div>';
} }
} }
// delete // delete
} else if (isset($_POST['del'])) { } else if (isset($_POST['del'])) {
if ($id = $dbco->query("SELECT id FROM ".DBTABLEPREFIX."alias WHERE email = '".$email."' AND alias = '".$alias_full."'")->fetchColumn()) { if ($id = $dbco->query("SELECT id FROM ".DBTABLEPREFIX."alias WHERE email = '".$email."' AND alias = '".$alias_full."'")->fetchColumn()) {
$message= "Confirmation de la création de votre redirection email poubelle : "; $message= _("Confirmation of the removal of your trash email : ")."\n";
$message= $alias_full.' => '.$email."\n"; $message= $alias_full.' => '.$email."\n";
$message= "Cliquer sur le lien ci-dessous pour confirmer la suppression : \n"; $message= _("Click on the link below to validate the deletion :")."\n";
$message.= "\t * ".urlGen('delete',$id,$alias_full)."\n\n"; $message.= "\t * ".urlGen('delete',$id,$alias_full)."\n\n";
$message.= "Sinon pour suspendre temporairement cet email poubelle vous pouvez vous rendre sur le lien ci-dessou : \n"; $message.= _("If you would like to temporary suspend this trash email, you can follow the link bellow :")."\n";
$message.= "\t * ".urlGen('disable',$id,$alias_full)."\n"; $message.= "\t * ".urlGen('disable',$id,$alias_full)."\n";
SendEmail($email,'Suppression de l\'alias '.$alias,$message); SendEmail($email,_("Alias deletion")." ".$alias,$message);
echo '<div class="highlight-2">Un email de confirmation vient de vous être envoyé.</div>'; echo '<div class="highlight-2">'._("An email has been sent to you").'.</div>';
} else { } else {
echo '<div class="highlight-1">Erreur : impossible de trouver cet email poubelle</div>'; echo '<div class="highlight-1">'._("Error : unknown trash email").'</div>';
} }
// disable // disable
} else if (isset($_POST['disable'])) { } else if (isset($_POST['disable'])) {
...@@ -221,25 +222,27 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa ...@@ -221,25 +222,27 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa
////////////////// //////////////////
?> ?>
<?php languesSwitch(); ?>
<form action="<?= URLPAGE?>" method="post"> <form action="<?= URLPAGE?>" method="post">
<div id="onglet" style="display: none;"> <div id="onglet" style="display: none;">
<input type="button" value="Ajouter" id="onglet-add" onClick="ongletChange(this.id)" /> <input type="button" value=<?php echo _("Add") ?> id="onglet-add" onClick="ongletChange(this.id)" />
<input type="button" id="onglet-list" value="Lister" onClick="ongletChange(this.id)" /> <input type="button" id="onglet-list" value=<?php echo _("List") ?> onClick="ongletChange(this.id)" />
<input type="button" id="onglet-del" value="Supprimer" onClick="ongletChange(this.id)" /> <input type="button" id="onglet-del" value=<?php echo _("Delete") ?> onClick="ongletChange(this.id)" />
<input type="button" id="onglet-dis" value="Suspendre" onClick="ongletChange(this.id)" /> <input type="button" id="onglet-dis" value=<?php echo _("Suspend") ?> onClick="ongletChange(this.id)" />
<input type="button" id="onglet-en" value="Reprendre" onClick="ongletChange(this.id)" /> <input type="button" id="onglet-en" value=<?php echo _("Resume") ?> onClick="ongletChange(this.id)" />
<input type="hidden" name="onglet-actif" id="onglet-actif" value="onglet-add" /> <input type="hidden" name="onglet-actif" id="onglet-actif" value="onglet-add" />
</div> </div>
<div id="form-email"> <div id="form-email">
<label for="email">Votre email réel : </label> <label for="email"><?php echo _("Your real email address") ?> : </label>
<input type="text" name="email" <?php if (isset($_COOKIE['email'])) { echo 'value="'.$_COOKIE['email'].'"'; } ?> id="input-email" size="24" border="0" onkeyup="printForm()" onchange="printForm()" /> <input type="text" name="email" <?php if (isset($_COOKIE['email'])) { echo 'value="'.$_COOKIE['email'].'"'; } ?> id="input-email" size="24" border="0" onkeyup="printForm()" onchange="printForm()" />
<input class="button2" type="submit" name="list" id="button-list" value="Lister" /> <input class="button2" type="submit" name="list" id="button-list" value="Lister" />
<input type="checkbox" name="memory" id="check-memory" <?php if (isset($_COOKIE['email'])) { echo 'checked="checked" '; } ?>/> Mémoriser <input type="checkbox" name="memory" id="check-memory" <?php if (isset($_COOKIE['email'])) { echo 'checked="checked" '; } ?>/> <?php echo _("Remember")?>
</div> </div>
<div id="form-alias"> <div id="form-alias">
<label for="alias">Nom de l'email poubelle : </label> <label for="alias"><?php echo _("Name of your trash email address")?> : </label>
<input type="text" name="alias" id="input-alias" size="24" border="0" onkeyup="printForm()" onchange="printForm()" placeholder="Ex : jean-petiteannonce" /> @<?php <input type="text" name="alias" id="input-alias" size="24" border="0" onkeyup="printForm()" onchange="printForm()" placeholder=<?php echo _("Ex : john_shop") ?>/> @<?php
$domains = explode(';', DOMAIN); $domains = explode(';', DOMAIN);
if (count($domains) == 1) { if (count($domains) == 1) {
echo DOMAIN.'<input type="hidden" value="'.DOMAIN.'" name="domain" id="input-domain" />'; echo DOMAIN.'<input type="hidden" value="'.DOMAIN.'" name="domain" id="input-domain" />';
...@@ -252,25 +255,25 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa ...@@ -252,25 +255,25 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa
} }
?> ?>
<select name="life" id="input-life"> <select name="life" id="input-life">
<option value="0">Illimité</option> <option value="0"><?php echo _("Unlimited time")?></option>
<option value="7200">2 heure</option> <option value="7200"><?php echo _("2 hours")?></option>
<option value="21600">6 heures</option> <option value="21600"><?php echo _("6 hours")?></option>
<option value="86400">1 jour</option> <option value="86400"><?php echo _("1 day")?></option>
<option value="604800">7 jours</option> <option value="604800"><?php echo _("7 days")?></option>
<option value="1296000">15 jours</option> <option value="1296000"><?php echo _("15 days")?></option>
<option value="2592000">30 jours</option> <option value="2592000"><?php echo _("30 days")?></option>
<option value="7776000">90 jours</option> <option value="7776000"><?php echo _("90 days")?></option>
</select> </select>
</div> </div>
<div id="form-comment"> <div id="form-comment">
<label for="comment">Un commentaire pour l'ajout ? (pour votre mémoire)</label> <label for="comment"><?php echo _("Comment for this trash email (for your to remember)")?></label>
<input type="text" name="comment" size="54" placeholder="Ex : Inscription sur zici.fr" /> <input type="text" name="comment" size="54" placeholder=<?php echo _("Ex : Inscription sur zici.fr") ?>/>
</div> </div>
<div id="form-submit"> <div id="form-submit">
<input class="button" type="submit" id="button-add" name="add" value="Activer" /> <input class="button" type="submit" id="button-add" name="add" value=<?php echo _("Activate") ?> />
<input class="button" type="submit" id="button-del" name="del" value="Supprimer" /> <input class="button" type="submit" id="button-del" name="del" value=<?php echo _("Delete") ?> />
<input class="button" type="submit" id="button-enable" name="enable" value="Reprendre" /> <input class="button" type="submit" id="button-enable" name="enable" value=<?php echo _("Suspend") ?> />
<input class="button" type="submit" id="button-disable" name="disable" value="Susprendre" /> <input class="button" type="submit" id="button-disable" name="disable" value=<?php echo _("Resume") ?> />
</div> </div>
<div id="lePecheur" style="display: none;"> <div id="lePecheur" style="display: none;">
<input name="username" type="text" /> <input name="username" type="text" />
...@@ -356,15 +359,15 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa ...@@ -356,15 +359,15 @@ if (isset($_POST['username']) && $_POST['username'] != '') { // minimal anti-spa
ongletPrint(); ongletPrint();
printForm(); printForm();
</script> </script>
<p>Version <?= VERSION ?> - Créé par David Mercereau sous licence GNU GPL v3</p> <p><?php echo _("Version")?> <?= VERSION ?> - <?php echo _("Created by David Mercereau under licence GNU GPL v3")?></p>
<p>Télécharger et utiliser ce script sur le site du projet <a target="_blank" href="http://forge.zici.fr/p/emailpoubelle-php/">emailPoubelle.php</a></p> <p><?php echo _("Download and use this script on the project website")?> <a target="_blank" href="https://framagit.org/kepon/emailPoubellePhp/">emailPoubelle.php</a></p>
<?php <?php
// execute lifeExpir if isn't in crontab // execute lifeExpir if isn't in crontab
if (!CRON) { LifeExpire(); } if (!CRON) { LifeExpire(); }
// Close connexion DB // Close connexion DB
$dbco = null; $dbco = null;
// checkupdate // checkupdate
echo CheckUpdate(); echo CheckUpdate();
} // end maintenance mod } // end maintenance mod
?> ?>
...@@ -24,11 +24,11 @@ if (isset($_SESSION['adminPasswordHash'])) { ...@@ -24,11 +24,11 @@ if (isset($_SESSION['adminPasswordHash'])) {
} }
} }
if (isset($_POST['adminPassword']) && $auth==false) { if (isset($_POST['adminPassword']) && $auth==false) {
echo '<div class="highlight-1">Erreur : Mot de passe incorrect</div>'; echo '<div class="highlight-1">'._('Error: Incorrect password').'</div>';
} }
if (empty($_SESSION['adminPasswordHash']) || $auth == false) { if (empty($_SESSION['adminPasswordHash']) || $auth == false) {
echo '<form action="#" method="post"> echo '<form action="#" method="post">
<label>Le mot de passe admin : </label> <label>'.('The admin password').' : </label>
<input type="password" name="adminPassword" /> <input type="password" name="adminPassword" />
<input type="submit" /> <input type="submit" />
</form>'; </form>';
...@@ -36,6 +36,7 @@ if (empty($_SESSION['adminPasswordHash']) || $auth == false) { ...@@ -36,6 +36,7 @@ if (empty($_SESSION['adminPasswordHash']) || $auth == false) {
// Test connexion, si c'est ok : // Test connexion, si c'est ok :
if ($auth==true) { if ($auth==true) {
languesSwitch();
// Connect DB // Connect DB
try { try {
if (preg_match('/^sqlite/', DB)) { if (preg_match('/^sqlite/', DB)) {
...@@ -45,7 +46,7 @@ if ($auth==true) { ...@@ -45,7 +46,7 @@ if ($auth==true) {
} }
$dbco->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbco->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch ( PDOException $e ) { } catch ( PDOException $e ) {
die('Connexion à la base '.$e->getMessage()); die('DB connect error : '.$e->getMessage());
} }
if (isset($_POST['action'])) { if (isset($_POST['action'])) {
if ($_POST['action'] == 'DeleteEmail' && isset($_POST['email'])) { if ($_POST['action'] == 'DeleteEmail' && isset($_POST['email'])) {
...@@ -71,31 +72,31 @@ if ($auth==true) { ...@@ -71,31 +72,31 @@ if ($auth==true) {
} }
</script> </script>
<?php <?php
echo '<p>Statistique : </p>'; echo '<p>'._('Statistics').' : </p>';
echo '<ul>'; echo '<ul>';
echo '<li>Total alias : '.$dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias")->fetchColumn().'</li>'; echo '<li>'._('Total alias').' : '.$dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias")->fetchColumn().'</li>';
echo '<li>Alias actif : '.$dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE status = 5")->fetchColumn().'</li>'; echo '<li>'._('Active alias').' : '.$dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE status = 5")->fetchColumn().'</li>';
echo '<li>Alias suspendu : '.$dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE status = 3")->fetchColumn().'</li>'; echo '<li>'._('Alias suspended').' : '.$dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE status = 3")->fetchColumn().'</li>';
echo '<li>Alias non vérifié : '.$dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE status = 0")->fetchColumn().'</li>'; echo '<li>'._('Alias not verified').' : '.$dbco->query("SELECT COUNT(*) FROM ".DBTABLEPREFIX."alias WHERE status = 0")->fetchColumn().'</li>';
//echo '<li>Email différent : '.$dbco->query("SELECT DISTINCT count(email) FROM ".DBTABLEPREFIX."alias WHERE status = 5")->fetchColumn().'</li>'; //echo '<li>Email différent : '.$dbco->query("SELECT DISTINCT count(email) FROM ".DBTABLEPREFIX."alias WHERE status = 5")->fetchColumn().'</li>';
echo '</ul>'; echo '</ul>';
echo '<h3 id="user">User info</h3>'; echo '<h3 id="user">User info</h3>';
echo '<form action="#" method="post"> echo '<form action="#" method="post">
<label>Indiquer l\'email de l\'utilisateur : </label> <label>'._('User email').' : </label>
<input type="text" value="'.$_POST['email'].'" name="email" /> <input type="text" value="'.$_POST['email'].'" name="email" />
<input type="submit" /> <input type="submit" />
</form>'; </form>';
if (isset($_POST['email'])) { if (isset($_POST['email'])) {
$requestUtilisateur = $dbco->query("SELECT * FROM ".DBTABLEPREFIX."alias WHERE email='".$_POST['email']."' ORDER BY dateCreat DESC")->fetchAll() ; $requestUtilisateur = $dbco->query("SELECT * FROM ".DBTABLEPREFIX."alias WHERE email='".$_POST['email']."' ORDER BY dateCreat DESC")->fetchAll() ;
echo '<p>Utilisateur '.$_POST['email'].' : '; echo '<p>User '.$_POST['email'].' : ';
if (count($requestUtilisateur) != 0) { if (count($requestUtilisateur) != 0) {
echo '<img onclick="confirmation(\'uniqemail_'.$_POST['email'].'\', \'uniqaction_'.$_POST['email'].'\', \'DeleteEmail\')" src="'.URLINC.'/sup.png" alt="sup" />'; echo '<img onclick="confirmation(\'uniqemail_'.$_POST['email'].'\', \'uniqaction_'.$_POST['email'].'\', \'DeleteEmail\')" src="'.URLINC.'/sup.png" alt="sup" />';
if (!BlacklistEmail($_POST['email'])) { if (!BlacklistEmail($_POST['email'])) {
echo '<img onclick="confirmation(\'uniqemail_'.$_POST['email'].'\', \'uniqaction_'.$_POST['email'].'\', \'AddBlacklistEmail\')" src="'.URLINC.'/blk.png" alt="blk" />'; echo '<img onclick="confirmation(\'uniqemail_'.$_POST['email'].'\', \'uniqaction_'.$_POST['email'].'\', \'AddBlacklistEmail\')" src="'.URLINC.'/blk.png" alt="blk" />';
} }
} else { } else {
echo 'N\'existe pas !'; echo 'Not found !';
} }
echo '<form style="display: none" method="post" action="#" id="uniqemail_'.$_POST['email'].'"> echo '<form style="display: none" method="post" action="#" id="uniqemail_'.$_POST['email'].'">
<input type="hidden" name="email" value="'.$_POST['email'].'" />