1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/emailpoubelle_ynh.git synced 2024-09-03 18:26:29 +02:00

V 2.0 internationnal version !

This commit is contained in:
David 2018-11-16 13:36:55 +01:00
parent 76d0933052
commit 218bcf0969
18 changed files with 1360 additions and 116 deletions

View file

@ -1,8 +1,13 @@
## 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...

View file

@ -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
[...] [...]

View file

@ -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);

View file

@ -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 {
} }
$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 {
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) {
$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) {
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
} 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
$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
////////////////// //////////////////
?> ?>
<?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
} }
?> ?>
<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,8 +359,8 @@ 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

View file

@ -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) {
// 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) {
} }
$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) {
} }
</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'].'" /> <input type="hidden" name="email" value="'.$_POST['email'].'" />
@ -140,7 +141,7 @@ if ($auth==true) {
echo '<table>'; echo '<table>';
echo '<tr> echo '<tr>
<th>Email</th> <th>Email</th>
<th style="text-align: center">Nombre d\'alias</th> <th style="text-align: center">Number of alias</th>
<th style="text-align: center">Action</th> <th style="text-align: center">Action</th>
</tr>'; </tr>';
foreach ($recordActifs as $recordActif) { foreach ($recordActifs as $recordActif) {

Binary file not shown.

View file

@ -0,0 +1,369 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-11-16 12:45+0100\n"
"PO-Revision-Date: 2018-11-16 13:02+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Report-msgstr-Bugs-To: \n"
"X-Generator: Poedit 2.0.6\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: emailPoubelleAdmin.php:27
msgid "Error: Incorrect password"
msgstr "Erreur : mot de passe incorrect"
#: emailPoubelleAdmin.php:75
msgid "Statistics"
msgstr "Statistique"
#: emailPoubelleAdmin.php:77
msgid "Total alias"
msgstr "Alias total"
#: emailPoubelleAdmin.php:78
msgid "Active alias"
msgstr "Alias actif"
#: emailPoubelleAdmin.php:79
msgid "Alias suspended"
msgstr "Alias suspendu"
#: emailPoubelleAdmin.php:80
msgid "Alias not verified"
msgstr "Alias non vérifié"
#: emailPoubelleAdmin.php:86
msgid "User email"
msgstr "Email de l'utilisateur"
#: emailPoubelle.php:22
msgid "Debug enabled"
msgstr "Debug activé"
#: emailPoubelle.php:28
msgid "Error : the configuration file conf.php might not be included because the constants are not declared"
msgstr "Erreur : Il ne semble pas que le fichier de configuration conf.php soit inclue car les constantes ne sont pas présentes"
#: emailPoubelle.php:31
msgid "Error : the working directory cannot be written. Please contact the admin"
msgstr "Erreur : le répertoire de travail ne peut pas être écrit. Merci de contacter l\\'administrateur"
#: emailPoubelle.php:34
msgid "Error : the alias file cannot be written. Please contact the admin"
msgstr "Erreur : le fichier d\\'alias ne peut pas être écrit. Merci de contacter l\\'administrateur"
#: emailPoubelle.php:37
msgid "Error : the blacklist file cannot be read. Please contact the admin"
msgstr "Erreur : un fichier de blacklist est renseigné mais n\\'est pas lisible. Merci de contacter l\\'administrateur"
#: emailPoubelle.php:40
msgid "Error : the forbidden aliases file cannot be read. Please contact the admin"
msgstr "Erreur : un fichier d\\'alias interdit est renseigné mais n\\'est pas lisible. Merci de contacter l\\'administrateur"
#: emailPoubelle.php:43 emailPoubelle.php:47
msgid "Service under maintenance"
msgstr "Le service est en maintenance"
#: emailPoubelle.php:85
msgid "Error initializing tables. Please contact the admin"
msgstr "Erreur à l\\'initialisation des tables. Merci de contacter l'administrateur"
#: emailPoubelle.php:102 emailPoubelle.php:173
msgid "Your trash email address"
msgstr "Votre email poubelle"
#: emailPoubelle.php:102 emailPoubelle.php:173
msgid "is now enabled"
msgstr "est maintenant actif"
#: emailPoubelle.php:104
msgid "Error : unknown ID or already validated"
msgstr "Erreur : ID introuvable ou déjà validé"
#: emailPoubelle.php:121
msgid "The scheduled task is running"
msgstr "La tâche planifié est lancé"
#: emailPoubelle.php:124
msgid "You didn't allow the scheduled job"
msgstr "Vous n\\'avez pas autorisé le lancement par tâche planifié"
#: emailPoubelle.php:134 emailPoubelle.php:136 emailPoubelle.php:151
#: emailPoubelle.php:153
msgid "Error : email address incorrect"
msgstr "Erreur : Adresse email incorrect"
#: emailPoubelle.php:138 emailPoubelle.php:200
msgid "An email has been sent to you"
msgstr "Un email vient de vous être envoyé"
#: emailPoubelle.php:140
msgid "Error : no known active trash email"
msgstr "Erreur : aucun email actif connu"
#: emailPoubelle.php:155
msgid "Error : trash email address syntax incorrect"
msgstr "Erreur : Format de l\\'email poubelle incorrect"
#: emailPoubelle.php:157
msgid "Error : this domain cannot be used"
msgstr "Erreur : ce domain n\\'est pas pris en charge"
#: emailPoubelle.php:159
msgid "Error : Your email can not contain a trash domain"
msgstr "Erreur : votre email ne peut pas être un email poubelle"
#: emailPoubelle.php:161
msgid "Error : trash email address forbidden"
msgstr "Erreur : email poubelle interdit"
#: emailPoubelle.php:163
msgid "Error : you have been blacklisted"
msgstr "Erreur : vous avez été blacklisté sur ce service"
#: emailPoubelle.php:167
msgid "Error : this trash email already exists"
msgstr "Erreur : cet email poubelle est déjà utilisé"
#: emailPoubelle.php:169
msgid "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"
msgstr "Erreur : Vous avez atteind votre quota limite d'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"
#: emailPoubelle.php:176
msgid "Confirmation of the creation of your trash email :"
msgstr "Confirmation de la création de votre email poubelle :"
#: emailPoubelle.php:178
msgid "Click on the link below to validate :"
msgstr "Cliquer sur le lien ci-dessous pour confirmer :"
#: emailPoubelle.php:181
msgid "To delete this trash email, click on the link below :"
msgstr "Pour supprimer cet email poubelle vous pouvez vous rendre sur le lien ci-dessous :"
#: emailPoubelle.php:184
msgid "After confirmation, you will be able to temporary suspend you trash email using the link below :"
msgstr "Après confirmation, vous pourrez suspendre temporairement cet email poubelle vous pouvez vous rendre sur le lien ci-dessous :"
#: emailPoubelle.php:186
msgid "Alias confirmation"
msgstr "Confirmation alias"
#: emailPoubelle.php:187
msgid "Your email address"
msgstr "Votre email"
#: emailPoubelle.php:187
msgid "is unknown, a confirmation has been sent to you."
msgstr "nous étant inconnu, une confirmation vous a été envoyé par email."
#: emailPoubelle.php:193
msgid "Confirmation of the removal of your trash email : "
msgstr "Confirmation de la suppression de votre email poubelle "
#: emailPoubelle.php:195
msgid "Click on the link below to validate the deletion :"
msgstr "Cliquer sur le lien ci-dessous pour confirmer la suppression :"
#: emailPoubelle.php:197
msgid "If you would like to temporary suspend this trash email, you can follow the link bellow :"
msgstr "Sinon pour suspendre temporairement cet email poubelle vous pouvez vous rendre sur le lien ci-dessous :"
#: emailPoubelle.php:199
msgid "Alias deletion"
msgstr "Suppression de l'alias"
#: emailPoubelle.php:202
msgid "Error : unknown trash email"
msgstr "Erreur : impossible de trouver cet email poubelle"
#: emailPoubelle.php:230
msgid "Add"
msgstr "Ajouter"
#: emailPoubelle.php:231
msgid "List"
msgstr "Lister"
#: emailPoubelle.php:232 emailPoubelle.php:274
msgid "Delete"
msgstr "Supprimer"
#: emailPoubelle.php:233 emailPoubelle.php:275
msgid "Suspend"
msgstr "Suspendre"
#: emailPoubelle.php:234 emailPoubelle.php:276
msgid "Resume"
msgstr "Reprendre"
#: emailPoubelle.php:238
msgid "Your real email address"
msgstr "Votre email réel"
#: emailPoubelle.php:241
msgid "Remember"
msgstr "Mémoriser"
#: emailPoubelle.php:244
msgid "Name of your trash email address"
msgstr "Nom de l'email poubelle"
#: emailPoubelle.php:245
msgid "Ex : john_shop"
msgstr "Ex : jean-petiteannonce"
#: emailPoubelle.php:258
msgid "Unlimited time"
msgstr "Illimité"
#: emailPoubelle.php:259
msgid "2 hours"
msgstr "2 heure"
#: emailPoubelle.php:260
msgid "6 hours"
msgstr "6 heures"
#: emailPoubelle.php:261
msgid "1 day"
msgstr "1 jour"
#: emailPoubelle.php:262
msgid "7 days"
msgstr "7 jours"
#: emailPoubelle.php:263
msgid "15 days"
msgstr "15 jours"
#: emailPoubelle.php:264
msgid "30 days"
msgstr "30 jours"
#: emailPoubelle.php:265
msgid "90 days"
msgstr "90 jours"
#: emailPoubelle.php:269
msgid "Comment for this trash email (for your to remember)"
msgstr "Un commentaire pour l'ajout ? (pour votre mémoire)"
#: emailPoubelle.php:270
msgid "Ex : Inscription sur zici.fr"
msgstr "Ex : Inscription sur zici.fr"
#: emailPoubelle.php:273
msgid "Activate"
msgstr "Activer"
#: emailPoubelle.php:362
msgid "Version"
msgstr "Version"
#: emailPoubelle.php:362
msgid "Created by David Mercereau under licence GNU GPL v3"
msgstr "Créé par David Mercereau sous licence GNU GPL v3"
#: emailPoubelle.php:363
msgid "Download and use this script on the project website"
msgstr "Télécharger et utiliser ce script sur le site du projet"
#: ep_function.php:93
msgid "has been deleted with all these aliases"
msgstr "a été supprimé avec tout ces alias"
#: ep_function.php:99
msgid "Erreur"
msgstr "Erreur"
#: ep_function.php:99
msgid "has not been deleted"
msgstr "n'a pas été supprimé"
#: ep_function.php:120
msgid "has been deleted"
msgstr "a bien été supprimé"
#: ep_function.php:126
msgid "Error: email trash unknown"
msgstr "Erreur : email poubelle inconnu"
#: ep_function.php:145 ep_function.php:173
msgid "Error: Can not find this trash email"
msgstr "Erreur : impossible de trouver cet email poubelle"
#: ep_function.php:148 ep_function.php:150 ep_function.php:152
#: ep_function.php:176 ep_function.php:178 ep_function.php:180
msgid "The reception on"
msgstr "La réception sur"
#: ep_function.php:148
msgid "is active again"
msgstr "est maintenant activé"
#: ep_function.php:150
msgid "is already active"
msgstr "est déjà activé"
#: ep_function.php:152
msgid "has not been confirmed by email"
msgstr "n\\'à pas été confirmé par email"
#: ep_function.php:154 ep_function.php:182
msgid "Error: unknown status"
msgstr "Erreur : statu inconnu"
#: ep_function.php:176
msgid "is now suspended"
msgstr "est maintenant suspendu"
#: ep_function.php:178
msgid "is already suspended"
msgstr "est déjà suspendu"
#: ep_function.php:180
msgid "can not be suspended because it has not been activated yet"
msgstr "ne peut pas être suspendu car il n'a pas encore été activé"
#: ep_function.php:254
msgid "List trash email activate"
msgstr "Liste de vos email poubelles actif"
#: ep_function.php:257
msgid "List trash email disable"
msgstr "Liste de vos email poubelles désactivé"
#: ep_function.php:259
msgid "Create "
msgstr "Créer le "
#: ep_function.php:261
msgid "and expires on"
msgstr "an expire le"
#: ep_function.php:265
msgid "Comment :"
msgstr "Commentaire :"
#: ep_function.php:268
msgid "Disable :"
msgstr "Désactivé :"
#: ep_function.php:271
msgid "Activate :"
msgstr "Activé :"
#: ep_function.php:274
msgid "Delete :"
msgstr "Supprimé :"
#: ep_function.php:280
msgid "List trash email"
msgstr "Liste email poubelle"

View file

@ -0,0 +1,312 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2018-11-16 12:57+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Report-msgstr-Bugs-To: \n"
"X-Generator: Poedit 2.0.6\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"POT-Creation-Date: \n"
msgid "1 hours"
msgstr "1 hour"
msgid "15 hours"
msgstr "15 hours"
msgid "2 hours"
msgstr "2 heure"
msgid "30 hours"
msgstr "30 hours"
msgid "6 hours"
msgstr "6 heures"
msgid "7 hours"
msgstr "7 hours"
msgid "90 hours"
msgstr "90 hours"
msgid "Activate"
msgstr "Activer"
msgid "Activate :"
msgstr "Activé : "
msgid "Active alias"
msgstr "Alias actif"
msgid "Add"
msgstr "Ajouter"
msgid ""
"After confirmation, you will be able to temporary suspend you trash email "
"using the link below :"
msgstr ""
"Après confirmation, vous pourrez suspendre temporairement cet email poubelle "
"vous pouvez vous rendre sur le lien ci-dessous : "
msgid "Alias confirmation"
msgstr "Confirmation alias "
msgid "Alias deletion"
msgstr "Suppression de l\\'alias "
msgid "Alias not verified"
msgstr "Alias non vérifié"
msgid "Alias suspended"
msgstr "Alias suspendu"
msgid "An email has been sent to you"
msgstr "Un email vient de vous être envoyé"
msgid "Click on the link below to validate :"
msgstr "Cliquer sur le lien ci-dessous pour confirmer"
msgid "Click on the link below to validate the deletion :"
msgstr "Cliquer sur le lien ci-dessous pour confirmer la suppression : "
msgid "Comment :"
msgstr "Commentaire"
msgid "Comment for this trash email (for your to remember)"
msgstr "Un commentaire pour l'ajout ? (pour votre mémoire)"
msgid "Confirmation of the creation of your trash email :"
msgstr "Confirmation de la création de votre email poubelle"
msgid "Confirmation of the removal of your trash email : "
msgstr "Confirmation de la suppression de votre email poubelle"
msgid "Created by David Mercereau under licence GNU GPL v3"
msgstr "Créé par David Mercereau sous licence GNU GPL v3"
msgid "Créé le"
msgstr "Crée le"
msgid "Debug enabled"
msgstr "Debug activé"
msgid "Delete"
msgstr "Supprimer"
msgid "Delete :"
msgstr "Supprimé : "
msgid "Disable :"
msgstr "Désactivé : "
msgid "Download and use this script on the project website"
msgstr "Télécharger et utiliser ce script sur le site du projet"
msgid "Erreur"
msgstr "Erreur"
msgid "Error : Your email can not contain a trash domain"
msgstr "Erreur : votre email ne peut pas être un email poubelle"
msgid "Error : email address incorrect"
msgstr "Erreur : Adresse email incorrect"
msgid "Error : no known active trash email"
msgstr "Erreur : aucun email actif connu"
msgid "Error : the alias file cannot be written. Please contact the admin"
msgstr ""
"Erreur : le fichier d\\'alias ne peut pas être écrit. Merci de contacter l"
"\\'administrateur"
msgid "Error : the blacklist file cannot be read. Please contact the admin"
msgstr ""
"Erreur : un fichier de blacklist est renseigné mais n\\'est pas lisible. "
"Merci de contacter l\\'administrateur"
msgid ""
"Error : the configuration file conf.php might not be included because the "
"constants are not declared"
msgstr ""
"Erreur : Il ne semble pas que le fichier de configuration conf.php soit "
"inclue car les constantes ne sont pas présentes"
msgid ""
"Error : the forbidden aliases file cannot be read. Please contact the admin"
msgstr ""
"Erreur : un fichier d\\'alias interdit est renseigné mais n\\'est pas "
"lisible. Merci de contacter l\\'administrateur"
msgid ""
"Error : the working directory cannot be written. Please contact the admin"
msgstr ""
"Erreur : le répertoire de travail ne peut pas être écrit. Merci de contacter "
"l\\'administrateur"
msgid "Error : this domain cannot be used"
msgstr "Erreur : ce domain n\\'est pas pris en charge"
msgid "Error : this trash email already exists"
msgstr "Erreur : cet email poubelle est déjà utilisé"
msgid "Error : trash email address forbidden"
msgstr "Erreur : email poubelle interdit"
msgid "Error : trash email address syntax incorrect"
msgstr "Erreur : Format de l\\'email poubelle incorrect"
msgid "Error : unknown ID or already validated"
msgstr "Erreur : ID introuvable ou déjà validé"
msgid "Error : unknown trash email"
msgstr "Erreur : impossible de trouver cet email poubelle"
msgid "Error : you have been blacklisted"
msgstr "Erreur : vous avez été blacklisté sur ce service"
msgid "Error initializing tables. Please contact the admin"
msgstr ""
"Erreur à l\\'initialisation des tables. Merci de contacter l"
"\\'administrateur "
msgid "Error: Can not find this trash email"
msgstr "Erreur : impossible de trouver cet email poubelle"
msgid "Error: Incorrect password"
msgstr "Erreur : mot de passe incorrect"
msgid ""
"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"
msgstr ""
"Erreur : Vous avez atteind votre quota limite d'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."
msgid "Error: email trash unknown"
msgstr "Erreur : email poubelle inconnu"
msgid "Error: unknown status"
msgstr "Erreur : statu inconnu"
msgid "Ex : Inscription sur zici.fr"
msgstr "Ex : Inscription sur zici.fr"
msgid "Ex : john_shop"
msgstr "Ex : jean-petiteannonce"
msgid ""
"If you would like to temporary suspend this trash email, you can follow the "
"link bellow :"
msgstr ""
"Sinon pour suspendre temporairement cet email poubelle vous pouvez vous "
"rendre sur le lien ci-dessous : "
msgid "List"
msgstr "Lister"
msgid "List trash email"
msgstr "Liste email poubelle"
msgid "List trash email activate"
msgstr "Liste de vos email poubelles actif"
msgid "List trash email disable"
msgstr "Liste de vos email poubelles désactivé"
msgid "Name of your trash email address"
msgstr "Nom de l'email poubelle"
msgid "Remember"
msgstr "Mémoriser"
msgid "Resume"
msgstr "Reprendre"
msgid "Service under maintenance"
msgstr "Le service est en maintenance"
msgid "Statistics"
msgstr "Statistique"
msgid "Suspend"
msgstr "Suspendre"
msgid "The reception on"
msgstr "La réception sur"
msgid "The scheduled task is running"
msgstr "La tâche planifié est lancé"
msgid "To delete this trash email, click on the link below :"
msgstr ""
"Pour supprimer cet email poubelle vous pouvez vous rendre sur le lien ci-"
"dessous :"
msgid "Total alias"
msgstr "Alias total"
msgid "Unlimited time"
msgstr "Illimité"
msgid "User email"
msgstr "Email de l'utilisateur"
msgid "Version"
msgstr "Version"
msgid "You didn't allow the scheduled job"
msgstr "Vous n\\'avez pas autorisé le lancement par tâche planifié"
msgid "Your email address"
msgstr "Votre email "
msgid "Your real email address"
msgstr "Votre email réel"
msgid "Your trash email address"
msgstr "Votre email poubelle"
msgid "can not be suspended because it has not been activated yet"
msgstr "ne peut pas être suspendu car il n'a pas encore été activé"
msgid "et expire le"
msgstr "et expire le"
msgid "has been deleted"
msgstr "a bien été supprimé"
msgid "has been deleted with all these aliases"
msgstr "a été supprimé avec tout ces alias"
msgid "has not been confirmed by email"
msgstr "n\\'à pas été confirmé par email"
msgid "has not been deleted"
msgstr "n'a pas été supprimé"
msgid "is active again"
msgstr "est maintenant activé"
msgid "is already active"
msgstr "est déjà activé"
msgid "is already suspended"
msgstr "Est déjà suspendu"
msgid "is now enabled"
msgstr "est maintenant actif"
msgid "is now suspended"
msgstr "Est maintenant suspendu"
msgid "is unknown, a confirmation has been sent to you."
msgstr "nous étant inconnu, une confirmation vous a été envoyé par email."

1
lang/fr_FR Symbolic link
View file

@ -0,0 +1 @@
fr

383
lang/messages.pot Normal file
View file

@ -0,0 +1,383 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-11-16 12:45+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: emailPoubelleAdmin.php:27
msgid "Error: Incorrect password"
msgstr ""
#: emailPoubelleAdmin.php:75
msgid "Statistics"
msgstr ""
#: emailPoubelleAdmin.php:77
msgid "Total alias"
msgstr ""
#: emailPoubelleAdmin.php:78
msgid "Active alias"
msgstr ""
#: emailPoubelleAdmin.php:79
msgid "Alias suspended"
msgstr ""
#: emailPoubelleAdmin.php:80
msgid "Alias not verified"
msgstr ""
#: emailPoubelleAdmin.php:86
msgid "User email"
msgstr ""
#: emailPoubelle.php:22
msgid "Debug enabled"
msgstr ""
#: emailPoubelle.php:28
msgid ""
"Error : the configuration file conf.php might not be included because the "
"constants are not declared"
msgstr ""
#: emailPoubelle.php:31
msgid ""
"Error : the working directory cannot be written. Please contact the admin"
msgstr ""
#: emailPoubelle.php:34
msgid "Error : the alias file cannot be written. Please contact the admin"
msgstr ""
#: emailPoubelle.php:37
msgid "Error : the blacklist file cannot be read. Please contact the admin"
msgstr ""
#: emailPoubelle.php:40
msgid ""
"Error : the forbidden aliases file cannot be read. Please contact the admin"
msgstr ""
#: emailPoubelle.php:43 emailPoubelle.php:47
msgid "Service under maintenance"
msgstr ""
#: emailPoubelle.php:85
msgid "Error initializing tables. Please contact the admin"
msgstr ""
#: emailPoubelle.php:102 emailPoubelle.php:173
msgid "Your trash email address"
msgstr ""
#: emailPoubelle.php:102 emailPoubelle.php:173
msgid "is now enabled"
msgstr ""
#: emailPoubelle.php:104
msgid "Error : unknown ID or already validated"
msgstr ""
#: emailPoubelle.php:121
msgid "The scheduled task is running"
msgstr ""
#: emailPoubelle.php:124
msgid "You didn't allow the scheduled job"
msgstr ""
#: emailPoubelle.php:134 emailPoubelle.php:136 emailPoubelle.php:151
#: emailPoubelle.php:153
msgid "Error : email address incorrect"
msgstr ""
#: emailPoubelle.php:138 emailPoubelle.php:200
msgid "An email has been sent to you"
msgstr ""
#: emailPoubelle.php:140
msgid "Error : no known active trash email"
msgstr ""
#: emailPoubelle.php:155
msgid "Error : trash email address syntax incorrect"
msgstr ""
#: emailPoubelle.php:157
msgid "Error : this domain cannot be used"
msgstr ""
#: emailPoubelle.php:159
msgid "Error : Your email can not contain a trash domain"
msgstr ""
#: emailPoubelle.php:161
msgid "Error : trash email address forbidden"
msgstr ""
#: emailPoubelle.php:163
msgid "Error : you have been blacklisted"
msgstr ""
#: emailPoubelle.php:167
msgid "Error : this trash email already exists"
msgstr ""
#: emailPoubelle.php:169
msgid ""
"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"
msgstr ""
#: emailPoubelle.php:176
msgid "Confirmation of the creation of your trash email :"
msgstr ""
#: emailPoubelle.php:178
msgid "Click on the link below to validate :"
msgstr ""
#: emailPoubelle.php:181
msgid "To delete this trash email, click on the link below :"
msgstr ""
#: emailPoubelle.php:184
msgid ""
"After confirmation, you will be able to temporary suspend you trash email "
"using the link below :"
msgstr ""
#: emailPoubelle.php:186
msgid "Alias confirmation"
msgstr ""
#: emailPoubelle.php:187
msgid "Your email address"
msgstr ""
#: emailPoubelle.php:187
msgid "is unknown, a confirmation has been sent to you."
msgstr ""
#: emailPoubelle.php:193
msgid "Confirmation of the removal of your trash email : "
msgstr ""
#: emailPoubelle.php:195
msgid "Click on the link below to validate the deletion :"
msgstr ""
#: emailPoubelle.php:197
msgid ""
"If you would like to temporary suspend this trash email, you can follow the "
"link bellow :"
msgstr ""
#: emailPoubelle.php:199
msgid "Alias deletion"
msgstr ""
#: emailPoubelle.php:202
msgid "Error : unknown trash email"
msgstr ""
#: emailPoubelle.php:230
msgid "Add"
msgstr ""
#: emailPoubelle.php:231
msgid "List"
msgstr ""
#: emailPoubelle.php:232 emailPoubelle.php:274
msgid "Delete"
msgstr ""
#: emailPoubelle.php:233 emailPoubelle.php:275
msgid "Suspend"
msgstr ""
#: emailPoubelle.php:234 emailPoubelle.php:276
msgid "Resume"
msgstr ""
#: emailPoubelle.php:238
msgid "Your real email address"
msgstr ""
#: emailPoubelle.php:241
msgid "Remember"
msgstr ""
#: emailPoubelle.php:244
msgid "Name of your trash email address"
msgstr ""
#: emailPoubelle.php:245
msgid "Ex : john_shop"
msgstr ""
#: emailPoubelle.php:258
msgid "Unlimited time"
msgstr ""
#: emailPoubelle.php:259
msgid "2 hours"
msgstr ""
#: emailPoubelle.php:260
msgid "6 hours"
msgstr ""
#: emailPoubelle.php:261
msgid "1 day"
msgstr ""
#: emailPoubelle.php:262
msgid "7 days"
msgstr ""
#: emailPoubelle.php:263
msgid "15 days"
msgstr ""
#: emailPoubelle.php:264
msgid "30 days"
msgstr ""
#: emailPoubelle.php:265
msgid "90 days"
msgstr ""
#: emailPoubelle.php:269
msgid "Comment for this trash email (for your to remember)"
msgstr ""
#: emailPoubelle.php:270
msgid "Ex : Inscription sur zici.fr"
msgstr ""
#: emailPoubelle.php:273
msgid "Activate"
msgstr ""
#: emailPoubelle.php:362
msgid "Version"
msgstr ""
#: emailPoubelle.php:362
msgid "Created by David Mercereau under licence GNU GPL v3"
msgstr ""
#: emailPoubelle.php:363
msgid "Download and use this script on the project website"
msgstr ""
#: ep_function.php:93
msgid "has been deleted with all these aliases"
msgstr ""
#: ep_function.php:99
msgid "Erreur"
msgstr ""
#: ep_function.php:99
msgid "has not been deleted"
msgstr ""
#: ep_function.php:120
msgid "has been deleted"
msgstr ""
#: ep_function.php:126
msgid "Error: email trash unknown"
msgstr ""
#: ep_function.php:145 ep_function.php:173
msgid "Error: Can not find this trash email"
msgstr ""
#: ep_function.php:148 ep_function.php:150 ep_function.php:152
#: ep_function.php:176 ep_function.php:178 ep_function.php:180
msgid "The reception on"
msgstr ""
#: ep_function.php:148
msgid "is active again"
msgstr ""
#: ep_function.php:150
msgid "is already active"
msgstr ""
#: ep_function.php:152
msgid "has not been confirmed by email"
msgstr ""
#: ep_function.php:154 ep_function.php:182
msgid "Error: unknown status"
msgstr ""
#: ep_function.php:176
msgid "is now suspended"
msgstr ""
#: ep_function.php:178
msgid "is already suspended"
msgstr ""
#: ep_function.php:180
msgid "can not be suspended because it has not been activated yet"
msgstr ""
#: ep_function.php:254
msgid "List trash email activate"
msgstr ""
#: ep_function.php:257
msgid "List trash email disable"
msgstr ""
#: ep_function.php:259
msgid "Create "
msgstr ""
#: ep_function.php:261
msgid "and expires on"
msgstr ""
#: ep_function.php:265
msgid "Comment :"
msgstr ""
#: ep_function.php:268
msgid "Disable :"
msgstr ""
#: ep_function.php:271
msgid "Activate :"
msgstr ""
#: ep_function.php:274
msgid "Delete :"
msgstr ""
#: ep_function.php:280
msgid "List trash email"
msgstr ""

11
lang/note.txt Normal file
View file

@ -0,0 +1,11 @@
cp lib/ep_function.php .
xgettext *.php -o lang/messages.pot --from-code="UTF-8"
msgmerge --no-wrap -N lang/fr/LC_MESSAGES/messages.po lang/messages.pot > lang/fr/LC_MESSAGES/messages-new.po
# Edit lang/fr/LC_MESSAGES/messages-new.po
mv lang/fr/LC_MESSAGES/messages-new.po lang/fr/LC_MESSAGES/messages.po
mv lang/fr/LC_MESSAGES/messages-new.mo lang/fr/LC_MESSAGES/messages.mo
rm ep_function.php
msgfmt -o lang/fr/LC_MESSAGES/messages.mo -v lang/fr/LC_MESSAGES/messages.po

BIN
lib/drapaux.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
lib/en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -7,6 +7,7 @@
// Status explication : // Status explication :
// 0=not verified - 3=disable - 5=active // 0=not verified - 3=disable - 5=active
// Verification des emails // Verification des emails
function VerifMXemail($email) { function VerifMXemail($email) {
if (CHECKMX) { if (CHECKMX) {
@ -89,13 +90,13 @@ function DeleteEmail($email) {
$deletecmd = $dbco->prepare("DELETE FROM ".DBTABLEPREFIX."alias WHERE email = :email"); $deletecmd = $dbco->prepare("DELETE FROM ".DBTABLEPREFIX."alias WHERE email = :email");
$deletecmd->bindParam('email', $email, PDO::PARAM_STR); $deletecmd->bindParam('email', $email, PDO::PARAM_STR);
$deletecmd->execute(); $deletecmd->execute();
echo '<div class="highlight-3">l\'email <b>'.$email.'</b> a bien été supprimé avec tout ces alias.</div>'; echo '<div class="highlight-3"><b>'.$email.'</b> '._('has been deleted with all these aliases').'.</div>';
} catch ( PDOException $e ) { } catch ( PDOException $e ) {
echo "DB error : ", $e->getMessage(); echo "DB error : ", $e->getMessage();
die(); die();
} }
} else { } else {
echo '<div class="highlight-1">Erreur : email <b>'.$email.'</b> n\'a pas été supprimé.</div>'; echo '<div class="highlight-1">'._('Erreur').' : <b>'.$email.'</b> '._('has not been deleted').'.</div>';
} }
UpdateVirtualDB(); UpdateVirtualDB();
} }
@ -116,13 +117,13 @@ function DeleteAlias($id, $alias_full) {
$deletecmd->bindParam('id', $id, PDO::PARAM_INT); $deletecmd->bindParam('id', $id, PDO::PARAM_INT);
$deletecmd->bindParam('alias_full', $alias_full, PDO::PARAM_STR); $deletecmd->bindParam('alias_full', $alias_full, PDO::PARAM_STR);
$deletecmd->execute(); $deletecmd->execute();
echo '<div class="highlight-3">l\'email <b>'.$alias_full.'</b> a bien été supprimé</div>'; echo '<div class="highlight-3"><b>'.$alias_full.'</b> '._('has been deleted').'</div>';
} catch ( PDOException $e ) { } catch ( PDOException $e ) {
echo "DB error : ", $e->getMessage(); echo "DB error : ", $e->getMessage();
die(); die();
} }
} else { } else {
echo '<div class="highlight-1">Erreur : email poubelle inconnu</div>'; echo '<div class="highlight-1">'._('Error: email trash unknown').'</div>';
} }
UpdateVirtualDB(); UpdateVirtualDB();
} }
@ -141,16 +142,16 @@ function EnableAlias($id, $alias_full, $email) {
$selectcmd->execute(); $selectcmd->execute();
$alias_fetch = $selectcmd->fetch(); $alias_fetch = $selectcmd->fetch();
if (! $alias_fetch) { if (! $alias_fetch) {
echo '<div class="highlight-1">Erreur : impossible de trouver cet email poubelle</div>'; echo '<div class="highlight-1">'._('Error: Can not find this trash email').'</div>';
} else if ($alias_fetch['status'] == 3) { } else if ($alias_fetch['status'] == 3) {
UpdateStatusAlias($alias_fetch['id'], $alias_full, 5); UpdateStatusAlias($alias_fetch['id'], $alias_full, 5);
echo '<div class="highlight-3">La réception sur <b>'.$alias_full.'</b> est de nouveau active.</div>'; echo '<div class="highlight-3">'._('The reception on').' <b>'.$alias_full.'</b> '._('is active again').'.</div>';
} else if ($alias_fetch['status'] == 5) { } else if ($alias_fetch['status'] == 5) {
echo '<div class="highlight-2">La réception sur <b>'.$alias_full.'</b> est déjà active.</div>'; echo '<div class="highlight-2">'._('The reception on').' <b>'.$alias_full.'</b> '._('is already active').'.</div>';
} else if ($alias_fetch['status'] == 0) { } else if ($alias_fetch['status'] == 0) {
echo '<div class="highlight-1">La réception sur <b>'.$alias_full.'</b n\'à pas été confirmé par email.</div>'; echo '<div class="highlight-1">'._('The reception on').' <b>'.$alias_full.'</b '._('has not been confirmed by email').'.</div>';
} else { } else {
echo '<div class="highlight-1">Erreur : status inconnu</div>'; echo '<div class="highlight-1">'._('Error: unknown status').'</div>';
} }
UpdateVirtualDB(); UpdateVirtualDB();
} }
@ -169,16 +170,16 @@ function DisableAlias($id, $alias_full, $email) {
$selectcmd->execute(); $selectcmd->execute();
$alias_fetch = $selectcmd->fetch(); $alias_fetch = $selectcmd->fetch();
if (! $alias_fetch) { if (! $alias_fetch) {
echo '<div class="highlight-1">Erreur : impossible de trouver cet email poubelle</div>'; echo '<div class="highlight-1">'._('Error: Can not find this trash email').'</div>';
} else if ($alias_fetch['status'] == 5) { } else if ($alias_fetch['status'] == 5) {
UpdateStatusAlias($alias_fetch['id'], $alias_full, 3); UpdateStatusAlias($alias_fetch['id'], $alias_full, 3);
echo '<div class="highlight-3">La réception sur <b>'.$alias_full.'</b> est maintenant suspendu.</div>'; echo '<div class="highlight-3">'._('The reception on').' <b>'.$alias_full.'</b> '._('is now suspended').'.</div>';
} else if ($alias_fetch['status'] == 3) { } else if ($alias_fetch['status'] == 3) {
echo '<div class="highlight-2">La réception sur <b>'.$alias_full.'</b> est déjà suspendu.</div>'; echo '<div class="highlight-2">'._('The reception on').' <b>'.$alias_full.'</b> '._('is already suspended').'.</div>';
} else if ($alias_fetch['status'] == 0) { } else if ($alias_fetch['status'] == 0) {
echo '<div class="highlight-1">La réception sur <b>'.$alias_full.'</b> ne peut être suspendu car elle n\'a pas encore été activé.</div>'; echo '<div class="highlight-1">'._('The reception on').' <b>'.$alias_full.'</b> '._('can not be suspended because it has not been activated yet').'.</div>';
} else { } else {
echo '<div class="highlight-1">Erreur : status inconnu</div>'; echo '<div class="highlight-1">'._('Error: unknown status').'</div>';
} }
UpdateVirtualDB(); UpdateVirtualDB();
} }
@ -250,33 +251,33 @@ function ListeAlias($email) {
} }
$nb_alias=0; $nb_alias=0;
$nb_alias_disable=0; $nb_alias_disable=0;
$message= "## Liste de vos redirections poubelles active : \n\n"; $message= "## "._('List trash email activate')." : \n\n";
while($alias_db = $selectcmd->fetch()) { while($alias_db = $selectcmd->fetch()) {
if ($alias_db['status'] == 3 && $nb_alias_disable == 0) { if ($alias_db['status'] == 3 && $nb_alias_disable == 0) {
$message.= "## Liste de vos redirections poubelles désactivé : \n\n"; $message.= "## "._('List trash email disable')." : \n\n";
} }
$message.=" * ".$alias_db['alias']." Créé le ".$alias_db['dateCreat']; $message.=" * ".$alias_db['alias']." "._('Create ')." ".$alias_db['dateCreat'];
if ($alias_db['dateExpir']) { if ($alias_db['dateExpir']) {
$message.=" et expire le ".$alias_db['dateExpir']; $message.=" "._('and expires on')." ".$alias_db['dateExpir'];
} }
$message.="\n"; $message.="\n";
if ($alias_db['comment']) { if ($alias_db['comment']) {
$message.="\tCommentaire : ".$alias_db['comment']."\n"; $message.="\t"._('Comment :')." ".$alias_db['comment']."\n";
} }
if ($alias_db['status'] == 5) { if ($alias_db['status'] == 5) {
$message.="\tDésactiver : ".urlGen('disable',$alias_db['id'],$alias_db['alias'])."\n"; $message.="\t"._('Disable :')." ".urlGen('disable',$alias_db['id'],$alias_db['alias'])."\n";
$nb_alias++; $nb_alias++;
} else { } else {
$message.="\tActiver : ".urlGen('enable',$alias_db['id'],$alias_db['alias'])."\n"; $message.="\t"._('Activate :')." ".urlGen('enable',$alias_db['id'],$alias_db['alias'])."\n";
$nb_alias_disable++; $nb_alias_disable++;
} }
$message.="\tSupprimer : ".urlGen('delete',$alias_db['id'],$alias_db['alias'])."\n\n"; $message.="\t"._('Delete :')." ".urlGen('delete',$alias_db['id'],$alias_db['alias'])."\n\n";
} }
$nb_alias_total = $nb_alias + $nb_alias_disable; $nb_alias_total = $nb_alias + $nb_alias_disable;
if ($nb_alias_total == 0) { if ($nb_alias_total == 0) {
return false; return false;
} else { } else {
SendEmail($email,'Liste de vos '.$nb_alias_total.' redirection(s) poubelle(s)',$message); SendEmail($email,_('List trash email'),$message);
return true; return true;
} }
} }
@ -340,7 +341,7 @@ function CheckUpdate() {
} }
$file_current_version = trim(file_get_contents(DATA.'/checkupdate')); $file_current_version = trim(file_get_contents(DATA.'/checkupdate'));
if ($file_current_version != '' && $file_current_version != VERSION) { if ($file_current_version != '' && $file_current_version != VERSION) {
return '<p>Upgrade note : Votre version est en '.VERSION.' alors que la version en cours est en '.$file_current_version.'</p>'; return '<p>Upgrade note: Your version is in '.VERSION.' while the current version is in '.$file_current_version.'</p>';
} else { } else {
return false; return false;
} }
@ -392,4 +393,93 @@ function emailIsAlias($postemail) {
} }
return $return; return $return;
} }
function get_ip() {
// IP si internet partagé
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
}
// IP derrière un proxy
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
// Sinon : IP normale
else {
return (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '');
}
}
// Fonction langues :
function languesSwitch() {
echo '<script>
function langSwitch(lang) {
document.getElementById(\'langSwitch\').value = lang;
document.getElementById(\'fromLangueSwitch\').submit();
}
</script>
<div class="eplangswitch" style="float: right">
<form id="fromLangueSwitch" action="#" method="post">
<input type="hidden" name="langSwitch" value="" id="langSwitch" />
<img alt="fr" src="'.URLINC.'/fr.png" onclick="langSwitch(\'fr\');" />
<img alt="en" src="'.URLINC.'/en.png" onclick="langSwitch(\'en\');" />
</form>
</div>';
}
function lang2locale($langue) {
global $langueEtLocalDispo;
if ($langueEtLocalDispo[$langue] != '') {
return $langueEtLocalDispo[$langue];
} else {
// par défaut
return 'en_US';
}
}
function locale2lang($localeRecherche) {
global $langueEtLocalDispo;
foreach($langueEtLocalDispo as $code=>$locale) {
if ($locale == $localeRecherche) {
return $code;
break;
}
}
// par défaut
return 'en';
}
// Ajoute la langue à une URL qui n'en a pas
function addLang2url($lang) {
global $_SERVER;
$URIexplode=explode('?', $_SERVER['REQUEST_URI']);
if ($URIexplode[1] != '') {
return $URIexplode[0].$URIexplode[1].'&langue='.$lang;
} else {
return $URIexplode[0].'?langue='.$lang;
}
}
function replaceLang2url($lang) {
global $_SERVER;
$URIexplode=explode('?', $_SERVER['REQUEST_URI']);
$debutUrl=substr($URIexplode[0], 0, -langCountChar($URIexplode[0]));
if ($URIexplode[1] != '') {
return $debutUrl.$lang.'?'.$URIexplode[1];
} else {
return $debutUrl.$lang;
}
}
function langCountChar($url) {
// $url reçu c'est l'URL avant la query : ?machin=1
if (preg_match('#/sr-Cyrl-ME$#',$url)) {
return 10;
} elseif (preg_match('#/[a-z]{2}-[A-Z]{2}$#',$url)) {
return 5;
} elseif (preg_match('#/[a-z]{3}-[A-Z]{2}$#',$url)) {
return 6;
} elseif (preg_match('#/[a-z]{3}$#',$url)) {
return 3;
} elseif (preg_match('#/[a-z]{2}$#',$url)) {
return 2;
}
}
?> ?>

66
lib/ep_header.php Normal file
View file

@ -0,0 +1,66 @@
<?php
$country = @geoip_country_code_by_name(get_ip());
$HTTP_ACCEPT_LANGUAGE=$_SERVER['HTTP_ACCEPT_LANGUAGE'];
$lang_from_http_accept = explode(',', $HTTP_ACCEPT_LANGUAGE);
$lang = $lang_from_http_accept[0];
// Dans les URL on utilisera les codes langues https://support.crowdin.com/api/language-codes/
// On a une fonction pour retrouve le local à partir (et vis et versa)
// CODE LOCALE (locale -a)
$langueEtLocalDispo=array(
'fr' => 'fr_FR',
'en' => 'en_US',
);
// Détection et redirection (langue toujours)
if (isset($_POST['langSwitch'])) {
$locale = lang2locale($_POST['langSwitch']);
$localeshort=locale2lang($locale);
if ($_COOKIE['langue'] != $localeshort) {
setcookie("langue",$localeshort,strtotime( '+1 year' ));
}
} elseif (isset($_COOKIE['langue'])) {
$locale = lang2locale($_COOKIE['langue']);
$lang=locale2lang($locale);
//header('Location: '.addLang2url($lang));
} else {
$HTTP_ACCEPT_LANGUAGE=$_SERVER['HTTP_ACCEPT_LANGUAGE'];
//echo $HTTP_ACCEPT_LANGUAGE.'<br />';
$lang_from_http_accept = explode(',', $HTTP_ACCEPT_LANGUAGE);
//echo $lang_from_http_accept[0].'<br />';
$locale = lang2locale($lang_from_http_accept[0]);
if (substr($locale,0,2) != substr($lang_from_http_accept[0],0,2)) {
//echo "Non trouvé, 2ème tentative";
$lang_from_http_accept = explode('-', $lang_from_http_accept[0]);
//echo $lang_from_http_accept[0].'<br />';
$locale = lang2locale($lang_from_http_accept[0]);
}
//echo $locale.'<br />';
$lang = locale2lang($locale);
//echo $lang.'<br />';
}
// Définition de la langue :
$results=putenv("LC_ALL=$locale.utf8");
if (!$results) {
exit ('putenv failed');
}
$results=putenv("LC_LANG=$locale.utf8");
if (!$results) {
exit ('putenv failed');
}
$results=putenv("LC_LANGUAGE=$locale.utf8");
if (!$results) {
exit ('putenv failed');
}
$results=setlocale(LC_ALL, "$locale.utf8");
if (!$results) {
exit ('setlocale failed: locale function is not available on this platform, or the given local does not exist in this environment');
}
bindtextdomain("messages", LANG);
textdomain("messages");
?>

BIN
lib/fr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

View file

@ -20,8 +20,8 @@
</header> </header>
<div id="b"> <div id="b">
<article> <article>
<h1>Emails poubelle libre - Interface d'administration</h1> <h1><?= _('Emails trash free') ?> - <?= _('Admin space') ?></h1>
<p>Générer des emails poubelle sans contrainte de durée de vie. </p> <p><?= _('Generate trash emails without lifetime constraint') ?>. </p>
<?php <?php
// Intégration dans votre site : // Intégration dans votre site :
if (file_exists('../conf.php')) { if (file_exists('../conf.php')) {

View file

@ -20,8 +20,8 @@
</header> </header>
<div id="b"> <div id="b">
<article> <article>
<h1>Emails poubelle libre</h1> <h1><?= _('Emails trash free') ?></h1>
<p>Générer des emails poubelle sans contrainte de durée de vie. </p> <p><?= _('Generate trash emails without lifetime constraint') ?>. </p>
<?php <?php
// Intégration dans votre site : // Intégration dans votre site :
if (file_exists('../conf.php')) { if (file_exists('../conf.php')) {