$result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
@ -35,7 +36,8 @@ function getPrenom($db, $mail){
return null;
}
function getLogin($db, $mail){
function getLogin($db, $mail)
{
$result = pg_query_params($db, "SELECT login from Utilisateur WHERE mail = $1;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
@ -45,7 +47,8 @@ function getLogin($db, $mail){
return null;
}
function getTrajetsProposes($db, $mail){
function getTrajetsProposes($db, $mail)
{
$result = pg_query_params($db, "SELECT COUNT(*) from Trajet WHERE mailProposition = $1 AND estAnnule = false AND datedepart >= current_date;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
@ -54,7 +57,8 @@ function getTrajetsProposes($db, $mail){
return 0;
}
function getTrajetsReserves($db, $mail){
function getTrajetsReserves($db, $mail)
{
$result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver r WHERE r.codetrajet = tr.codetrajet AND mailutilisateur = $1 AND etatres != 'Annulée' AND estAnnule = false AND datedepart >= current_date;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
@ -63,7 +67,8 @@ function getTrajetsReserves($db, $mail){
return 0;
}
function getMessagesNonLus($db, $mail){
function getMessagesNonLus($db, $mail)
{
$result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
@ -72,7 +77,8 @@ function getMessagesNonLus($db, $mail){
}
}
function getAvisNonLus($db, $mail){
function getAvisNonLus($db, $mail)
{
global $db;
$result = pg_query_params($db, "SELECT COUNT(tr.mailProposition) FROM Trajet tr, Avis av WHERE tr.codeTrajet = av.codeTrajet AND av.estLu = false AND tr.mailProposition = $1;", array($mail));
if ($result) {
@ -82,25 +88,29 @@ function getAvisNonLus($db, $mail){
}
}
function getPathImgProfil($mail){
function getPathImgProfil($mail)
{
if (file_exists("../imageProfil/$mail.png")) {
return "../imageProfil/$mail.png";
}
return "../imageProfil/default.svg";
}
function addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){
function addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab)