Compare commits
No commits in common. "80af7b029a5d20808e55e13d928a1e6e96055fe0" and "0a87a3a0cbec519d6901d24b580bee616f77619e" have entirely different histories.
80af7b029a
...
0a87a3a0cb
44
cron.php
44
cron.php
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
//chdir('/var/www/html/avion-poeme/');
|
//chdir('/var/www/html/avion-poeme/');
|
||||||
|
|
||||||
require_once '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';
|
||||||
@ -10,10 +9,11 @@
|
|||||||
$db = new db();
|
$db = new db();
|
||||||
//test();
|
//test();
|
||||||
$_SERVER["PHP_AUTH_USER"] = "cron";
|
$_SERVER["PHP_AUTH_USER"] = "cron";
|
||||||
//peripetieDatee(); // désactivée pour l'instant
|
//peripetieDatee();
|
||||||
|
print "envoi des courriers en attente" . EOLH;
|
||||||
envoiCourrielEnattente();
|
envoiCourrielEnattente();
|
||||||
print "envoi des péripéties" . EOLH;
|
print "envoi des péripéties" . EOLH;
|
||||||
//peripeties();
|
peripeties();
|
||||||
print "Envoi des arrivées" . EOLH;
|
print "Envoi des arrivées" . EOLH;
|
||||||
arrivee();
|
arrivee();
|
||||||
anonymisation();
|
anonymisation();
|
||||||
@ -42,9 +42,9 @@
|
|||||||
$mailText = $dicoExpe[$p['indexText']] .EOL .EOL ;
|
$mailText = $dicoExpe[$p['indexText']] .EOL .EOL ;
|
||||||
print $objetMail . EOLH;
|
print $objetMail . EOLH;
|
||||||
print $mailText . EOLH;
|
print $mailText . EOLH;
|
||||||
envoiMail($result['expeMail'], $result['destMail'], $objetMail, $mailText, false);
|
envoiMail( $result['destMail'], $objetMail, $mailText, false);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
envoiMail("contact@avion-poe.me", $result['expeMail'], $objetMail, $mailText, true);
|
envoiMail( $result['expeMail'], $objetMail, $mailText, true);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +62,6 @@
|
|||||||
$dbPeripetie->query($query);
|
$dbPeripetie->query($query);
|
||||||
$peripeties = $dbPeripetie->result->fetch_all(MYSQLI_ASSOC);
|
$peripeties = $dbPeripetie->result->fetch_all(MYSQLI_ASSOC);
|
||||||
$dbPeripetie->close();
|
$dbPeripetie->close();
|
||||||
//print_r($peripeties);
|
|
||||||
foreach ( $peripeties as $peripetie)
|
foreach ( $peripeties as $peripetie)
|
||||||
{
|
{
|
||||||
print "péripétie " . $peripetie["idAP"] . " - avion poème n° " . $peripetie['idAvion'] .EOLH;
|
print "péripétie " . $peripetie["idAP"] . " - avion poème n° " . $peripetie['idAvion'] .EOLH;
|
||||||
@ -78,15 +77,11 @@
|
|||||||
$dicoExpe = getLang( $db->expeLang );
|
$dicoExpe = getLang( $db->expeLang );
|
||||||
$dicoDest = getLang( $db->destLang );
|
$dicoDest = getLang( $db->destLang );
|
||||||
// TODO calcul de la nouvelle date d'arrivée
|
// TODO calcul de la nouvelle date d'arrivée
|
||||||
$startTime = date("c", $db->startTime);
|
$dateExpe = new DateTime("@$db->startTime");
|
||||||
$deliveryTime = date("c", $db->deliveryTime);
|
$dateDest = new DateTime("@$db->deliveryTime");
|
||||||
$dateExpe = new DateTime($startTime);
|
|
||||||
print_r($dateExpe);
|
|
||||||
$dateDest = new DateTime($deliveryTime);
|
|
||||||
print_r($dateDest);
|
|
||||||
$interval = $dateExpe->diff($dateDest);
|
$interval = $dateExpe->diff($dateDest);
|
||||||
$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; //TODO calculer d'après les données de la péripétie(voir table péripétie de la base de données)
|
$addDate = $numericInterval * 15/100;
|
||||||
$db->deliveryTime += $addDate;
|
$db->deliveryTime += $addDate;
|
||||||
$db->deliveryTimeServer += $addDate;
|
$db->deliveryTimeServer += $addDate;
|
||||||
$query = "UPDATE avionpoeme SET deliveryTime=FROM_UNIXTIME(" . $db->deliveryTime . "), deliveryTimeServer=FROM_UNIXTIME(" . $db->deliveryTimeServer . ") WHERE idAvion='" . $peripetie['idAvion'] . "'" ;
|
$query = "UPDATE avionpoeme SET deliveryTime=FROM_UNIXTIME(" . $db->deliveryTime . "), deliveryTimeServer=FROM_UNIXTIME(" . $db->deliveryTimeServer . ") WHERE idAvion='" . $peripetie['idAvion'] . "'" ;
|
||||||
@ -101,23 +96,24 @@
|
|||||||
//$html = $result['html'];
|
//$html = $result['html'];
|
||||||
sleep(1);
|
sleep(1);
|
||||||
print "envoi courriel à l'expéditeur : " . $db->expeMail . EOLH . $mailText .EOLH;
|
print "envoi courriel à l'expéditeur : " . $db->expeMail . EOLH . $mailText .EOLH;
|
||||||
$r = envoiMail("contact@avion-poe.me", $db->expeMail, $objetMail, $mailText);
|
$r = envoiMail( $db->expeMail, $objetMail, $mailText);
|
||||||
$db->datePeripetie = formatteDate($db->destLang, $db->deliveryTime, $db->deliveryTZ);
|
$db->datePeripetie = formatteDate($db->destLang, $db->deliveryTime, $db->deliveryTZ);
|
||||||
$result = replaceVariables($db, $dicoDest["Objet_" . $peripetie['indexText']], $dicoDest);
|
$result = replaceVariables($db, $dicoDest["Objet_" . $peripetie['indexText']], $dicoDest);
|
||||||
$objetMail = $result["text"];
|
$objetMail = $result["text"];
|
||||||
$result = replaceVariables($db, $dicoDest[$peripetie['indexText']], $dicoDest);
|
$result = replaceVariables($db, $dicoDest[$peripetie['indexText']], $dicoDest);
|
||||||
$mailText = $result["text"];
|
$mailText = $result["text"];
|
||||||
print "envoi courriel au destinataire : " . $db->destMail . EOLH . $mailText .EOLH;
|
print "envoi courriel au destinataire : " . $db->destMail . EOLH . $mailText .EOLH;
|
||||||
$s = envoiMail($db->expeMail, $db->destMail, $objetMail, $mailText);
|
$s = envoiMail( $db->destMail, $objetMail, $mailText);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
//print "r=" . $r ." => s=" .$s .EOLH;
|
//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
|
}else
|
||||||
{
|
{
|
||||||
print "table avion péripétie non mise à jour" . EOL;
|
print "table avion péripétie non mise à jour" .EOL;
|
||||||
print "UPDATE avionPeripetie SET mailSent=true WHERE idAP='" . $peripetie['idAP'] ."'" .EOLH;
|
print "UPDATE avionPeripetie SET mailSent=true WHERE idAP='" . $peripetie['idAP'] ."'" .EOLH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +135,7 @@
|
|||||||
//var_dump($avionArrive);
|
//var_dump($avionArrive);
|
||||||
foreach ($avionArrive as $avion)
|
foreach ($avionArrive as $avion)
|
||||||
{
|
{
|
||||||
print "avion poème n° " . $avion['idAvion'] . " a atterri" . EOLH;
|
print "avion poème n° " . $avion['idAvion'] . "a atterri" . EOLH;
|
||||||
$dicoExpe = getLang( $avion['expeLang'] );
|
$dicoExpe = getLang( $avion['expeLang'] );
|
||||||
$dicoDest = getLang( $avion['destLang'] );
|
$dicoDest = getLang( $avion['destLang'] );
|
||||||
|
|
||||||
@ -150,7 +146,7 @@
|
|||||||
$result = replaceVariables((object)$avion, $dicoExpe[$index], $dicoExpe);
|
$result = replaceVariables((object)$avion, $dicoExpe[$index], $dicoExpe);
|
||||||
$mailText= $result["text"];
|
$mailText= $result["text"];
|
||||||
print "envoi courriel à l'expéditeur : " . $avion['expeMail'] . EOLH . $mailText .EOLH;
|
print "envoi courriel à l'expéditeur : " . $avion['expeMail'] . EOLH . $mailText .EOLH;
|
||||||
$r = envoiMail("contact@avion-poe.me", $avion['expeMail'], $objetMail["text"], $mailText);
|
$r = envoiMail( $avion['expeMail'], $objetMail["text"], $mailText);
|
||||||
|
|
||||||
//envoi notification arrivée destinataire
|
//envoi notification arrivée destinataire
|
||||||
$index = "Notification_Arrivee_Destinataire";
|
$index = "Notification_Arrivee_Destinataire";
|
||||||
@ -163,14 +159,14 @@
|
|||||||
$mailText = "<html><head></head>\n<body>" . $mailText . "</body></html>";
|
$mailText = "<html><head></head>\n<body>" . $mailText . "</body></html>";
|
||||||
}
|
}
|
||||||
print "envoi courriel au destinataire : " . $avion['destMail'] . EOLH . $mailText .EOLH;
|
print "envoi courriel au destinataire : " . $avion['destMail'] . EOLH . $mailText .EOLH;
|
||||||
sleep(3);
|
sleep(1);
|
||||||
$s = envoiMail($avion['expeMail'], $avion['destMail'], $objetMail["text"], $mailText, $html);
|
$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'] ."'";
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,14 +178,13 @@
|
|||||||
$courriels = $db->result->fetch_all(MYSQLI_ASSOC);
|
$courriels = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||||
foreach( $courriels as $courriel)
|
foreach( $courriels as $courriel)
|
||||||
{
|
{
|
||||||
//TODO changer l'expéditeur, doit être l'expéditeur de l'avion-poême.
|
$r = envoiMail( $courriel['destinataire'], $courriel['objet'], $courriel['message'], $courriel['html']);
|
||||||
$r = envoiMail("contact@avion-poe.me", $courriel['destinataire'], $courriel['objet'], $courriel['message'], $courriel['html']);
|
|
||||||
if ($r)
|
if ($r)
|
||||||
{
|
{
|
||||||
$query = "DELETE FROM courriels WHERE id='" . $courriel['id'] . "'";
|
$query = "DELETE FROM courriels WHERE id='" . $courriel['id'] . "'";
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,4 +213,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
|
||||||
|
54004
dist/html2pdf/html2pdf.bundle.min.js
vendored
54004
dist/html2pdf/html2pdf.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -20,18 +20,8 @@ $site = "Avion Poème";
|
|||||||
$dossier = "/www";
|
$dossier = "/www";
|
||||||
$basedir = dirname($_SERVER['DOCUMENT_ROOT']) . $dossier;
|
$basedir = dirname($_SERVER['DOCUMENT_ROOT']) . $dossier;
|
||||||
|
|
||||||
$testMode = true;
|
$base_url = "https://avion-poe.me";
|
||||||
|
$base_path = "/flex/storage/avion-poe.me/site/www/";
|
||||||
if ($testMode)
|
|
||||||
{
|
|
||||||
$base_url = "https://avion-poe.me";
|
|
||||||
$base_path = "/flex/storage/avion-poe.me/site/www/";
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
$base_url = "https://dev.avion-poe.me";
|
|
||||||
$base_path = "/flex/storage/avion-poe.me/site/dev/";
|
|
||||||
}
|
|
||||||
|
|
||||||
$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"])) {
|
if (empty($_SERVER["PHP_AUTH_USER"])) {
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!isset($site)) {
|
if ( !isset($site) )
|
||||||
require_once("config.inc.php");
|
{
|
||||||
header('Location: ' . $accueil);
|
require_once( "config.inc.php" );
|
||||||
|
header( 'Location: ' . $accueil );
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once "config.inc.php";
|
require_once "config.inc.php";
|
||||||
require_once "log.php";
|
require_once "log.php";
|
||||||
require_once "fonctions.inc.php";
|
require_once "fonctions.inc.php";
|
||||||
|
require_once "envoi_courriel.inc.php";
|
||||||
|
|
||||||
$table_prefix = "";
|
$table_prefix = "";
|
||||||
class db
|
class db
|
||||||
{
|
{
|
||||||
private $server = "db351634-avionpoeme.sql-pro.online.net";
|
private $server = "db351634-avionpoeme.sql-pro.online.net";
|
||||||
private $port = 3306;
|
private $port = 3306;
|
||||||
private $user = "db120904";
|
private $user = "db120904";
|
||||||
private $passwd = "AvionPoème*DB";
|
private $passwd = "AvionPoème*DB";
|
||||||
private $database = "db351634_avionpoeme";
|
private $database = "db351634_avionpoeme";
|
||||||
public $connect;
|
public $connect;
|
||||||
public $result;
|
public $result;
|
||||||
// avion
|
// avion
|
||||||
public $uid;
|
public $uid;
|
||||||
public $message;
|
public $message;
|
||||||
@ -50,53 +52,56 @@ class db
|
|||||||
public $datePeripetie;
|
public $datePeripetie;
|
||||||
public $effetPeripetie;
|
public $effetPeripetie;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->open();
|
$this->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
function open()
|
function open()
|
||||||
{
|
{
|
||||||
if (!$this->connect) {
|
if ( !$this->connect )
|
||||||
$this->connect = new mysqli($this->server, $this->user, $this->passwd, $this->database);
|
{
|
||||||
if ($this->connect->connect_errno) {
|
$this->connect = new mysqli( $this->server, $this->user, $this->passwd, $this->database );
|
||||||
log_error("Échec de la connexion : => " . $this->connect->connect_error . "<br />" . __file__ . ' ligne ' . __line__, false, false);
|
if ( $this->connect->connect_errno )
|
||||||
|
{
|
||||||
|
log_error( "Échec de la connexion : => " . $this->connect->connect_error . "<br />" . __file__ . ' ligne ' . __line__, false,false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->connect->set_charset("utf8");
|
$this->connect->set_charset("utf8");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function close()
|
function close()
|
||||||
{
|
{
|
||||||
$this->connect->close();
|
$this->connect->close();
|
||||||
$this->connect = 0;
|
$this->connect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function protect($string)
|
function protect( $string )
|
||||||
{
|
{
|
||||||
return $this->connect->real_escape_string($string);
|
return $this->connect->real_escape_string( $string );
|
||||||
}
|
}
|
||||||
|
|
||||||
function query($string)
|
function query( $string )
|
||||||
{
|
{
|
||||||
|
|
||||||
//log_write( $string );
|
//log_write( $string );
|
||||||
if (empty($this->connect)) $this->open();
|
if ( empty( $this->connect ) ) $this->open();
|
||||||
|
|
||||||
$this->result = $this->connect->query($string);
|
$this->result = $this->connect->query( $string ) ;
|
||||||
|
|
||||||
if ($this->connect->errno > 0) log_error("Échec de la commande query => " . $this->connect->error . "<br />" . __file__ . ' ligne ' . __line__ . "\n" . $string, true, false);
|
if ( $this->connect->errno > 0 ) log_error( "Échec de la commande query => " . $this->connect->error . "<br />" . __file__ . ' ligne ' . __line__ . "\n" . $string, true, false);
|
||||||
//print_r( $this );
|
//print_r( $this );
|
||||||
}
|
}
|
||||||
|
|
||||||
function newPlane() //return 0 on error
|
function newPlane() //return 0 on error
|
||||||
{
|
{
|
||||||
global $base_url;
|
global $base_url;
|
||||||
if (round($this->startLat, 3, PHP_ROUND_HALF_DOWN) == round($this->destLat, 3, PHP_ROUND_HALF_DOWN) && round($this->startLon, 3, PHP_ROUND_HALF_DOWN) == round($this->destLon, 3, PHP_ROUND_HALF_DOWN)) {
|
if (round($this->startLat,3,PHP_ROUND_HALF_DOWN)==round($this->destLat,3,PHP_ROUND_HALF_DOWN) && round($this->startLon,3,PHP_ROUND_HALF_DOWN)==round($this->destLon,3,PHP_ROUND_HALF_DOWN))
|
||||||
$this->destLon += 0.001;
|
{
|
||||||
$this->destLat += 0.001;
|
$this->destLon+=0.001;
|
||||||
|
$this->destLat+=0.001;
|
||||||
}
|
}
|
||||||
$query = "INSERT INTO avionpoeme VALUES ('0','";
|
$query = "INSERT INTO avionpoeme VALUES ('0','";
|
||||||
$query .= $this->protect($this->message) . "', '";
|
$query .= $this->protect($this->message) . "', '";
|
||||||
@ -123,17 +128,18 @@ class db
|
|||||||
$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;
|
||||||
$this->newPeripetie();
|
$this->newPeripetie();
|
||||||
courrielEnvoi($this);
|
courrielEnvoi($this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlane($uid)
|
function getPlane($uid)
|
||||||
{
|
{
|
||||||
global $base_url;
|
global $base_url;
|
||||||
$query = "SELECT idAvion, message, expeMail, expeKnown, expeLang, destLang, startLat, startLon, startName, UNIX_TIMESTAMP(startTime) as startTime, startTZ, destMail, destLat, destLon, destName, color, UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, UNIX_TIMESTAMP(deliveryTimeServer) as deliveryTimeServer, deliveryMethod, public FROM avionpoeme WHERE idAvion='" . $uid . "'";
|
$query = "SELECT idAvion, message, expeMail, expeKnown, expeLang, destLang, startLat, startLon, startName, UNIX_TIMESTAMP(startTime) as startTime, startTZ, destMail, destLat, destLon, destName, color, UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, UNIX_TIMESTAMP(deliveryTimeServer) as deliveryTimeServer, deliveryMethod, public FROM avionpoeme WHERE idAvion='" . $uid ."'";
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$plane = $this->result->fetch_array(MYSQLI_ASSOC);
|
$plane = $this->result->fetch_array(MYSQLI_ASSOC);
|
||||||
$this->message = $plane["message"];
|
$this->message = $plane["message"];
|
||||||
@ -146,7 +152,7 @@ class db
|
|||||||
$this->startName = $plane["startName"];
|
$this->startName = $plane["startName"];
|
||||||
$this->startTime = $plane["startTime"];
|
$this->startTime = $plane["startTime"];
|
||||||
$this->startTZ = $plane["startTZ"];
|
$this->startTZ = $plane["startTZ"];
|
||||||
$this->startTimeRFC822 = formatteDate($this->expeLang, $this->startTime, $this->startTZ);
|
$this->startTimeRFC822 = formatteDate( $this->expeLang, $this->startTime, $this->startTZ);
|
||||||
$this->destMail = $plane["destMail"];
|
$this->destMail = $plane["destMail"];
|
||||||
$this->destLat = $plane["destLat"];
|
$this->destLat = $plane["destLat"];
|
||||||
$this->destLon = $plane["destLon"];
|
$this->destLon = $plane["destLon"];
|
||||||
@ -154,7 +160,7 @@ class db
|
|||||||
$this->color = $plane["color"];
|
$this->color = $plane["color"];
|
||||||
$this->deliveryTime = $plane["deliveryTime"];
|
$this->deliveryTime = $plane["deliveryTime"];
|
||||||
$this->deliveryTZ = $plane["deliveryTZ"];
|
$this->deliveryTZ = $plane["deliveryTZ"];
|
||||||
$this->deliveryTimeRFC822 = formatteDate($this->destLang, $this->deliveryTime, $this->deliveryTZ);
|
$this->deliveryTimeRFC822 = formatteDate( $this->destLang, $this->deliveryTime, $this->deliveryTZ );
|
||||||
$this->deliveryTimeServer = $plane["deliveryTimeServer"];
|
$this->deliveryTimeServer = $plane["deliveryTimeServer"];
|
||||||
$this->deliveryMethod = $plane["deliveryMethod"];
|
$this->deliveryMethod = $plane["deliveryMethod"];
|
||||||
$this->public = $plane["public"];
|
$this->public = $plane["public"];
|
||||||
@ -162,9 +168,9 @@ class db
|
|||||||
$this->urlAvion = $base_url . "/?avionpoeme=" . $this->uid;
|
$this->urlAvion = $base_url . "/?avionpoeme=" . $this->uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentPlanes()
|
function getCurrentPlanes()
|
||||||
{
|
{
|
||||||
$query = "SELECT idAvion as uid, UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, destLat, destLon, destName, destMail, message, expeMail, deliveryTimeServer, deliveryMethod, UNIX_TIMESTAMP(startTime) as startTime, startTZ, startLon, startLat, startName, color, message FROM avionpoeme WHERE deliveryTimeServer>NOW()";
|
$query = "SELECT idAvion as uid, UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, destLat, destLon, destName, message, UNIX_TIMESTAMP(startTime) as startTime, startTZ, startLon, startLat, startName, color, message FROM avionpoeme WHERE deliveryTimeServer>NOW()";
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$planes = $this->result->fetch_all(MYSQLI_ASSOC);
|
$planes = $this->result->fetch_all(MYSQLI_ASSOC);
|
||||||
print json_encode($planes);
|
print json_encode($planes);
|
||||||
@ -172,20 +178,20 @@ class db
|
|||||||
return $planes;
|
return $planes;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAnthology($page = 0)
|
function getAnthology($page=0)
|
||||||
{
|
{
|
||||||
$query = "SELECT COUNT(*) as count FROM avionpoeme WHERE deliveryTimeServer<NOW() AND public='1'";
|
$query = "SELECT COUNT(*) as count FROM avionpoeme WHERE deliveryTimeServer<NOW() AND public='1'";
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$result = $this->result->fetch_assoc();
|
$result = $this->result->fetch_assoc();
|
||||||
$n_pages = floor(($result["count"] / RESULTS_BY_PAGE)) + 1;
|
$n_pages = floor(($result["count"] / RESULTS_BY_PAGE))+1;
|
||||||
if ($page <= 0) //renvoie le nombre de ligne d'anthologie
|
if ($page <= 0) //renvoie le nombre de ligne d'anthologie
|
||||||
{
|
{
|
||||||
print '{"nAnthology":"' . $result["count"] . '","nPages":"' . $n_pages . '"}';
|
print '{"nAnthology":"' . $result["count"] . '","nPages":"' . $n_pages .'"}';
|
||||||
return $n_pages;
|
return $n_pages;
|
||||||
} else //renvoie les lignes d'anthologie
|
}else //renvoie les lignes d'anthologie
|
||||||
{
|
{
|
||||||
if ($page > $n_pages) $page = $n_pages;
|
if ($page > $n_pages) $page=$n_pages;
|
||||||
$query = "SELECT UNIX_TIMESTAMP(startTime) as startTime, startTZ, startName, message, UNIX_TIMESTAMP(deliveryTime) as deliveryTime , deliveryTZ, destName FROM avionpoeme WHERE deliveryTimeServer<NOW() AND public='1' ORDER BY deliveryTime DESC LIMIT " . ($page - 1) * RESULTS_BY_PAGE . "," . RESULTS_BY_PAGE;
|
$query = "SELECT UNIX_TIMESTAMP(startTime) as startTime, startTZ, startName, message, UNIX_TIMESTAMP(deliveryTime) as deliveryTime , deliveryTZ, destName FROM avionpoeme WHERE deliveryTimeServer<NOW() AND public='1' ORDER BY deliveryTime DESC LIMIT " . ($page-1)*RESULTS_BY_PAGE . "," . RESULTS_BY_PAGE;
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$planes = $this->result->fetch_all(MYSQLI_ASSOC);
|
$planes = $this->result->fetch_all(MYSQLI_ASSOC);
|
||||||
print json_encode($planes, JSON_FORCE_OBJECT);
|
print json_encode($planes, JSON_FORCE_OBJECT);
|
||||||
@ -196,18 +202,10 @@ class db
|
|||||||
function savePeripetie()
|
function savePeripetie()
|
||||||
{
|
{
|
||||||
|
|
||||||
$query = "INSERT INTO avionPeripetie ('idAvion', 'idPeripetie', 'date', 'expeMail'), VALUES (";
|
$query = "INSERT INTO avionPeripetie VALUES ('0','";
|
||||||
$query .= "'" . $this->protect($this->uid) . "',";
|
$query .= $this->protect($this->uid) . "','";
|
||||||
$query .= "'" . $this->protect($this->idPeripetie) . "', ";
|
$query .= $this->protect($this->idPeripetie) . "', ";
|
||||||
$query .= "FROM_UNIXTIME(" . $this->protect($this->datePeripetie) . "),";
|
$query .= "FROM_UNIXTIME(" . $this->protect($this->datePeripetie) . "), '0')";
|
||||||
if ($this->expeKnown)
|
|
||||||
{
|
|
||||||
$query .= "'" . $this->protect($this->expeMail) . "'";
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
$query .= "'contact@avion-poe.me'";
|
|
||||||
}
|
|
||||||
$query .= ")";
|
|
||||||
log_write("savePeripetie " . $query);
|
log_write("savePeripetie " . $query);
|
||||||
//$query .= $this->protect($this->effetPeripetie) . "', '";
|
//$query .= $this->protect($this->effetPeripetie) . "', '";
|
||||||
//$query .= $this->protect($this->expeMail) . "', '";
|
//$query .= $this->protect($this->expeMail) . "', '";
|
||||||
@ -219,9 +217,10 @@ class db
|
|||||||
{
|
{
|
||||||
$query = "SELECT *, DATEDIFF(quand,CURDATE()) as datePeripetie FROM peripeties WHERE quand IS NULL";
|
$query = "SELECT *, DATEDIFF(quand,CURDATE()) as datePeripetie FROM peripeties WHERE quand IS NULL";
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
while (($result = $this->result->fetch_assoc())) {
|
while ( ($result = $this->result->fetch_assoc()) )
|
||||||
|
{
|
||||||
$this->idPeripetie = $result["idPeripetie"];
|
$this->idPeripetie = $result["idPeripetie"];
|
||||||
if ((mt_rand(0, 100) <= $result["probabilite"])) //calcul de la probabilité de la péripétie
|
if ((mt_rand(0,100) <= $result["probabilite"])) //calcul de la probabilité de la péripétie
|
||||||
{
|
{
|
||||||
log_write("newPeripetie");
|
log_write("newPeripetie");
|
||||||
$this->datePeripetie = mt_rand($this->startTime, $this->deliveryTime); //ajustement de l'effet
|
$this->datePeripetie = mt_rand($this->startTime, $this->deliveryTime); //ajustement de l'effet
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
require_once 'log.php';
|
require_once 'log.php';
|
||||||
require_once 'fonctions.inc.php';
|
require_once 'fonctions.inc.php';
|
||||||
|
|
||||||
|
|
||||||
function courrielEnvoi( $db )
|
function courrielEnvoi( $db )
|
||||||
{
|
{
|
||||||
$dicoExpe = getLang( $db->expeLang );
|
$dicoExpe = getLang( $db->expeLang );
|
||||||
@ -19,7 +20,7 @@ function courrielEnvoi( $db )
|
|||||||
$mailText = $result['text'];
|
$mailText = $result['text'];
|
||||||
$html = $result['html'];
|
$html = $result['html'];
|
||||||
|
|
||||||
saveMail( $db, "contact@avion-poe.me", $db->expeMail, $objetMail, $mailText, $html);
|
saveMail( $db, $db->expeMail, $objetMail, $mailText, $html);
|
||||||
|
|
||||||
//log_write(print_r($db,true));
|
//log_write(print_r($db,true));
|
||||||
|
|
||||||
@ -46,59 +47,51 @@ function courrielEnvoi( $db )
|
|||||||
{
|
{
|
||||||
$message = "<html><head></head>\n<body>" . $message . "</body></html>";
|
$message = "<html><head></head>\n<body>" . $message . "</body></html>";
|
||||||
}
|
}
|
||||||
saveMail( $db, $db->expeMail, $db->destMail, $objetMail, $mailText, $html);
|
saveMail( $db, $db->destMail, $objetMail, $mailText, $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveMail( $db, $expediteur, $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);
|
||||||
}
|
}
|
||||||
|
|
||||||
function envoiMail($expediteur, $destinataire, $sujet, $text, $html=false, $cc='', $bcc='')
|
function envoiMail($destinataire, $sujet, $text, $html=false, $cc='', $bcc='')
|
||||||
{
|
{
|
||||||
require_once 'include/swiftmailer/autoload.php';
|
require_once 'include/swiftmailer/autoload.php';
|
||||||
//require_once 'include/swiftmailer/swiftmailer/lib/swift_init.php';
|
//require_once 'include/swiftmailer/swiftmailer/lib/swift_init.php';
|
||||||
try
|
$transport = (new Swift_SmtpTransport('smtpauth.online.net', 465, 'ssl'))
|
||||||
|
->setUsername('contact@avion-poe.me')
|
||||||
|
->setPassword('AvionPoème*27juillet');
|
||||||
|
$mailer = new Swift_Mailer($transport);
|
||||||
|
$message = (new Swift_Message($sujet))
|
||||||
|
->setFrom(["contact@avion-poe.me"])
|
||||||
|
->setTo([$destinataire])
|
||||||
|
->setCharset('utf-8');
|
||||||
|
$type = $message->getHeaders()->get('Content-Type');
|
||||||
|
if ($html)
|
||||||
{
|
{
|
||||||
$transport = (new Swift_SmtpTransport('smtpauth.online.net', 465, 'ssl'))
|
// setParameters() takes an associative array
|
||||||
->setUsername('contact@avion-poe.me')
|
$type->setValue('text/html');
|
||||||
->setPassword('AvionPoème*27juillet');
|
$type->setParameter('charset', 'utf-8');
|
||||||
$mailer = new Swift_Mailer($transport);
|
$str = nl2br($text);
|
||||||
$message = (new Swift_Message($sujet))
|
$text = "<html><head></head>\n<body>" . $str . "</body></html>";
|
||||||
->setFrom(["contact@avion-poe.me"])
|
log_write(__FILE__ . EOL . __LINE__ . EOL . wordwrap($text, 1000, "\r\n"), INFO);
|
||||||
->setTo([$destinataire])
|
}else
|
||||||
->setCharset('utf-8');
|
{
|
||||||
$type = $message->getHeaders()->get('Content-Type');
|
$type->setValue('text/plain');
|
||||||
if ($html)
|
$type->setParameter('charset', 'utf-8');
|
||||||
{
|
$text = str_replace("\n","\r\n", $text);
|
||||||
// setParameters() takes an associative array
|
|
||||||
$type->setValue('text/html');
|
|
||||||
$type->setParameter('charset', 'utf-8');
|
|
||||||
$str = nl2br($text);
|
|
||||||
$text = "<html><head></head>\n<body>" . $str . "</body></html>";
|
|
||||||
log_write(__FILE__ . EOL . __LINE__ . EOL . wordwrap($text, 1000, "\r\n"), INFO);
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
$type->setValue('text/plain');
|
|
||||||
$type->setParameter('charset', 'utf-8');
|
|
||||||
$text = str_replace("\n","\r\n", $text);
|
|
||||||
}
|
|
||||||
$message->setBody($text);
|
|
||||||
//add date header
|
|
||||||
$headers = $message->getHeaders();
|
|
||||||
//$headers->addDateHeader('Date', new DateTimeImmutable('3 days ago'));
|
|
||||||
$headers->addPathHeader('Return-Path', $expediteur);
|
|
||||||
if (!$mailer->send($message, $failures))
|
|
||||||
{
|
|
||||||
echo "Failures:";
|
|
||||||
print_r($failures);
|
|
||||||
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" . $destinataire . EOL . $sujet . EOL . print_r($failure, true) . EOL . wordwrap($text, 1000 , "\r\n"), ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (\Swift_TransportException $ex)
|
$message->setBody($text);
|
||||||
|
//add date header
|
||||||
|
$headers = $message->getHeaders();
|
||||||
|
$headers->addDateHeader('Your-Header', new DateTimeImmutable('3 days ago'));
|
||||||
|
if (!$mailer->send($message, $failures))
|
||||||
{
|
{
|
||||||
|
echo "Failures:";
|
||||||
|
print_r($failures);
|
||||||
|
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" . $destinataire . EOL . $sujet . EOL . print_r($failure, true) . EOL . wordwrap($text, 1000 , "\r\n"), ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -133,14 +133,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="closePlane"></div>
|
|
||||||
<div id="downloadPlaneMessage" class="btn btn-outline-primary">Télécharger l'avion-poème</div>
|
|
||||||
<script src="src/map.js"></script>
|
<script src="src/map.js"></script>
|
||||||
<script src="src/geocoder.js"></script>
|
<script src="src/geocoder.js"></script>
|
||||||
<script src="src/paperPlaneAnimation.js"></script>
|
<script src="src/paperPlaneAnimation.js"></script>
|
||||||
<script src="src/formValidation.js"></script>
|
<script src="src/formValidation.js"></script>
|
||||||
<script src="src/newPlane.js"></script>
|
<script src="src/newPlane.js"></script>
|
||||||
<script src="src/translation.js"></script>
|
<script src="src/translation.js"></script>
|
||||||
|
<script src="src/anthology.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -33,5 +33,4 @@
|
|||||||
<script src="dist/rasterizeHTML/rasterizeHTML.allinone.js"></script>
|
<script src="dist/rasterizeHTML/rasterizeHTML.allinone.js"></script>
|
||||||
<script src="dist/leaflet-locatecontrol/L.Control.Locate.min.js"></script>
|
<script src="dist/leaflet-locatecontrol/L.Control.Locate.min.js"></script>
|
||||||
<script src='dist/leaflet-fullscreen/Leaflet.fullscreen.min.js'></script>
|
<script src='dist/leaflet-fullscreen/Leaflet.fullscreen.min.js'></script>
|
||||||
<script src='dist/html2pdf/html2pdf.bundle.min.js'></script>
|
|
||||||
</head>
|
</head>
|
@ -21,7 +21,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<form class="nav-button form-inline mt-2 mt-md-0">
|
<form class="nav-button form-inline mt-2 mt-md-0">
|
||||||
<input id="buttonNewPlane" type="button" class="btn btn-warning my-2 my-sm-0" data-toggle="modal" data-target="#newPlaneModal" value='Lancer un avion-poème 0/100'>
|
<input id="buttonNewPlane" type="button" class="btn btn-warning my-2 my-sm-0" data-toggle="modal" data-target="#newPlaneModal" value='Envoyer un avion'>
|
||||||
</input>
|
</input>
|
||||||
<i id="planeLimitTooltip" class="fas fa-question-circle" data-toggle="tooltip" data-placement="auto" title="coucou"></i>
|
<i id="planeLimitTooltip" class="fas fa-question-circle" data-toggle="tooltip" data-placement="auto" title="coucou"></i>
|
||||||
</form>
|
</form>
|
||||||
|
191
src/anthology.js
191
src/anthology.js
@ -1,136 +1,79 @@
|
|||||||
function flightTime(a, b) {
|
function flightTime(a,b){
|
||||||
var days = Math.round(((b - a) / 86400) * 100) / 100;
|
var days = Math.round((b-a)/86400 * 100) / 100
|
||||||
var months = Math.round(days / 30);
|
var months = Math.round(days/30)
|
||||||
var years = Math.round(months / 12);
|
var years = Math.round(months/12)
|
||||||
if (days < 30) {
|
if (days < 30){
|
||||||
return "" + days + " " + dictionnary.jours;
|
return ""+days+" "+dictionnary.jours
|
||||||
} else if (days >= 30 && days < 365) {
|
}
|
||||||
if (months > 1) {
|
else if (days >= 30 && days < 365){
|
||||||
return "" + months + " " + dictionnary.mois_pluriel;
|
if(months>1){
|
||||||
} else {
|
return ""+months+" "+dictionnary.mois_pluriel
|
||||||
return "" + months + " " + dictionnary.mois;
|
}
|
||||||
}
|
else{
|
||||||
} else if (days >= 365) {
|
return ""+months+" "+dictionnary.mois
|
||||||
if (years > 1) {
|
}
|
||||||
return "" + years + " " + dictionnary.ans;
|
}
|
||||||
} else {
|
else if (days >= 365){
|
||||||
return "" + years + " " + dictionnary.an;
|
if(years>1){
|
||||||
}
|
return ""+years+" "+dictionnary.ans
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
return ""+years+" "+dictionnary.an
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//load
|
//load
|
||||||
var nPages;
|
var nPages;
|
||||||
var nPagesLoaded = 1;
|
var nPagesLoaded = 1
|
||||||
$.post("getAnthology.php", function (pages) {
|
$.post( "getAnthology.php", function(pages) {
|
||||||
pages = $.parseJSON(pages);
|
pages = $.parseJSON(pages)
|
||||||
nPages = Number(pages.nPages);
|
nPages = Number(pages.nPages)
|
||||||
});
|
})
|
||||||
|
|
||||||
function displayAnthology() {
|
function displayAnthology(){ // clean and display first page
|
||||||
// clean and display first page
|
$("#anthologyItems").html('')
|
||||||
$("#anthologyItems").html("");
|
nPagesLoaded = 1
|
||||||
nPagesLoaded = 1;
|
$.post( "getAnthology.php?page=1", function(result) {
|
||||||
$.post("getAnthology.php?page=1", function (result) {
|
results = $.parseJSON(result)
|
||||||
results = $.parseJSON(result);
|
var momentLocale = lang;
|
||||||
var momentLocale = lang;
|
if (momentLocale == 'zh'){momentLocale = 'zh-cn'} //troubleshot for chinese
|
||||||
if (momentLocale == "zh") {
|
moment.locale(momentLocale)
|
||||||
momentLocale = "zh-cn";
|
for (var i in results){
|
||||||
} //troubleshot for chinese
|
addAnthologyLine(results[i])
|
||||||
moment.locale(momentLocale);
|
}
|
||||||
for (var i in results) {
|
})
|
||||||
addAnthologyLine(results[i]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#anthology").scroll(function () {
|
$( "#anthology" ).scroll(function() {
|
||||||
if ($("#anthology").scrollTop() + 700 > $("#anthologyItems").height()) {
|
if($("#anthology").scrollTop() + 700 > $("#anthologyItems").height()){
|
||||||
if (nPagesLoaded < nPages) {
|
if (nPagesLoaded < nPages){
|
||||||
nPagesLoaded++;
|
nPagesLoaded++
|
||||||
console.log("Loading anthology page " + nPagesLoaded + "/" + nPages);
|
console.log('Loading anthology page '+nPagesLoaded+'/'+nPages)
|
||||||
$.post("getAnthology.php?page=" + nPagesLoaded + "", function (result) {
|
$.post( "getAnthology.php?page="+nPagesLoaded+"", function(result) {
|
||||||
results = $.parseJSON(result);
|
results = $.parseJSON(result)
|
||||||
var momentLocale = lang;
|
var momentLocale = lang;
|
||||||
if (momentLocale == "zh") {
|
if (momentLocale == 'zh'){momentLocale = 'zh-cn'} //troubleshot for chinese
|
||||||
momentLocale = "zh-cn";
|
moment.locale(momentLocale)
|
||||||
} //troubleshot for chinese
|
for (var i in results){
|
||||||
moment.locale(momentLocale);
|
addAnthologyLine(results[i])
|
||||||
for (var i in results) {
|
}
|
||||||
addAnthologyLine(results[i]);
|
})
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function addAnthologyLine(results) {
|
function addAnthologyLine(results){
|
||||||
if (lang == "ar") {
|
if (lang == 'ar'){ // arabic : rtl + add <br>
|
||||||
// arabic : rtl + add <br>
|
$("#anthologyItems").append(
|
||||||
$("#anthologyItems").append(
|
'<small style="float:right">'+dictionnary.origine+': <b>'+results.startName+'</b> • '+dictionnary.destination+': <b>'+results.destName+'</b> • '+dictionnary.date_arrivee+': <b>'+moment(Number(results.deliveryTime)*1000).format('LL')+'</b> • '+dictionnary.temps_de_vol+': <b>'+flightTime(Number(results.startTime),Number(results.deliveryTime))+'</b></small><br><br>'+results.message+'<br><hr><br>'
|
||||||
'<small style="float:right">' +
|
)
|
||||||
dictionnary.origine +
|
}
|
||||||
": <b>" +
|
else{
|
||||||
results.startName +
|
$("#anthologyItems").append(
|
||||||
"</b> • " +
|
'<small>'+dictionnary.origine+': <b>'+results.startName+'</b> • '+dictionnary.destination+': <b>'+results.destName+'</b> • '+dictionnary.date_arrivee+': <b>'+moment(Number(results.deliveryTime)*1000).format('LL')+'</b> • '+dictionnary.temps_de_vol+': <b>'+flightTime(Number(results.startTime),Number(results.deliveryTime))+'</b></small><br><br>'+results.message+'<br><hr><br>'
|
||||||
dictionnary.destination +
|
)
|
||||||
": <b>" +
|
}
|
||||||
results.destName +
|
|
||||||
"</b> • " +
|
|
||||||
dictionnary.date_arrivee +
|
|
||||||
": <b>" +
|
|
||||||
moment(Number(results.deliveryTime) * 1000).format("LL") +
|
|
||||||
"</b> • " +
|
|
||||||
dictionnary.temps_de_vol +
|
|
||||||
": <b>" +
|
|
||||||
flightTime(Number(results.startTime), Number(results.deliveryTime)) +
|
|
||||||
"</b></small><br><br>" +
|
|
||||||
results.message +
|
|
||||||
"<br><hr><br>"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$("#anthologyItems").append(
|
|
||||||
"<small>" +
|
|
||||||
dictionnary.origine +
|
|
||||||
": <b>" +
|
|
||||||
results.startName +
|
|
||||||
"</b> • " +
|
|
||||||
dictionnary.destination +
|
|
||||||
": <b>" +
|
|
||||||
results.destName +
|
|
||||||
"</b> • " +
|
|
||||||
dictionnary.date_arrivee +
|
|
||||||
": <b>" +
|
|
||||||
moment(Number(results.deliveryTime) * 1000).format("LL") +
|
|
||||||
"</b> • " +
|
|
||||||
dictionnary.temps_de_vol +
|
|
||||||
": <b>" +
|
|
||||||
flightTime(Number(results.startTime), Number(results.deliveryTime)) +
|
|
||||||
"</b></small><br><br>" +
|
|
||||||
results.message +
|
|
||||||
"<br><hr><br>"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post("avionJournalier.php", function (result) {
|
|
||||||
result = result.replace(/'/g, '"');
|
|
||||||
result = $.parseJSON(result);
|
|
||||||
nbPlane = Number(result.nAvion);
|
|
||||||
console.log(result);
|
|
||||||
$("#buttonNewPlane").val(
|
|
||||||
"Lancer un avion-poème " + Number(result.nAvion) + "/100"
|
|
||||||
);
|
|
||||||
$("#buttonNewPlane").on("click", () => {
|
|
||||||
window.location.replace("/");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
$.getJSON("lang/" + lang + "", function (s) {
|
|
||||||
displayAnthology();
|
|
||||||
$("#anthologyTitle").html(s.anthologie);
|
|
||||||
$("#anthologyDisclaimer").html(s.suppr_message_public);
|
|
||||||
$("#closeAnthologyAbout").html(s.retour_carte);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
50
src/app.css
50
src/app.css
@ -337,56 +337,6 @@ a#navbarDropdownLang.nav-link.dropdown-toggle::after {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-file-label {
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
width: 100%;
|
|
||||||
padding-right: 9em;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.custom-file-label::after {
|
.custom-file-label::after {
|
||||||
content: attr(data-after);
|
content: attr(data-after);
|
||||||
}
|
}
|
||||||
|
|
||||||
#closePlane {
|
|
||||||
position: fixed;
|
|
||||||
top: 70px;
|
|
||||||
right: 40px;
|
|
||||||
visibility: hidden;
|
|
||||||
opacity: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
z-index: 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#closePlane:before {
|
|
||||||
content: "\f00d";
|
|
||||||
font-family: "Font Awesome 5 Pro";
|
|
||||||
color: white;
|
|
||||||
font-size: 3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#downloadPlaneMessage {
|
|
||||||
position: fixed;
|
|
||||||
z-index: 10000;
|
|
||||||
bottom: 5%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
color: var(--primary);
|
|
||||||
background-color: white;
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
transition: opacity 0.3s ease-in;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
#downloadPlaneMessage {
|
|
||||||
bottom: 15%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#downloadPlaneMessage:before {
|
|
||||||
content: "\f019";
|
|
||||||
font-family: "Font Awesome 5 Pro";
|
|
||||||
color: var(--primary);
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
1137
src/map.js
1137
src/map.js
File diff suppressed because it is too large
Load Diff
@ -104,7 +104,13 @@ function translateUI(l) {
|
|||||||
$("#navTitle").html(s.avionpoeme);
|
$("#navTitle").html(s.avionpoeme);
|
||||||
$("#buttonAnthology").html(s.anthologie);
|
$("#buttonAnthology").html(s.anthologie);
|
||||||
$("#buttonAbout").html(s.apropos);
|
$("#buttonAbout").html(s.apropos);
|
||||||
$("#buttonNewPlane").val(s.lancer_avion + " " + nbPlane + "/100");
|
if (typeof nbPlane !== "undefined") {
|
||||||
|
$("#buttonNewPlane").val(s.lancer_avion + " " + nbPlane + "/100");
|
||||||
|
} else {
|
||||||
|
$("#buttonNewPlane").on("click", () => {
|
||||||
|
window.location.replace("/");
|
||||||
|
});
|
||||||
|
}
|
||||||
//new plane form
|
//new plane form
|
||||||
$("#newPlaneModalTitle").html(s.lancer_avion);
|
$("#newPlaneModalTitle").html(s.lancer_avion);
|
||||||
$("#newPlaneModalMessage").html(s.message);
|
$("#newPlaneModalMessage").html(s.message);
|
||||||
@ -133,6 +139,11 @@ function translateUI(l) {
|
|||||||
$("#publicTooltip").attr("title", s.public_tooltip).tooltip("_fixTitle");
|
$("#publicTooltip").attr("title", s.public_tooltip).tooltip("_fixTitle");
|
||||||
|
|
||||||
$('#selectDestLang option[value="' + lang + '"]').prop("selected", true); //selecting by default recipient language same as interface
|
$('#selectDestLang option[value="' + lang + '"]').prop("selected", true); //selecting by default recipient language same as interface
|
||||||
|
//Anthology
|
||||||
|
displayAnthology();
|
||||||
|
$("#anthologyTitle").html(s.anthologie);
|
||||||
|
$("#anthologyDisclaimer").html(s.suppr_message_public);
|
||||||
|
$("#closeAnthologyAbout").html(s.retour_carte);
|
||||||
|
|
||||||
//About
|
//About
|
||||||
$("#aboutTitle").html(s.apropos);
|
$("#aboutTitle").html(s.apropos);
|
||||||
|
Reference in New Issue
Block a user