Skip to content

Commit 762bffb

Browse files
committed
Fix méthode classe Client setEstAdmin qui n'avait pas le bon nom. Changement majeur dans le path des fichiers. Utilisation de la méthode php realpath() et de la variable __DIR__ pour obtenir le chemin absolue des fichiers. Utilisation de variables pour spécifier le chemin relatif pour CSS/JS puisque les path absolue ne peuvent être utilisé pour des ressources. Ces changements permet d'avoir un sous dossier avec une page web ayant accès à tout les scripts et ressources nécessaires.
1 parent bd65309 commit 762bffb

19 files changed

+101
-22
lines changed

admin/index.php

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
//-----------------------------
4+
// Page principal du site web, le catalogue.
5+
//-----------------------------
6+
7+
require_once(realpath(__DIR__.'/..').'/php/biblio/foncCommunes.php');
8+
9+
$CSS_DIR = '../css/';
10+
$JS_DIR = '../js/';
11+
$IMG_DIR = '../img/';
12+
13+
//Variable pour que header.php charge un javascript spécifique à la page index.php
14+
$js = array();
15+
$js[] = 'index.js';
16+
//Variable pour que header.php charge une feuille de style spécifique à la page index.php
17+
$css = array();
18+
$css[] = 'index.css';
19+
//Variable pour que header.php donne un titre de page spécifique à index.php
20+
$titre = 'LogiKek';
21+
//Variable pour que header.php donne une description spécifique à la page index.php
22+
$description = 'Site de vente de système d\'exploitation';
23+
//Variable pour que header.php donne des mots clés spécifique à la page index.php
24+
$motCle = 'OS, Linux, Windows, BSD, Apple, RHEL, Vente, logiciel';
25+
26+
//Charge les scripts
27+
require_once("../header.php");
28+
require_once("../sectionGauche.php");
29+
die;
30+
?>
31+
32+
<!-- Début section central col-md-7 -->
33+
<div class="col-md-7" id="centre">
34+
<div class="pub">
35+
<img class="img-responsive" src="./img/LogiKek2.png" alt="Logo LogiKek">
36+
</div>
37+
<!-- Début des produits -->
38+
<div class="row">
39+
<?php if(count($liste->getCatalogue()) > 0) : ?>
40+
<?php foreach($liste->getCatalogue() as $value): ?>
41+
<div class="col-md-4 panel panel-default produit">
42+
<h4><?php echo $value->getNom(); ?></h4>
43+
<a class="thumbnail imgProduitPetit" data-noProduit="<?php echo $value->getCodeProduit() ?>">
44+
<img src="./img/produits/<?php echo $value->getCodeProduit(); ?>_small.png" alt="<?php echo $value->getNom(); ?>" onError="this.onerror=null;this.src='./img/produits/nonDispo_small.png';">
45+
</a>
46+
<?php foreach($value->getCategories() as $categorie): ?>
47+
<span class="label label-info proCategorie"><?php echo $categorie; ?></span>
48+
<?php endforeach; ?>
49+
<h4 class="proPrix">
50+
<?php echo number_format($value->getPrix(), 2); ?>$
51+
<a href="./panierGestion.php?quoiFaire=ajout&noProduit=<?php echo $value->getCodeProduit(); ?>" class="proCart">
52+
<i class="fa fa-shopping-cart"></i>
53+
</a>
54+
</h4>
55+
</div>
56+
<?php endforeach; ?>
57+
<?php else : ?>
58+
<h1 id="aucunProduit">Aucun produit</h1>
59+
<?php endif; ?>
60+
</div> <!-- Fin des produits -->
61+
</div> <!-- Fin section central col-md-7 -->
62+
<div class="col-md-1"> <!-- Début Section de droite central -->
63+
</div>
64+
<!-- Fin section de droite central -->
65+
</div>
66+
67+
<div id="myModal" class="modal fade" tabindex="-1" role="dialog">
68+
<div class="modal-dialog">
69+
70+
</div><!-- /.modal-dialog -->
71+
</div><!-- /.modal -->
72+
73+
<?php require_once('./footer.php'); ?>

authentification.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// et la circulation entre certaines pages
66
//-----------------------------
77

8-
require_once("./php/biblio/foncCommunes.php");
8+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
99

1010
$js = array();
1111

changerMotDePasse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Script pour le changement de mot de passe d'un compte d'utilisateur.
55
//-----------------------------
66

7-
require_once("./php/biblio/foncCommunes.php");
7+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
88

99
$js = array();
1010

commander.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Script pour afficher la confirmation d'une commande et l'affichage de la facture
55
//-----------------------------
66

7-
require_once("./php/biblio/foncCommunes.php");
7+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
88

99
$js = array();
1010

confirmation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// avant de sa création/modification.
77
//-----------------------------
88

9-
require_once("./php/biblio/foncCommunes.php");
9+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
1010

1111
$js = array();
1212

creationDossier.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// le succès de l'opération.
66
//-----------------------------
77

8-
require_once("./php/biblio/foncCommunes.php");
8+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
99

1010
$js = array();
1111

creditGestion.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Page pour saisir les informations d'une carte de crédit
55
// pour confirmer un achat.
66
//---------------------------------------------
7-
require_once("./php/biblio/foncCommunes.php");
7+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
88

