Remove files
This commit is contained in:
parent
1fa0f64038
commit
583a6a58d9
12
inc/mod.php
12
inc/mod.php
@ -143,13 +143,23 @@
|
|||||||
function deleteFile($id) {
|
function deleteFile($id) {
|
||||||
global $board;
|
global $board;
|
||||||
|
|
||||||
$query = prepare(sprintf("SELECT `thread`,`thumb`,`file` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NOT NULL", $board['uri']));
|
$query = prepare(sprintf("SELECT `thread`,`thumb`,`file` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NOT NULL LIMIT 1", $board['uri']));
|
||||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
if($query->rowCount() < 1) {
|
if($query->rowCount() < 1) {
|
||||||
error(ERROR_INVALIDPOST);
|
error(ERROR_INVALIDPOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$post = $query->fetch();
|
||||||
|
|
||||||
|
// Delete thumbnail
|
||||||
|
@unlink($board['dir'] . DIR_THUMB . $post['thumb']);
|
||||||
|
|
||||||
|
// Delete file
|
||||||
|
@unlink($board['dir'] . DIR_IMG . $post['file']);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a post (reply or thread)
|
// Delete a post (reply or thread)
|
||||||
|
Loading…
Reference in New Issue
Block a user