diff options
| author | 8chan <admin@8chan.co> | 2015-02-16 16:21:30 -0800 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2016-05-06 15:13:27 +0200 |
| commit | 7831da83fc09ff90a0f99641bde5e2d8c08e84c5 (patch) | |
| tree | 652cd7a52bd79e592c2dcd5476df3b56e936a0ac | |
| parent | b476b660073adbe827836a7e7860b0fb3a061ff0 (diff) | |
New event: rebuildpost, allows you to bind events to ?/edit
| -rwxr-xr-x | inc/functions.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/inc/functions.php b/inc/functions.php index cbe0bc62..4746b034 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1166,19 +1166,22 @@ function deleteFile($id, $remove_entirely_if_already=true, $file=null) { // rebuild post (markup) function rebuildPost($id) { - global $board; + global $board, $mod; - $query = prepare(sprintf("SELECT `body_nomarkup`, `thread` FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); + $query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); if ((!$post = $query->fetch(PDO::FETCH_ASSOC)) || !$post['body_nomarkup']) return false; - markup($body = &$post['body_nomarkup']); + markup($post['body'] = &$post['body_nomarkup']); + $post = (object)$post; + event('rebuildpost', $post); + $post = (array)$post; $query = prepare(sprintf("UPDATE ``posts_%s`` SET `body` = :body WHERE `id` = :id", $board['uri'])); - $query->bindValue(':body', $body); + $query->bindValue(':body', $post['body']); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); |
