issue: database insert method to keep array values
[minimedit.git] / widget / reply.php
index 6fc1fa569e88354becdac1d1093ce703518509d2..abb364cc1354876b078a0c0a698fc91647b098df 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-global $User;
+global $User, $Db;
 require_once 'database.inc.php';
 
 print '<h3>Reacties</h3>'."\n";
@@ -16,10 +16,16 @@ if ($_POST) {
                if (!$query->rowCount()) {
                        throw new Exception('Fout bij opslaan');
                }
+               if (@list ($cat, $issue) = explode('/', $Page) and ctype_digit($issue)) {
+                       $Db->query(
+                               'UPDATE issues SET updated = now() WHERE page = ? AND id = ?',
+                               [$cat, $issue]
+                       );
+               }
                $_POST['reply'] = NULL;
        }
        catch (Exception $e) {
-               print '<p class=warn>Antwoord niet opgeslagen.</p>'."\n\n";
+               print "<p class=warn>Antwoord niet opgeslagen: {$e->getMessage()}.</p>\n\n";
        }
 }