fonctionnel sans mails en https
This commit is contained in:
parent
7e015a3d1b
commit
3c303efeb9
@ -28,6 +28,7 @@
|
|||||||
if (!empty ($erreur))
|
if (!empty ($erreur))
|
||||||
{
|
{
|
||||||
echo json_encode($erreur);
|
echo json_encode($erreur);
|
||||||
|
log_error("erreur lors de l'acquisition des données:" . EOLH . print_r($erreur, true));
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
$db->newPlane();
|
$db->newPlane();
|
||||||
|
130
cron.php
130
cron.php
@ -1,16 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
chdir('/var/www/html/avion-poeme/');
|
//chdir('/var/www/html/avion-poeme/');
|
||||||
require_once '/var/www/html/avion-poeme/session_init.php';
|
require_once 'session_init.php';
|
||||||
require_once 'config.inc.php';
|
require_once 'config.inc.php';
|
||||||
require_once 'db.class.php';
|
require_once 'db.class.php';
|
||||||
require_once 'log.php';
|
require_once 'log.php';
|
||||||
require_once 'envoi_courriel.inc.php';
|
require_once 'envoi_courriel.inc.php';
|
||||||
|
|
||||||
$db = new db();
|
$db = new db();
|
||||||
test();
|
//test();
|
||||||
|
$_SERVER["PHP_AUTH_USER"] = "cron";
|
||||||
//peripetieDatee();
|
//peripetieDatee();
|
||||||
|
print "envoi des courriers en attente" . EOL;
|
||||||
envoiCourrielEnattente();
|
envoiCourrielEnattente();
|
||||||
|
print "envoi des péripéties" . EOL;
|
||||||
peripeties();
|
peripeties();
|
||||||
|
print "Envoi des arrivées" . EOL;
|
||||||
arrivee();
|
arrivee();
|
||||||
|
|
||||||
function peripetieDatee()
|
function peripetieDatee()
|
||||||
@ -44,49 +48,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function peripeties()
|
|
||||||
{
|
|
||||||
global $db, $base_url;
|
|
||||||
//recherche des péripéties non datées
|
|
||||||
$query = "SELECT * FROM avionpoeme WHERE atteri = 0";
|
|
||||||
$db->query($query);
|
|
||||||
$dbPeripetie = new db();
|
|
||||||
$dbPeripetie->open();
|
|
||||||
|
|
||||||
while ( ($result = $db->result->fetch_assoc()) )
|
|
||||||
{
|
|
||||||
$dicoExpe = getLang( $result['expeLang'] );
|
|
||||||
$dicoDest = getLang( $result['destLang'] );
|
|
||||||
$db->urlAvion = $base_url . "/?avionpoeme=" . $result['idAvion'];
|
|
||||||
$query = "SELECT *, UNIX_TIMESTAMP(date) as dateArrivee FROM avionPeripetie LEFT JOIN peripeties USING (idPeripetie) WHERE idAvion='" . $result['idAvion'] . "' AND mailSent=false AND TIMEDIFF(CONCAT_WS(' ',CURDATE(),CURTIME()), date) > '00:00'";
|
|
||||||
$dbPeripetie->query($query);
|
|
||||||
while (($peripetie = $dbPeripetie->result->fetch_assoc()))
|
|
||||||
{
|
|
||||||
$db->datePeripetie = formatteDate($result['expeLang'],$peripetie['dateArrivee'], $result['startTZ']);
|
|
||||||
$indexObjet = "Objet_" . $peripetie['indexText'];
|
|
||||||
$objetMail = replaceVariables($db, $dicoExpe["Objet_" . $peripetie['indexText']], $dicoExpe);
|
|
||||||
$mailText = replaceVariables($db, $dicoExpe[$peripetie['indexText']], $dicoExpe) .EOLH .EOLH ;
|
|
||||||
print $mailText .EOLH;
|
|
||||||
print "envoi courriel au destinataire" .EOLH;
|
|
||||||
$r = true; //envoiMail( $result['destMail'], $objetMail, $mailText, true);
|
|
||||||
//sleep(2);
|
|
||||||
$db->datePeripetie = formatteDate($result['destLang'],$peripetie['dateArrivee'], $result['deliveryTZ']);
|
|
||||||
$objetMail = replaceVariables($db, $dicoDest["Objet_" . $peripetie['indexText']], $dicoDest);
|
|
||||||
$mailText = replaceVariables($db, $dicoDest[$peripetie['indexText']], $dicoDest) .EOLH .EOLH ;
|
|
||||||
print $mailText .EOLH;
|
|
||||||
print "envoi courriel à l'expéditeur" .EOLH;
|
|
||||||
$s = true; //envoiMail( $result['expeMail'], $objetMail, $mailText, true);
|
|
||||||
//sleep(2);
|
|
||||||
if ($r AND $s)
|
|
||||||
{
|
|
||||||
$query = "UPDATE avionPeripetie SET mailSent=true WHERE idAP='" . $peripetie['idAP'] ."'";
|
|
||||||
$db->query($query);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$dbPeripetie->close();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
function peripeties() //recherche des péripéties non datées
|
function peripeties() //recherche des péripéties non datées
|
||||||
{
|
{
|
||||||
global $db, $base_url;
|
global $db, $base_url;
|
||||||
@ -100,15 +61,10 @@
|
|||||||
|
|
||||||
foreach ( $peripeties as $peripetie)
|
foreach ( $peripeties as $peripetie)
|
||||||
{
|
{
|
||||||
|
print "avion poème n° " . $peripetie['idAvion'] .EOL;
|
||||||
$db->getPlane($peripetie['idAvion']);
|
$db->getPlane($peripetie['idAvion']);
|
||||||
$dicoExpe = getLang( $db->expeLang );
|
$dicoExpe = getLang( $db->expeLang );
|
||||||
if ( $db->expeLang == $db->destLang )
|
$dicoDest = getLang( $db->destLang );
|
||||||
{
|
|
||||||
$dicoDest ='';
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
$dicoDest = getLang( $db->destLang );
|
|
||||||
}
|
|
||||||
// TODO calcul de la nouvelle date d'arrivée
|
// TODO calcul de la nouvelle date d'arrivée
|
||||||
$dateExpe = new DateTime("@$db->startTime");
|
$dateExpe = new DateTime("@$db->startTime");
|
||||||
$dateDest = new DateTime("@$db->deliveryTime");
|
$dateDest = new DateTime("@$db->deliveryTime");
|
||||||
@ -116,38 +72,41 @@
|
|||||||
$numericInterval = (($interval->days*24 + $interval->h)*60 + $interval->i)*60 + $interval->s;
|
$numericInterval = (($interval->days*24 + $interval->h)*60 + $interval->i)*60 + $interval->s;
|
||||||
$addDate = $numericInterval * 15/100;
|
$addDate = $numericInterval * 15/100;
|
||||||
$db->deliveryTime += $addDate;
|
$db->deliveryTime += $addDate;
|
||||||
$query = "UPDATE avionpoeme SET deliveryTime=FROM_UNIXTIME(" . $this->deliveryTime . ")";
|
$db->deliveryTimeServer += $addDate;
|
||||||
|
$query = "UPDATE avionpoeme SET deliveryTime=FROM_UNIXTIME(" . $db->deliveryTime . "), deliveryTimeServer=FROM_UNIXTIME(" . $db->deliveryTimeServer . ") WHERE idAvion='" . $peripetie['idAvion'] . "'" ;
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
$db->urlAvion = $base_url . "/?avionpoeme=" . $db->uid;
|
$db->urlAvion = $base_url . "/?avionpoeme=" . $db->uid;
|
||||||
$db->datePeripetie = formatteDate($db->expeLang, $db->deliveryTime, $db->startTZ);
|
$db->datePeripetie = formatteDate($db->expeLang, $db->deliveryTime, $db->startTZ);
|
||||||
$indexObjet = "Objet_" . $peripetie['indexText'];
|
$indexObjet = "Objet_" . $peripetie['indexText'];
|
||||||
$objetMail = replaceVariables($db, $dicoExpe["Objet_" . $peripetie['indexText']], $dicoExpe);
|
$result = replaceVariables($db, $dicoExpe["Objet_" . $peripetie['indexText']], $dicoExpe);
|
||||||
$mailText = replaceVariables($db, $dicoExpe[$peripetie['indexText']], $dicoExpe) .EOLH .EOLH ;
|
$objetMail = $result["text"];
|
||||||
print $mailText .EOLH;
|
$result = replaceVariables($db, $dicoExpe[$peripetie['indexText']], $dicoExpe);
|
||||||
|
$mailText = $result["text"];
|
||||||
|
//$html = $result['html'];
|
||||||
sleep(1);
|
sleep(1);
|
||||||
if (empty($dicoDest))
|
print "envoi courriel à l'expéditeur" .EOL;
|
||||||
{
|
$r = envoiMail( $db->expeMail, $objetMail, $mailText);
|
||||||
print "envoi courriel à l'expéditeur et au destinataire en BCC" .EOLH;
|
$db->datePeripetie = formatteDate($db->destLang, $db->deliveryTime, $db->deliveryTZ);
|
||||||
$r = envoiMail( $db->expeMail, $objetMail, $mailText, false, '', $db->destMail );
|
$result = replaceVariables($db, $dicoDest["Objet_" . $peripetie['indexText']], $dicoDest);
|
||||||
$s = $r; //pour l'update de la BD
|
$objetMail = $result["text"];
|
||||||
}else
|
$result = replaceVariables($db, $dicoDest[$peripetie['indexText']], $dicoDest);
|
||||||
{
|
$mailText = $result["text"] .EOLH .EOLH;
|
||||||
print "envoi courriel à l'expéditeur" .EOLH;
|
print "envoi courriel au destinataire" .EOL;
|
||||||
$r = envoiMail( $db->expeMail, $objetMail, $mailText, false);
|
$s = envoiMail( $db->destMail, $objetMail, $mailText);
|
||||||
|
sleep(1);
|
||||||
|
//print "r=" . $r ." => s=" .$s .EOLH;
|
||||||
|
|
||||||
$db->datePeripetie = formatteDate($db->destLang, $db->deliveryTime, $db->deliveryTZ);
|
|
||||||
$objetMail = replaceVariables($db, $dicoDest["Objet_" . $peripetie['indexText']], $dicoDest);
|
|
||||||
$mailText = replaceVariables($db, $dicoDest[$peripetie['indexText']], $dicoDest) .EOLH .EOLH ;
|
|
||||||
print "envoi courriel au destinataire" .EOLH;
|
|
||||||
$s = envoiMail( $db->destMail, $objetMail, $mailText, false);
|
|
||||||
sleep(1);
|
|
||||||
//print "r=" . $r ." => s=" .$s .EOLH;
|
|
||||||
}
|
|
||||||
if ($r AND $s)
|
if ($r AND $s)
|
||||||
{
|
{
|
||||||
$query = "UPDATE avionPeripetie SET mailSent=true WHERE idAP='" . $peripetie['idAP'] ."'";
|
$query = "UPDATE avionPeripetie SET mailSent=true WHERE idAP='" . $peripetie['idAP'] ."'";
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
print "table avion péripétie non mise à jour" .EOL;
|
||||||
|
print "UPDATE avionPeripetie SET mailSent=true WHERE idAP='" . $peripetie['idAP'] ."'" .EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,26 +115,35 @@
|
|||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
//recherche des avions atteris
|
//recherche des avions atteris
|
||||||
$query = "SELECT * FROM avionpoeme WHERE atteri = 0 AND TIMEDIFF(CONCAT_WS(' ',CURDATE(),CURTIME()),deliveryTime) > '00:00'";
|
$query = "SELECT * FROM avionpoeme WHERE atteri = 0 AND TIMEDIFF(CONCAT_WS(' ',CURDATE(),CURTIME()),deliveryTimeServer) > '00:00'";
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
$avionArrive = $db->result->fetch_all(MYSQLI_ASSOC);
|
$avionArrive = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||||
foreach ($avionArrive as $avion)
|
foreach ($avionArrive as $avion)
|
||||||
{
|
{
|
||||||
|
print "avion poème n° " . $avion['idAvion'] . EOLH;
|
||||||
$dicoExpe = getLang( $avion['expeLang'] );
|
$dicoExpe = getLang( $avion['expeLang'] );
|
||||||
$dicoDest = getLang( $avion['destLang'] );
|
$dicoDest = getLang( $avion['destLang'] );
|
||||||
$index = "Notification_Arrivee_Expediteur";
|
$index = "Notification_Arrivee_Expediteur";
|
||||||
$indexObjet = "Objet_";
|
$indexObjet = "Objet_";
|
||||||
$objetMail = replaceVariables($db, $dicoExpe[$indexObjet . $index], $dicoExpe);
|
$objetMail = replaceVariables($db, $dicoExpe[$indexObjet . $index], $dicoExpe);
|
||||||
$mailText = replaceVariables($db, $dicoExpe[$index], $dicoExpe) . EOL . EOL ;
|
$result = replaceVariables($db, $dicoExpe[$index], $dicoExpe);
|
||||||
print $mailText . EOLH;
|
$mailText= $result["text"];
|
||||||
print "envoi courriel à l'expéditeur" . EOLH;
|
print "envoi courriel à l'expéditeur". EOLH;
|
||||||
$r = envoiMail( $avion['destMail'], $objetMail, $mailText);//
|
$r = envoiMail( $avion['expeMail'], $objetMail["text"], $mailText);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$index = "Notification_Arrivee_Destinataire";
|
$index = "Notification_Arrivee_Destinataire";
|
||||||
|
|
||||||
$objetMail = replaceVariables($db, $dicoDest[$indexObjet . $index], $dicoDest);
|
$objetMail = replaceVariables($db, $dicoDest[$indexObjet . $index], $dicoDest);
|
||||||
$mailText = replaceVariables($db, $dicoDest[$index], $dicoDest) .EOLH .EOLH ;
|
$result = replaceVariables($db, $dicoDest[$index], $dicoDest);
|
||||||
|
log_write(__FILE__ . EOL . __LINE__ . EOL . "#" .print_r($result, true) . "#", INFO);
|
||||||
|
$mailText = $result["text"];
|
||||||
|
$html = $result['html'];
|
||||||
|
if ( $html )
|
||||||
|
{
|
||||||
|
$mailText = "<html><head></head>\n<body>" . $mailText . "</body></html>";
|
||||||
|
}
|
||||||
print "envoi courriel au destinataire" . EOLH;
|
print "envoi courriel au destinataire" . EOLH;
|
||||||
$s = envoiMail( $avion['expeMail'], $objetMail, $mailText);
|
$s = envoiMail( $avion['destMail'], $objetMail["text"], $mailText, $html);
|
||||||
if ($r AND $s)
|
if ($r AND $s)
|
||||||
{
|
{
|
||||||
$query = "UPDATE avionpoeme SET atteri=true WHERE idAvion='" . $avion['idAvion'] ."'";
|
$query = "UPDATE avionpoeme SET atteri=true WHERE idAvion='" . $avion['idAvion'] ."'";
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
require_once '../session_init.php';
|
require_once '../session_init.php';
|
||||||
require_once 'config.inc.php';
|
require_once 'config.inc.php';
|
||||||
|
require_once 'fonctions.inc.php';
|
||||||
|
|
||||||
if ( isset($_GET["ok"] ))
|
if ( isset($_GET["ok"] ))
|
||||||
{
|
{
|
||||||
@ -91,15 +92,20 @@
|
|||||||
fwrite($fhx, '}');
|
fwrite($fhx, '}');
|
||||||
fclose($fhx);
|
fclose($fhx);
|
||||||
}
|
}
|
||||||
$fh = fopen("lang/lang.json","r");
|
$fh = fopen("../lang/lang.json","r");
|
||||||
$str = fgets($fh);
|
$str = fgets($fh);
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
$lang = json_decode( $str, true);
|
$lang = json_decode( $str, true);
|
||||||
foreach ($lang as $key => $value)
|
foreach ($lang as $key => $value)
|
||||||
{
|
{
|
||||||
getLang( $key );
|
print $key ." : ";
|
||||||
print $key;
|
if ( getLang($key, true) !== false )
|
||||||
print json_last_error_msg() .EOL;
|
{
|
||||||
|
print json_last_error_msg() . EOLH;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
print "erreur à l'ouverture du fichier";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -20,9 +20,12 @@ $site = "Avion Poème";
|
|||||||
$dossier = "/www";
|
$dossier = "/www";
|
||||||
$basedir = dirname( $_SERVER['DOCUMENT_ROOT'] ) . $dossier;
|
$basedir = dirname( $_SERVER['DOCUMENT_ROOT'] ) . $dossier;
|
||||||
|
|
||||||
$base_url = "http://avion-poe.me";
|
$base_url = "https://avion-poe.me";
|
||||||
$base_path = "/flex/storage/avion-poe.me/site/www/";
|
$base_path = "/flex/storage/avion-poe.me/site/www/";
|
||||||
$url_admin = $base_url . "/gestion";
|
$url_admin = $base_url . "/gestion";
|
||||||
$accueil = $base_url . "/index.html";
|
$accueil = $base_url . "/index.html";
|
||||||
|
if (empty( $_SERVER["PHP_AUTH_USER"]))
|
||||||
|
{
|
||||||
|
$_SERVER["PHP_AUTH_USER"] = 'script';
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -91,7 +91,7 @@ class db
|
|||||||
|
|
||||||
$this->result = $this->connect->query( $string ) ;
|
$this->result = $this->connect->query( $string ) ;
|
||||||
|
|
||||||
if ( $this->connect->error ) log_error( "Échec de la commande query => " . $this->connect->error . "<br />" . __file__ . ' ligne ' . __line__ . "\n" . $string, true, true);
|
if ( $this->connect->error ) log_error( "Échec de la commande query => " . $this->connect->error . "<br />" . __file__ . ' ligne ' . __line__ . "\n" . $string, true, false);
|
||||||
//print_r( $this );
|
//print_r( $this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,15 +120,15 @@ class db
|
|||||||
$query .= "FROM_UNIXTIME(" . $this->protect($this->deliveryTimeServer) . "), '";
|
$query .= "FROM_UNIXTIME(" . $this->protect($this->deliveryTimeServer) . "), '";
|
||||||
$query .= $this->protect($this->deliveryMethod) . "','";
|
$query .= $this->protect($this->deliveryMethod) . "','";
|
||||||
$query .= "0')";
|
$query .= "0')";
|
||||||
//print_r($this);
|
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$this->uid = $this->connect->insert_id;
|
$this->uid = $this->connect->insert_id;
|
||||||
echo "{'uid':'" . $this->uid . "'}";
|
echo "{'uid':'" . $this->uid . "'}";
|
||||||
$this->startTimeRFC822 = formatteDate( $this->expeLang, $this->startTime, $this->startTZ);
|
$this->startTimeRFC822 = formatteDate( $this->expeLang, $this->startTime, $this->startTZ);
|
||||||
$this->deliveryTimeRFC822 = formatteDate( $this->destLang, $this->deliveryTime, $this->deliveryTZ );
|
$this->deliveryTimeRFC822 = formatteDate( $this->destLang, $this->deliveryTime, $this->deliveryTZ );
|
||||||
$this->urlAvion = $base_url . "/?avionpoeme=" . $this->uid;
|
$this->urlAvion = $base_url . "/?avionpoeme=" . $this->uid;
|
||||||
courrielEnvoi($this);
|
|
||||||
$this->newPeripetie();
|
$this->newPeripetie();
|
||||||
|
courrielEnvoi($this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlane($uid)
|
function getPlane($uid)
|
||||||
|
@ -12,8 +12,17 @@ function courrielEnvoi( $db )
|
|||||||
|
|
||||||
// Message à l'expéditeur
|
// Message à l'expéditeur
|
||||||
$indexObjet = "Objet_" . $expediteurIndex;
|
$indexObjet = "Objet_" . $expediteurIndex;
|
||||||
$objetMail = replaceVariables($db, $dicoExpe[$indexObjet], $dicoExpe);
|
$result = replaceVariables($db, $dicoExpe[$indexObjet], $dicoExpe);
|
||||||
$mailText = replaceVariables($db, $dicoExpe[$expediteurIndex], $dicoExpe) .EOL .EOL ;
|
log_write("indexObjet" .EOLH . print_r($result, true));
|
||||||
|
$objetMail = $result['text'];
|
||||||
|
$result = replaceVariables($db, $dicoExpe[$expediteurIndex], $dicoExpe) ;
|
||||||
|
log_write("indexObjet" .EOLH . print_r($result, true));
|
||||||
|
$mailText = $result['text'];
|
||||||
|
$html = $result['html'];
|
||||||
|
if ( $html )
|
||||||
|
{
|
||||||
|
$mailText = "<html><head></head>\n<body>" . $mailText . "</body></html>";
|
||||||
|
}
|
||||||
if ( $db->expeKnown == false )
|
if ( $db->expeKnown == false )
|
||||||
{
|
{
|
||||||
$destinataireIndex = "Notification_denvoi_Destinataire_ExpediteurConnu";
|
$destinataireIndex = "Notification_denvoi_Destinataire_ExpediteurConnu";
|
||||||
@ -21,18 +30,25 @@ function courrielEnvoi( $db )
|
|||||||
{
|
{
|
||||||
$destinataireIndex = "Notification_denvoi_Destinataire_ExpediteurAnonyme";
|
$destinataireIndex = "Notification_denvoi_Destinataire_ExpediteurAnonyme";
|
||||||
}
|
}
|
||||||
|
saveMail( $db, $db->expeMail, $objetMail, $mailText, $html);
|
||||||
saveMail( $db, $db->expeMail, $objetMail, $mailText);
|
|
||||||
|
|
||||||
// message au destinataire
|
// message au destinataire
|
||||||
$indexObjet = "Objet_" . $destinataireIndex;
|
$indexObjet = "Objet_" . $destinataireIndex;
|
||||||
$objetMail = replaceVariables($db, $dicoExpe[$indexObjet], $dicoDest);
|
$result = replaceVariables($db, $dicoDest[$indexObjet], $dicoDest);
|
||||||
$mailText = replaceVariables($db, $dicoDest[$destinataireIndex], $dicoDest) .EOL .EOL ;
|
log_write("indexObjet" .EOLH . print_r($result, true));
|
||||||
|
$objetMail = $result['text'];
|
||||||
saveMail( $db, $db->destMail, $objetMail, $mailText);
|
$result = replaceVariables($db, $dicoDest[$destinataireIndex], $dicoDest);
|
||||||
|
log_write("indexObjet" .EOLH . print_r($result, true));
|
||||||
|
$mailText = $result['text'];
|
||||||
|
$html = $result['html'];
|
||||||
|
if ( $html )
|
||||||
|
{
|
||||||
|
$message = "<html><head></head>\n<body>" . $message . "</body></html>";
|
||||||
|
}
|
||||||
|
saveMail( $db, $db->destMail, $objetMail, $mailText, $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveMail( $db, $destinataire, $objet, $text, $html=FALSE)
|
function saveMail( $db, $destinataire, $objet, $text, $html=false)
|
||||||
{
|
{
|
||||||
$query = "INSERT INTO courriels VALUES ('0', '" . $db->protect($destinataire) . "', '" . $db->protect($objet) . "', '" . $db->protect($text) . "', '" . (int)$html . "')";
|
$query = "INSERT INTO courriels VALUES ('0', '" . $db->protect($destinataire) . "', '" . $db->protect($objet) . "', '" . $db->protect($text) . "', '" . (int)$html . "')";
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
@ -44,20 +60,22 @@ function envoiMail($destinataire, $sujet, $text, $html=false, $cc='', $bcc='')
|
|||||||
if ( !empty($cc)) $headers .= "Cc: " . $cc . LF;
|
if ( !empty($cc)) $headers .= "Cc: " . $cc . LF;
|
||||||
if ( !empty($bcc)) $headers .= "Bcc: " . $bcc . LF;
|
if ( !empty($bcc)) $headers .= "Bcc: " . $bcc . LF;
|
||||||
|
|
||||||
if (empty($html))
|
if ($html)
|
||||||
{
|
|
||||||
$headers .= "Content-type: text/plain; charset=UTF-8" . LF;
|
|
||||||
}else
|
|
||||||
{
|
{
|
||||||
$headers .= "Content-type: text/html; charset=UTF-8" . LF;
|
$headers .= "Content-type: text/html; charset=UTF-8" . LF;
|
||||||
nl2br($text);
|
nl2br($text);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$headers .= "Content-type: text/plain; charset=UTF-8" . LF;
|
||||||
|
$text = str_replace("\n","\r\n", $text);
|
||||||
}
|
}
|
||||||
$headers .= "DATE: " . date( 'r' ) . LF . LF;
|
$headers .= "DATE: " . date( 'r' ) . LF . LF;
|
||||||
|
$destinataire = "dtux@free.fr";
|
||||||
log_write(__FILE__ . __LINE__ . " Envoi d'un courriel à " . $destinataire . "sujet:" . $sujet, INFO);
|
log_write(__FILE__ . __LINE__ . " Envoi d'un courriel à " . $destinataire . "sujet:" . $sujet, INFO);
|
||||||
if( !mail($destinataire, $sujet, wordwrap($text, 70 , "\r\n"), $headers) ) //Sending mail
|
if( !mail($destinataire, $sujet, wordwrap($text, 1000 , "\r\n"), $headers) ) //Sending mail
|
||||||
{
|
{
|
||||||
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" .$destinataire . EOL . $sujet, ERROR);
|
$error = error_get_last();
|
||||||
|
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" .$destinataire . EOL . $sujet . EOL . print_r($error, true) . EOL . wordwrap($text, 1000 , "\r\n"), ERROR);
|
||||||
return false;
|
return false;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
|
@ -25,56 +25,76 @@ function getpost( $var )
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MET LA PREMIÈRE LETTRE D'UN MOT EN MAJUSCULE ( utf8 compliant )
|
// MET LA PREMIÈRE LETTRE D'UN MOT EN MAJUSCULE ( utf8 compliant )
|
||||||
|
|
||||||
function mb_ucfirst($str) {
|
function mb_ucfirst($str)
|
||||||
$char = mb_substr($str,0,1,"UTF8");
|
{
|
||||||
$str = mb_substr( $str, 1, NULL, "UTF8");
|
$char = mb_substr($str,0,1,"UTF8");
|
||||||
$char = mb_strtoupper( $char, "UTF8");
|
$str = mb_substr( $str, 1, NULL, "UTF8");
|
||||||
|
$char = mb_strtoupper( $char, "UTF8");
|
||||||
return $char . $str;
|
return $char . $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLang( $lang )
|
function getLang( $lang, $gestion=false )
|
||||||
|
{
|
||||||
|
$dico = array();
|
||||||
|
if ( empty($lang) )
|
||||||
{
|
{
|
||||||
$dico = array();
|
$lang="en";
|
||||||
if ( empty($lang) )
|
|
||||||
{
|
|
||||||
$lang="en";
|
|
||||||
}
|
|
||||||
if (($fh = fopen('lang/'.$lang, 'r') ))
|
|
||||||
{
|
|
||||||
$str = fgets($fh);
|
|
||||||
fclose($fh);
|
|
||||||
$dico = json_decode($str, true);
|
|
||||||
return $dico;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$langPath ='lang/'.$lang;
|
||||||
|
if ($gestion)
|
||||||
|
$langPath = "../" . $langPath;
|
||||||
|
if (($fh = fopen($langPath, 'r') ))
|
||||||
|
{
|
||||||
|
$str = fgets($fh);
|
||||||
|
fclose($fh);
|
||||||
|
$dico = json_decode($str, true);
|
||||||
|
return $dico;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function formatteDate($locale, $date, $tz)
|
function formatteDate($locale, $date, $tz)
|
||||||
{
|
{
|
||||||
$formatter = new IntlDateFormatter($locale, IntlDateFormatter::FULL, IntlDateFormatter::FULL, $tz, IntlDateFormatter::GREGORIAN );
|
$formatter = new IntlDateFormatter($locale, IntlDateFormatter::FULL, IntlDateFormatter::FULL, $tz, IntlDateFormatter::GREGORIAN );
|
||||||
if ($formatter == null)
|
if ($formatter == null)
|
||||||
{
|
{
|
||||||
log_write(InvalidConfigException(intl_get_error_message()));
|
log_write(__FILE__ . EOLH . __LINE__ . EOLH . "Formatter error : locale = " . $locale . "tz = " . $tz . "Formatter = " . print_r($formatter, true) . InvalidConfigException(intl_get_error_message()),ERROR);
|
||||||
}
|
}
|
||||||
return $formatter->format($date);
|
return $formatter->format($date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceVariables($db, $text, $dico)
|
/* Remplace les variables dans les textes
|
||||||
|
|
||||||
|
*/
|
||||||
|
function replaceVariables($db, $text, $dico) :array
|
||||||
{
|
{
|
||||||
$variables = array( 'expediteur' => 'expeMail', 'destinataire' => 'destMail', 'date_depart' => 'startTimeRFC822', 'date_arrivee' => 'deliveryTimeRFC822', 'new_date_arrivee' => 'datePeripetie', 'message' => 'message', 'url_avion' => 'url_avion', 'onglet_apropos' => 'onglet_apropos', 'NB_avion_poeme' => 'avionJournalier', "url_avion" => "urlAvion");
|
$variables = array( 'expediteur' => 'expeMail', 'destinataire' => 'destMail', 'date_depart' => 'startTimeRFC822', 'date_arrivee' => 'deliveryTimeRFC822', 'new_date_arrivee' => 'datePeripetie', 'message' => 'message', 'onglet_apropos' => 'onglet_apropos', 'NB_avion_poeme' => 'avionJournalier', "url_avion" => "urlAvion");
|
||||||
$posVar = 0 ;
|
$posVar = 0 ;
|
||||||
$x =0;
|
$x =0;
|
||||||
|
$result = array();
|
||||||
|
// si contient la variable '$message' alors le text est en html
|
||||||
|
if (strpos($text, '$message') === false)
|
||||||
|
{
|
||||||
|
$html = false;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$html = true;
|
||||||
|
}
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
|
// Recherche les variables dans le texte
|
||||||
$posVar = strpos( $text, "$", $posVar);
|
$posVar = strpos( $text, "$", $posVar);
|
||||||
if ($posVar !== false)
|
if ($posVar !== false)
|
||||||
{
|
{
|
||||||
if ($x++ >10 ) break;
|
// une variable a été trouvée
|
||||||
|
if ($x++ >10 ) break; // empêche une boucle sans fin, il n'y a pas plus de 10 variables par texte
|
||||||
$posEsp = strpos( $text, " ", $posVar);
|
$posEsp = strpos( $text, " ", $posVar);
|
||||||
if ($posEsp === false)
|
if ($posEsp === false)
|
||||||
{
|
{
|
||||||
@ -83,23 +103,33 @@ function replaceVariables($db, $text, $dico)
|
|||||||
{
|
{
|
||||||
$var = substr($text, $posVar+1, $posEsp-$posVar-1);
|
$var = substr($text, $posVar+1, $posEsp-$posVar-1);
|
||||||
}
|
}
|
||||||
$var = trim($var, " .\n\r");
|
|
||||||
$posVar = $posEsp+1;
|
$posVar = $posEsp+1;
|
||||||
$varReplace = "$" . $var;
|
$var = trim($var, " .\n\r");
|
||||||
|
|
||||||
|
$varReplace = "$" . $var;
|
||||||
if ( isset ($variables[$var]) )
|
if ( isset ($variables[$var]) )
|
||||||
{
|
{
|
||||||
$dbVar = $variables[$var];
|
$dbVar = $variables[$var];
|
||||||
$text = str_replace($varReplace, $db->$dbVar, $text);
|
$varText = $db->$dbVar;
|
||||||
|
//$text = str_replace($varReplace, $db->$dbVar, $text);
|
||||||
}elseif ( isset ($dico[$var]) )
|
}elseif ( isset ($dico[$var]) )
|
||||||
{
|
{
|
||||||
$text = str_replace($varReplace, $dico[$var], $text);
|
$varText = $dico[$var];
|
||||||
|
//$text = str_replace($varReplace, $dico[$var], $text);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
log_error( "La variable => " . $var . "n'est pas reconnue<br />" . __file__ . ' ligne ' . __line__ . "\n" , true, false);
|
log_error( "La variable => " . $var . "n'est pas reconnue<br />" . __file__ . ' ligne ' . __line__ . "\n" , true, false);
|
||||||
}
|
}
|
||||||
|
if ($html and (strpos($var, "url") !== false))
|
||||||
|
{
|
||||||
|
$varText = '<a href="' . $varText .'">' . $varText . "</a>";
|
||||||
|
}
|
||||||
|
$text = str_replace($varReplace, $varText, $text);
|
||||||
}else {
|
}else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $text;
|
$result['html'] = $html;
|
||||||
|
$result['text'] = $text;
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ function affich_log( $nl, $np = 1, $level=0)
|
|||||||
$query .= " WHERE niveau='" . $level . "'";
|
$query .= " WHERE niveau='" . $level . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$query .= ' ORDER BY date DESC LIMIT ' . ( ( ( $np - 1 ) * $nl ) ) . ',' . $nl;
|
$query .= ' ORDER BY id_log DESC LIMIT ' . ( ( ( $np - 1 ) * $nl ) ) . ',' . $nl;
|
||||||
$db->query( $query );
|
$db->query( $query );
|
||||||
echo "<table border='1' width='90%'><tr><td><b>date</b></td><td><b>auteur</b></td><td><b>log</b></td><td><b>niveau</b></td></tr>\n";
|
echo "<table border='1' width='90%'><tr><td><b>date</b></td><td><b>auteur</b></td><td><b>log</b></td><td><b>niveau</b></td></tr>\n";
|
||||||
while ( ($donnees =$db->result->fetch_array()) )
|
while ( ($donnees =$db->result->fetch_array()) )
|
||||||
|
204
sql/db351634_avionpoeme.sql
Normal file
204
sql/db351634_avionpoeme.sql
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
-- phpMyAdmin SQL Dump
|
||||||
|
-- version 4.9.5
|
||||||
|
-- https://www.phpmyadmin.net/
|
||||||
|
--
|
||||||
|
-- Hôte : db120904.sql-pro.online.net
|
||||||
|
-- Généré le : ven. 23 avr. 2021 à 10:40
|
||||||
|
-- Version du serveur : 5.7.19-0ubuntu0.16.04.1
|
||||||
|
-- Version de PHP : 7.0.32-0ubuntu0.16.04.1
|
||||||
|
|
||||||
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
|
SET AUTOCOMMIT = 0;
|
||||||
|
START TRANSACTION;
|
||||||
|
SET time_zone = "+00:00";
|
||||||
|
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Base de données : `db351634_avionpoeme`
|
||||||
|
--
|
||||||
|
CREATE DATABASE IF NOT EXISTS `db351634_avionpoeme` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||||
|
USE `db351634_avionpoeme`;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `avionPeripetie`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `avionPeripetie` (
|
||||||
|
`idAP` int(10) UNSIGNED NOT NULL,
|
||||||
|
`idAvion` int(10) UNSIGNED NOT NULL,
|
||||||
|
`idPeripetie` int(10) UNSIGNED NOT NULL,
|
||||||
|
`date` datetime NOT NULL,
|
||||||
|
`mailSent` tinyint(1) NOT NULL DEFAULT '0'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Stock les péripeties de chaque avion';
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `avionpoeme`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `avionpoeme` (
|
||||||
|
`idAvion` int(10) UNSIGNED NOT NULL,
|
||||||
|
`message` text CHARACTER SET utf8mb4 NOT NULL,
|
||||||
|
`expeMail` text NOT NULL,
|
||||||
|
`expeKnown` tinyint(1) NOT NULL DEFAULT '0' COMMENT ' true/false en fonction de si l''utilisateur choisi de devoiler son addresse mail pour la premiere',
|
||||||
|
`expeLang` varchar(3) NOT NULL DEFAULT 'fr' COMMENT ' langue de l''envoyeur format 2 lettres (''en'',''fr'',''ar'')',
|
||||||
|
`destLang` varchar(3) NOT NULL COMMENT 'langue du destinataire format 2 lettres (''en'',''fr'',''ar'')',
|
||||||
|
`startLat` float NOT NULL,
|
||||||
|
`startLon` float NOT NULL,
|
||||||
|
`startName` text NOT NULL,
|
||||||
|
`startTime` timestamp NOT NULL COMMENT 'unix time en TZ du depart',
|
||||||
|
`startTZ` text CHARACTER SET utf8mb4 NOT NULL,
|
||||||
|
`destMail` text NOT NULL,
|
||||||
|
`destLat` float NOT NULL,
|
||||||
|
`destLon` float NOT NULL,
|
||||||
|
`destName` text NOT NULL,
|
||||||
|
`public` tinyint(1) NOT NULL COMMENT '0 = privé 1=public, 2=supprimé',
|
||||||
|
`color` varchar(9) NOT NULL COMMENT ' le code hexa de la couleur de l''avion aleatoire parmis la liste.',
|
||||||
|
`deliveryTime` timestamp NOT NULL,
|
||||||
|
`deliveryTZ` text NOT NULL,
|
||||||
|
`deliveryTimeServer` timestamp NOT NULL,
|
||||||
|
`deliveryMethod` text CHARACTER SET utf8mb4 NOT NULL,
|
||||||
|
`atteri` tinyint(1) NOT NULL DEFAULT '0'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `courriels`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `courriels` (
|
||||||
|
`id` int(10) UNSIGNED NOT NULL,
|
||||||
|
`destinataire` text NOT NULL,
|
||||||
|
`objet` text NOT NULL,
|
||||||
|
`message` text NOT NULL,
|
||||||
|
`html` tinyint(1) NOT NULL COMMENT 'false = text, true = html'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='stockage des courriels en attente d''envoie';
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `logs`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `logs` (
|
||||||
|
`id_log` int(11) NOT NULL,
|
||||||
|
`date` datetime NOT NULL,
|
||||||
|
`auteur` varchar(10) NOT NULL,
|
||||||
|
`log` text NOT NULL,
|
||||||
|
`niveau` tinyint(4) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `peripeties`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `peripeties` (
|
||||||
|
`idPeripetie` int(11) NOT NULL,
|
||||||
|
`indexText` text NOT NULL COMMENT 'Contient l''index pour la traduction',
|
||||||
|
`probabilite` decimal(5,1) UNSIGNED NOT NULL COMMENT 'en pourcentage',
|
||||||
|
`effet` tinyint(11) NOT NULL COMMENT '-x => diminue la vitesse de l''avion de x, +x augmente la vitesse de l''avion de x, 0 => avion détruit',
|
||||||
|
`quand` date DEFAULT NULL,
|
||||||
|
`quand_fonction` text
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Déchargement des données de la table `peripeties`
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `peripeties` (`idPeripetie`, `indexText`, `probabilite`, `effet`, `quand`, `quand_fonction`) VALUES
|
||||||
|
(1, 'Peripetie_Perturbation', '20.0', 15, NULL, NULL),
|
||||||
|
(2, 'Peripetie_Vents_porteurs', '20.0', -15, NULL, NULL),
|
||||||
|
(3, 'Peripetie_Collision_Oiseau', '0.5', 0, NULL, NULL),
|
||||||
|
(4, 'Peripetie_OVNI', '0.5', 0, NULL, NULL),
|
||||||
|
(5, 'Peripetie_Drone', '0.5', 0, NULL, NULL),
|
||||||
|
(6, 'Peripetie_LogicielLibre', '100.0', 0, '2021-04-05', NULL),
|
||||||
|
(7, 'Peripetie_Poesie', '100.0', 0, '2022-03-21', NULL);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour les tables déchargées
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `avionPeripetie`
|
||||||
|
--
|
||||||
|
ALTER TABLE `avionPeripetie`
|
||||||
|
ADD PRIMARY KEY (`idAP`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `avionpoeme`
|
||||||
|
--
|
||||||
|
ALTER TABLE `avionpoeme`
|
||||||
|
ADD PRIMARY KEY (`idAvion`),
|
||||||
|
ADD UNIQUE KEY `status_index` (`idAvion`),
|
||||||
|
ADD KEY `expe_mail_index` (`expeMail`(40)),
|
||||||
|
ADD KEY `dest_mail_index` (`destMail`(40)),
|
||||||
|
ADD KEY `delivery_date_index` (`deliveryTime`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `courriels`
|
||||||
|
--
|
||||||
|
ALTER TABLE `courriels`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `logs`
|
||||||
|
--
|
||||||
|
ALTER TABLE `logs`
|
||||||
|
ADD PRIMARY KEY (`id_log`),
|
||||||
|
ADD KEY `date_index` (`date`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `peripeties`
|
||||||
|
--
|
||||||
|
ALTER TABLE `peripeties`
|
||||||
|
ADD PRIMARY KEY (`idPeripetie`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour les tables déchargées
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `avionPeripetie`
|
||||||
|
--
|
||||||
|
ALTER TABLE `avionPeripetie`
|
||||||
|
MODIFY `idAP` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `avionpoeme`
|
||||||
|
--
|
||||||
|
ALTER TABLE `avionpoeme`
|
||||||
|
MODIFY `idAvion` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `courriels`
|
||||||
|
--
|
||||||
|
ALTER TABLE `courriels`
|
||||||
|
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `logs`
|
||||||
|
--
|
||||||
|
ALTER TABLE `logs`
|
||||||
|
MODIFY `id_log` int(11) NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `peripeties`
|
||||||
|
--
|
||||||
|
ALTER TABLE `peripeties`
|
||||||
|
MODIFY `idPeripetie` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
25
sql/db351634_avionpoeme_database.sql
Normal file
25
sql/db351634_avionpoeme_database.sql
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
-- phpMyAdmin SQL Dump
|
||||||
|
-- version 4.9.5
|
||||||
|
-- https://www.phpmyadmin.net/
|
||||||
|
--
|
||||||
|
-- Hôte : db120904.sql-pro.online.net
|
||||||
|
-- Généré le : ven. 23 avr. 2021 à 10:41
|
||||||
|
-- Version du serveur : 5.7.19-0ubuntu0.16.04.1
|
||||||
|
-- Version de PHP : 7.0.32-0ubuntu0.16.04.1
|
||||||
|
|
||||||
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
|
SET AUTOCOMMIT = 0;
|
||||||
|
START TRANSACTION;
|
||||||
|
SET time_zone = "+00:00";
|
||||||
|
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Base de données : `db351634_avionpoeme`
|
||||||
|
--
|
||||||
|
CREATE DATABASE IF NOT EXISTS `db351634_avionpoeme` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||||
|
USE `db351634_avionpoeme`;
|
73
sql/db351634_avionpoeme_metadata.sql
Normal file
73
sql/db351634_avionpoeme_metadata.sql
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour les tables déchargées
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `avionPeripetie`
|
||||||
|
--
|
||||||
|
ALTER TABLE `avionPeripetie`
|
||||||
|
ADD PRIMARY KEY (`idAP`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `avionpoeme`
|
||||||
|
--
|
||||||
|
ALTER TABLE `avionpoeme`
|
||||||
|
ADD PRIMARY KEY (`idAvion`),
|
||||||
|
ADD UNIQUE KEY `status_index` (`idAvion`),
|
||||||
|
ADD KEY `expe_mail_index` (`expeMail`(40)),
|
||||||
|
ADD KEY `dest_mail_index` (`destMail`(40)),
|
||||||
|
ADD KEY `delivery_date_index` (`deliveryTime`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `courriels`
|
||||||
|
--
|
||||||
|
ALTER TABLE `courriels`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `logs`
|
||||||
|
--
|
||||||
|
ALTER TABLE `logs`
|
||||||
|
ADD PRIMARY KEY (`id_log`),
|
||||||
|
ADD KEY `date_index` (`date`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Index pour la table `peripeties`
|
||||||
|
--
|
||||||
|
ALTER TABLE `peripeties`
|
||||||
|
ADD PRIMARY KEY (`idPeripetie`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour les tables déchargées
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `avionPeripetie`
|
||||||
|
--
|
||||||
|
ALTER TABLE `avionPeripetie`
|
||||||
|
MODIFY `idAP` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `avionpoeme`
|
||||||
|
--
|
||||||
|
ALTER TABLE `avionpoeme`
|
||||||
|
MODIFY `idAvion` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `courriels`
|
||||||
|
--
|
||||||
|
ALTER TABLE `courriels`
|
||||||
|
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `logs`
|
||||||
|
--
|
||||||
|
ALTER TABLE `logs`
|
||||||
|
MODIFY `id_log` int(11) NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT pour la table `peripeties`
|
||||||
|
--
|
||||||
|
ALTER TABLE `peripeties`
|
||||||
|
MODIFY `idPeripetie` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
|
14
sql/db351634_avionpoeme_table_avionPeripetie.sql
Normal file
14
sql/db351634_avionpoeme_table_avionPeripetie.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `avionPeripetie`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `avionPeripetie` (
|
||||||
|
`idAP` int(10) UNSIGNED NOT NULL,
|
||||||
|
`idAvion` int(10) UNSIGNED NOT NULL,
|
||||||
|
`idPeripetie` int(10) UNSIGNED NOT NULL,
|
||||||
|
`date` datetime NOT NULL,
|
||||||
|
`mailSent` tinyint(1) NOT NULL DEFAULT '0'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Stock les péripeties de chaque avion';
|
31
sql/db351634_avionpoeme_table_avionpoeme.sql
Normal file
31
sql/db351634_avionpoeme_table_avionpoeme.sql
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `avionpoeme`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `avionpoeme` (
|
||||||
|
`idAvion` int(10) UNSIGNED NOT NULL,
|
||||||
|
`message` text CHARACTER SET utf8mb4 NOT NULL,
|
||||||
|
`expeMail` text NOT NULL,
|
||||||
|
`expeKnown` tinyint(1) NOT NULL DEFAULT '0' COMMENT ' true/false en fonction de si l''utilisateur choisi de devoiler son addresse mail pour la premiere',
|
||||||
|
`expeLang` varchar(3) NOT NULL DEFAULT 'fr' COMMENT ' langue de l''envoyeur format 2 lettres (''en'',''fr'',''ar'')',
|
||||||
|
`destLang` varchar(3) NOT NULL COMMENT 'langue du destinataire format 2 lettres (''en'',''fr'',''ar'')',
|
||||||
|
`startLat` float NOT NULL,
|
||||||
|
`startLon` float NOT NULL,
|
||||||
|
`startName` text NOT NULL,
|
||||||
|
`startTime` timestamp NOT NULL COMMENT 'unix time en TZ du depart',
|
||||||
|
`startTZ` text CHARACTER SET utf8mb4 NOT NULL,
|
||||||
|
`destMail` text NOT NULL,
|
||||||
|
`destLat` float NOT NULL,
|
||||||
|
`destLon` float NOT NULL,
|
||||||
|
`destName` text NOT NULL,
|
||||||
|
`public` tinyint(1) NOT NULL COMMENT '0 = privé 1=public, 2=supprimé',
|
||||||
|
`color` varchar(9) NOT NULL COMMENT ' le code hexa de la couleur de l''avion aleatoire parmis la liste.',
|
||||||
|
`deliveryTime` timestamp NOT NULL,
|
||||||
|
`deliveryTZ` text NOT NULL,
|
||||||
|
`deliveryTimeServer` timestamp NOT NULL,
|
||||||
|
`deliveryMethod` text CHARACTER SET utf8mb4 NOT NULL,
|
||||||
|
`atteri` tinyint(1) NOT NULL DEFAULT '0'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
14
sql/db351634_avionpoeme_table_courriels.sql
Normal file
14
sql/db351634_avionpoeme_table_courriels.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `courriels`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `courriels` (
|
||||||
|
`id` int(10) UNSIGNED NOT NULL,
|
||||||
|
`destinataire` text NOT NULL,
|
||||||
|
`objet` text NOT NULL,
|
||||||
|
`message` text NOT NULL,
|
||||||
|
`html` tinyint(1) NOT NULL COMMENT 'false = text, true = html'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='stockage des courriels en attente d''envoie';
|
14
sql/db351634_avionpoeme_table_logs.sql
Normal file
14
sql/db351634_avionpoeme_table_logs.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `logs`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `logs` (
|
||||||
|
`id_log` int(11) NOT NULL,
|
||||||
|
`date` datetime NOT NULL,
|
||||||
|
`auteur` varchar(10) NOT NULL,
|
||||||
|
`log` text NOT NULL,
|
||||||
|
`niveau` tinyint(4) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
28
sql/db351634_avionpoeme_table_peripeties.sql
Normal file
28
sql/db351634_avionpoeme_table_peripeties.sql
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Structure de la table `peripeties`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `peripeties` (
|
||||||
|
`idPeripetie` int(11) NOT NULL,
|
||||||
|
`indexText` text NOT NULL COMMENT 'Contient l''index pour la traduction',
|
||||||
|
`probabilite` decimal(5,1) UNSIGNED NOT NULL COMMENT 'en pourcentage',
|
||||||
|
`effet` tinyint(11) NOT NULL COMMENT '-x => diminue la vitesse de l''avion de x, +x augmente la vitesse de l''avion de x, 0 => avion détruit',
|
||||||
|
`quand` date DEFAULT NULL,
|
||||||
|
`quand_fonction` text
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Déchargement des données de la table `peripeties`
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `peripeties` (`idPeripetie`, `indexText`, `probabilite`, `effet`, `quand`, `quand_fonction`) VALUES
|
||||||
|
(1, 'Peripetie_Perturbation', '20.0', 15, NULL, NULL),
|
||||||
|
(2, 'Peripetie_Vents_porteurs', '20.0', -15, NULL, NULL),
|
||||||
|
(3, 'Peripetie_Collision_Oiseau', '0.5', 0, NULL, NULL),
|
||||||
|
(4, 'Peripetie_OVNI', '0.5', 0, NULL, NULL),
|
||||||
|
(5, 'Peripetie_Drone', '0.5', 0, NULL, NULL),
|
||||||
|
(6, 'Peripetie_LogicielLibre', '100.0', 0, '2021-04-05', NULL),
|
||||||
|
(7, 'Peripetie_Poesie', '100.0', 0, '2022-03-21', NULL);
|
Reference in New Issue
Block a user