99
$js = array();
1010
$js[] = 'validationAchat.js';

header.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Page de la section d'entête du site web.
55
//---------------------------------------
66

7-
require_once("./php/biblio/foncCommunes.php");
7+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
88

99
//code de catégorie pour la recherche. Par défault à 0 pour tout inclure.
1010
$categorie = 0;
@@ -70,14 +70,14 @@
7070
<!-- CSS contenant plusieurs icones vectorielles communes aux sites webs -->
7171
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
7272

73-
<link rel="stylesheet" href="./css/global.css">
74-
<link rel="stylesheet" href="./css/dirty.css">
73+
<link rel="stylesheet" href="<?php echo $CSS_DIR.'global.css';?>">
74+
<link rel="stylesheet" href="<?php echo $CSS_DIR.'dirty.css';?>">
7575
<?php foreach($css as $value) : //Chaque page inclus sont propre css/js avec les variable $css et $js. Si le tableau est vide, alors l'html n'est pas généré. ?>
76-
<link rel="stylesheet" href="./css/<?php echo $value; ?>">
76+
<link rel="stylesheet" href="<?php echo $CSS_DIR.$value; ?>">
7777
<?php endforeach; ?>
7878

7979
<?php foreach($js as $value) : ?>
80-
<script src="./js/<?php echo $value; ?>"></script>
80+
<script src="<?php echo $JS_DIR.$value; ?>"></script>
8181
<?php endforeach; ?>
8282
</head>
8383
<body>

historiqueCommande.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//------------------------------------------------
77

88

9-
require_once("./php/biblio/foncCommunes.php");
9+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
1010

1111
$js = array();
1212
$js[] = 'rafraichissement.js';

index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Page principal du site web, le catalogue.
55
//-----------------------------
66

7-
require_once("./php/biblio/foncCommunes.php");
7+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
88

99

1010

inscription.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Script contenant le formulaire de création et de modification d'un compte client.
55
// Procède au diverses validations nécessaires.
66
//-----------------------------
7-
require_once("./php/biblio/foncCommunes.php");
7+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
88

99
$js = array();
1010

panierGestion.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Page qui gère le panier de commande du client et affiche le prix.
55
//-----------------------------
66

7-
require_once("./php/biblio/foncCommunes.php");
7+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
88

99
$panier = new Panier();
1010

php/Classes/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public function getEstAdmin()
232232
//-----------------------------
233233
//Met à jour le statut d'administrateur du client
234234
//-----------------------------
235-
public function setMotDePasseExpire($estAdmin)
235+
public function setEstAdmin($estAdmin)
236236
{
237237
$this->estAdmin = $estAdmin;
238238
}

php/Classes/bdService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class bdService
1212
function __construct()
1313
{
1414
//Parse le fichier de configuration de bd config.ini
15-
$config = parse_ini_file('./config.ini');
15+
$config = parse_ini_file(ROOT_DIR.'/config.ini');
1616
//Crée un objet mysqli selon les paramètres du fichier de config.
1717
$this->BDInterne = new mysqli($config['ip'], $config['username'], $config['password'], $config['dbname']);
1818
if (!mysqli_connect_errno())

php/biblio/foncCommunes.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
//Frais du magasin par transaction.
77
define ("FRAIS_CODE", 3.00);
88

9+
define ("ROOT_DIR", realpath(__DIR__.'/../..'));
10+
11+
$CSS_DIR = './css/';
12+
$JS_DIR = './js/';
13+
$IMG_DIR = './img/';
14+
915
//Enregistre la fonction ChargementClasses pour activé la queue de chargement des classes.
1016
spl_autoload_register('ChargementClasses');
1117

@@ -20,7 +26,7 @@
2026
function ChargementClasses($nomClasse)
2127
{
2228
//chemin où nos classes sont situés.
23-
$chemin = './php/Classes/';
29+
$chemin = realpath(__DIR__.'/..').'/Classes/';
2430
require_once($chemin.$nomClasse.'.php');
2531
}
2632

politiques.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Page affichant les politiques de notre entreprise.
55
//-----------------------------
66

7-
require_once("./php/biblio/foncCommunes.php");
7+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
88

99
$js = array();
1010
//Variable pour que header.php charge une feuille de style spécifique à la page politiques.php

produitDetails.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//-----------------------------
44
// Page qui récupère un produit dans la base de donnée et affiche ses informations détaillés.
55
//-----------------------------
6-
require_once("./php/biblio/foncCommunes.php");
6+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
77

88

99
global $maBD;

template.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
require_once("./php/biblio/foncCommunes.php");
2+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
33

44
$js = array();
55

verifierUniciteUsager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Retourne 0 à un doublon, 1 si le nom est disponible,
88
// un message d'erreur dans le cas d'un erreur.
99
//-----------------------------
10-
require_once("./php/biblio/foncCommunes.php");
10+
require_once(realpath(__DIR__).'/php/biblio/foncCommunes.php');
1111

1212
//S'il reçoit nomUtilisateur dans le GET
1313
if(!empty($_GET['nomUtilisateur']))

0 commit comments

Comments
 (0)