Add optional database table prefix (issue #118; see issue comments for details)
This commit is contained in:
10
post.php
10
post.php
@@ -48,7 +48,7 @@ if (isset($_POST['delete'])) {
|
||||
error($config['error']['nodelete']);
|
||||
|
||||
foreach ($delete as &$id) {
|
||||
$query = prepare(sprintf("SELECT `thread`, `time`,`password` FROM `posts_%s` WHERE `id` = :id", $board['uri']));
|
||||
$query = prepare(sprintf("SELECT `thread`, `time`,`password` FROM ``posts_%s`` WHERE `id` = :id", $board['uri']));
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
@@ -111,7 +111,7 @@ if (isset($_POST['delete'])) {
|
||||
markup($reason);
|
||||
|
||||
foreach ($report as &$id) {
|
||||
$query = prepare(sprintf("SELECT `thread` FROM `posts_%s` WHERE `id` = :id", $board['uri']));
|
||||
$query = prepare(sprintf("SELECT `thread` FROM ``posts_%s`` WHERE `id` = :id", $board['uri']));
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
@@ -123,7 +123,7 @@ if (isset($_POST['delete'])) {
|
||||
'/' . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $thread ? $thread : $id) . ($thread ? '#' . $id : '') .
|
||||
' for "' . $reason . '"'
|
||||
);
|
||||
$query = prepare("INSERT INTO `reports` VALUES (NULL, :time, :ip, :board, :post, :reason)");
|
||||
$query = prepare("INSERT INTO ``reports`` VALUES (NULL, :time, :ip, :board, :post, :reason)");
|
||||
$query->bindValue(':time', time(), PDO::PARAM_INT);
|
||||
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR);
|
||||
$query->bindValue(':board', $board['uri'], PDO::PARAM_INT);
|
||||
@@ -227,7 +227,7 @@ if (isset($_POST['delete'])) {
|
||||
|
||||
//Check if thread exists
|
||||
if (!$post['op']) {
|
||||
$query = prepare(sprintf("SELECT `sticky`,`locked`,`sage` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri']));
|
||||
$query = prepare(sprintf("SELECT `sticky`,`locked`,`sage` FROM ``posts_%s`` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri']));
|
||||
$query->bindValue(':id', $post['thread'], PDO::PARAM_INT);
|
||||
$query->execute() or error(db_error());
|
||||
|
||||
@@ -583,7 +583,7 @@ if (isset($_POST['delete'])) {
|
||||
|
||||
if (isset($post['tracked_cites'])) {
|
||||
foreach ($post['tracked_cites'] as $cite) {
|
||||
$query = prepare('INSERT INTO `cites` VALUES (:board, :post, :target_board, :target)');
|
||||
$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]);
|
||||
|
Reference in New Issue
Block a user