changeset 89:e37ef9a81737 tip

Merge
author Franck Deroche <franck@defr.org>
date Thu, 13 Dec 2018 00:55:42 +0100
parents 1f2410012dbc (diff) efb93800fe10 (current diff)
children
files comment.php includes/class.dataaccess.php
diffstat 3 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/comment.php	Fri Nov 23 00:46:07 2018 +0100
+++ b/comment.php	Thu Dec 13 00:55:42 2018 +0100
@@ -1,10 +1,10 @@
 <?php
      require_once("classes.php");
      $sk = Factory::getSkeleton();
-     $id = $_GET['id'];
      $Data = Factory::getDB();
-     $Req = new Requete;
+     $Req = Factory::getRequete();
 
+     $id = $Req->get('id');
 
      // Enregistrement éventuel d'un commentaire dans la base de données
      $Auteur=$Req->get('Auteur');
--- a/includes/class.dataaccess.php	Fri Nov 23 00:46:07 2018 +0100
+++ b/includes/class.dataaccess.php	Thu Dec 13 00:55:42 2018 +0100
@@ -74,6 +74,10 @@
   function formatDate($timestamp, $decallage=2, $pattern='d/m/Y H:i:s') {
    return gmdate($pattern, $timestamp + $decallage * 3600);
   }
+
+  function escapeString($string) {
+    return mysqli_escape_string($this->link, $string);
+  }
   
   function isInError()
   {
--- a/index.php	Fri Nov 23 00:46:07 2018 +0100
+++ b/index.php	Thu Dec 13 00:55:42 2018 +0100
@@ -1,8 +1,11 @@
 <?php
     require_once("classes.php");
     $sk = Factory::getSkeleton();
+    $request = Factory::getRequete();
+    $db = Factory::getDB();
+
     // Détermination de la requête à exécuter
-    if(!array_key_exists('mode', $_GET)) {
+    if(!$request->varSet('mode', 'GET')) {
         $query = "
         SELECT * 
     	FROM Mess 
@@ -11,10 +14,10 @@
         LIMIT 10
         ";
     	$sk->setTitle('Dual { v10 : OS Edition } Blog');
-    } elseif($_GET['mode'] == 'cal') {
+    } elseif($request->get('mode') == 'cal') {
         $sk->showCalendar(true);
-        $year = intval($_GET['year']);
-        $month = intval($_GET['month']);
+        $year = intval($request->get('year'));
+        $month = intval($request->get('month'));
         $sk->setCalendarMonth($month, $year);
         $sk->setTitle(TextUtils::getMonthName($month) . " $year - Dual Blog");
         $query = "
@@ -26,19 +29,18 @@
         ORDER BY num_mess DESC
         LIMIT 10
         ";
-    } elseif($_GET['mode'] == 'tag') {
-        $tag = $_GET['tag'];
+    } elseif($request->get('mode') == 'tag') {
+        $tag = $request->get('tag');
         $sk->setTitle("Tag: $tag - Dual Blog"); 
         $query = "
         SELECT * 
         FROM Mess m
         LEFT JOIN Lien_Tags_Posts l ON m.num_mess=l.idMess
         LEFT JOIN Tags t ON l.idTag = t.idTag 
-        WHERE t.Tag='{$_GET['tag']}'
+        WHERE t.Tag='{$tag}'
         ORDER BY num_mess DESC
         ";
     }
-    $db = Factory::getDB();
     $db->query($query);
     while($row = $db->GetRow()) {
       $post = new Post($row);