summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@tinyboard.org>2011-12-05 13:17:34 +1100
committerSavetheinternet <savetheinternet@tinyboard.org>2011-12-05 13:17:34 +1100
commitb57be65c9f7b9ae4d3259bd309a0f18479780d50 (patch)
tree2beba90fb0facc1b78adbc524a9a3c9fbfc433ca /post.php
parent486842e9a1e0a8587de64e62256388cf1e54b7b5 (diff)
track cites (remove broken links after a post 404s)
Diffstat (limited to 'post.php')
-rw-r--r--post.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/post.php b/post.php
index 40d7aeb2..7bc6192b 100644
--- a/post.php
+++ b/post.php
@@ -334,7 +334,7 @@
$post['body_nomarkup'] = $post['body'];
if(!($mod && isset($post['raw']) && $post['raw']))
- markup($post['body']);
+ $post['tracked_cites'] = markup($post['body'], true);
// Check for a flood
if(!($mod && $mod['type'] >= $config['mod']['flood']) && checkFlood($post)) {
@@ -557,6 +557,15 @@
$id = post($post, $OP);
+ foreach($post['tracked_cites'] as $cite) {
+ $query = prepare('INSERT INTO `cites` VALUES (:board, :post, :target_board, :target)');
+ $query->bindValue(':board', $board['uri']);
+ $query->bindValue(':post', $id, PDO::PARAM_INT);
+ $query->bindValue(':target_board',$cite[0]);
+ $query->bindValue(':target', $cite[1], PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+ }
+
buildThread(($OP?$id:$post['thread']));
if(!$OP && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || numPosts($post['thread']) < $config['reply_limit'])) {