Skip to content

Commit

Permalink
Corrections bugs sur les GET
Browse files Browse the repository at this point in the history
  • Loading branch information
malnuxstarck committed Jul 24, 2017
1 parent 5261584 commit b413e49
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 9 deletions.
8 changes: 8 additions & 0 deletions blog/lire.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@

$managerContenu = new ManagerContenu($bdd);
$infosArticle = $managerContenu->donneLeContenu($idArticle);
if(empty($infosArticle))
{
$_SESSION['flash']['success'] = "L' Article n'existe pas ";
header('Location:./index.php');
exit();
}


$article = new Contenu($infosArticle);

echo '<div class="fildariane">
Expand Down
2 changes: 1 addition & 1 deletion class/ManagerTopicView.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function nouvellevu(TopicView $topic_view)
$query->bindValue(':post',$topic_view->tv_post_id(),PDO::PARAM_INT);
$query->bindValue(':poste',$topic_view->tv_poste(),PDO::PARAM_STR);
$query->execute();
$query->CloseCursor();
$query->closeCursor();
}

public function miseAjoursVu(TopicView $topic_view)
Expand Down
23 changes: 16 additions & 7 deletions forum/voirforum.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<?php
include '../includes/session.php';
$titre="Voir un forum";
include("../includes/identifiants.php");
include("../includes/debut.php");
include("../includes/menu.php");
require "../class/ManagerForum.class.php";
require "../class/Forum.class.php";

//On récupère la valeur de f
$forumId = (isset($_GET['f']))?(int) $_GET['f']:1;
//On récupère la valeur de f
$forumId = (isset($_GET['f']))?(int) $_GET['f']:1;

$managerForum = new ManagerForum($bdd);
$donnees = $managerForum->infosForum($forumId);
$forum = new Forum($donnees);

if(empty($donnees))
{
$forumId = 1;
$donnees = $managerForum->infosForum($forumId);
$_SESSION['flash']['success'] = "Le forum n'existe pas , vous avez été redirigé ";
}

/*On verifie si l'utilisateur a le droit le forum */
$forum = new Forum($donnees);
$titre = $forum->name();

include("../includes/debut.php");
include("../includes/menu.php");
/*On verifie si l'utilisateur a le droit le forum */

if (!Membre::verif_auth($forum->auth_view()))
{
Expand Down
16 changes: 15 additions & 1 deletion forum/voirtopic.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@

$managerTopic = new ManagerTopic($bdd);
$donneesTopic = $managerTopic->infosTopic($idTopic);

if(empty($donneesTopic)) // si on ne trouve rien on redirige sur le premier topic :D
{
/* A activer apres la premier creation de topic
$idTopic = 1 ;
$donneesTopic = $managerTopic->infosTopic($idTopic);
*/

$_SESSION["flash"]["success"] = "Le topic n'existe pas ou a été supprimer ";
header('Location:./index.php');
exit();
}


$topic = new Topic($donneesTopic);

//A partir d'ici, on va compter le nombre de messages pourn'afficher que les 15 premiers
Expand All @@ -34,7 +48,7 @@
$nombreDePages = ceil($totalDesMessages / $nombreDeMessagesParPage);
$managerTopicView = new ManagerTopicView($bdd);

if($id!=0)
if($id != 0 AND $topic->id() != NULL)
{
$nbr_vu = $managerTopicView->nombreVusTopicDuMembre($id , $topic->id());

Expand Down
8 changes: 8 additions & 0 deletions tutoriels/lire.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@

$managerContenu = new ManagerContenu($bdd);
$infosTuto = $managerContenu->donneLeContenu($idTuto);

if(empty($infosTuto))
{
$_SESSION['flash']['success'] = "Le tuto n'existe pas ";
header('Location:./index.php');
exit();
}

$tuto = new Contenu($infosTuto);

echo '<div class="fildariane">
Expand Down

0 comments on commit b413e49

Please sign in to comment.