diff options
| author | Marcin Łabanowski <marcin@6irc.net> | 2013-01-19 16:23:02 +0100 |
|---|---|---|
| committer | Marcin Łabanowski <marcin@6irc.net> | 2013-01-19 16:23:02 +0100 |
| commit | 82fb733906e73fd348d961602144d91a9019b1ba (patch) | |
| tree | 957e13b7e87b5a30f77b9f11231b9cef1b86fca6 /inc/functions.php | |
| parent | fa0a79d99246bc82cac5640cf0ecdee214d6545f (diff) | |
| parent | 27ee4d320c196a5490891831f615f2e871eb6782 (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/inc/functions.php b/inc/functions.php index c1d6e7b6..2f5127ee 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -527,7 +527,7 @@ function checkFlood($post) { $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE (`ip` = :ip AND `time` >= :floodtime) OR (`ip` = :ip AND `body` != '' AND `body` = :body AND `time` >= :floodsameiptime) OR (`body` != '' AND `body` = :body AND `time` >= :floodsametime) LIMIT 1", $board['uri'])); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); - $query->bindValue(':body', $post['body'], PDO::PARAM_INT); + $query->bindValue(':body', $post['body']); $query->bindValue(':floodtime', time()-$config['flood_time'], PDO::PARAM_INT); $query->bindValue(':floodsameiptime', time()-$config['flood_time_ip'], PDO::PARAM_INT); $query->bindValue(':floodsametime', time()-$config['flood_time_same'], PDO::PARAM_INT); @@ -697,7 +697,7 @@ function threadExists($id) { function post(array $post) { global $pdo, $board; - $query = prepare(sprintf("INSERT INTO `posts_%s` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, 0, :embed)", $board['uri'])); + $query = prepare(sprintf("INSERT INTO `posts_%s` (`id`, `thread`, `subject`, `email`, `name`, `trip`, `capcode`, `body`, `body_nomarkup`, `time`, `bump`, `thumb`, `thumbwidth`, `thumbheight`, `file`, `filewidth`, `fileheight`, `filesize`, `filename`, `filehash`, `password`, `ip`, `sticky`, `locked`, `sage`, `embed`) VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, 0, :embed)", $board['uri'])); // Basic stuff if (!empty($post['subject'])) { @@ -1651,6 +1651,20 @@ function getPostByHash($hash) { return false; } +function getPostByHashInThread($hash, $thread) { + global $board; + $query = prepare(sprintf("SELECT `id`,`thread` FROM `posts_%s` WHERE `filehash` = :hash AND ( `thread` = :thread OR `id` = :thread )", $board['uri'])); + $query->bindValue(':hash', $hash, PDO::PARAM_STR); + $query->bindValue(':thread', $thread, PDO::PARAM_INT); + $query->execute() or error(db_error($query)); + + if ($post = $query->fetch()) { + return $post; + } + + return false; +} + function undoImage(array $post) { if (!$post['has_file']) return; |
