From 4c6faeb7a252b708f0f54adac82c7ce403ce2e77 Mon Sep 17 00:00:00 2001 From: Michael Save Date: Sat, 24 Mar 2012 15:31:35 +1100 Subject: [PATCH] Convert $post to an object before passing it to event(). This way it can be modified by event handlers before entering the database. See http://tinyboard.org/docs/events.html#examples --- inc/events.php | 1 + post.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/events.php b/inc/events.php index a63cf344..1c45b91b 100644 --- a/inc/events.php +++ b/inc/events.php @@ -6,6 +6,7 @@ function event() { $args = func_get_args(); $event = $args[0]; + $args = array_splice($args, 1); if(!isset($events[$event])) diff --git a/post.php b/post.php index f4acf28a..a30622ef 100644 --- a/post.php +++ b/post.php @@ -595,10 +595,12 @@ $post['thumb'] = substr_replace($post['thumb'], '', 0, mb_strlen($board['dir'] . $config['dir']['thumb'])); } + $post = (object)$post; if($error = event('post', $post)) { - undoImage($post); + undoImage((array)$post); error($error); } + $post = (array)$post; $id = post($post, $OP);