diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-01 22:12:31 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-01 22:12:31 +1100 |
| commit | e4016687321770054d134f13f3275fc0523588e8 (patch) | |
| tree | a82919ab0620698454e571c2fee79e56d6d59cbd /mod.php | |
| parent | 2179b03980fbb21f5f0723367438fecff1324acb (diff) | |
Fixed major security bug and image deleting
Diffstat (limited to 'mod.php')
| -rw-r--r-- | mod.php | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -219,7 +219,7 @@ if(!openBoard($boardName)) error(ERROR_NOBOARD); - if(!$page = index(empty($matches[2]) || $matches[2] == FILE_INDEX ? 1 : $matches[2], true)) { + if(!$page = index(empty($matches[2]) || $matches[2] == FILE_INDEX ? 1 : $matches[2], $mod)) { error(ERROR_404); } $page['pages'] = getPages(true); @@ -235,9 +235,31 @@ if(!openBoard($boardName)) error(ERROR_NOBOARD); - $page = buildThread($thread, true, true); + $page = buildThread($thread, true, $mod); echo $page; + } elseif(preg_match('/^\/' . $regex['board'] . 'deletefile\/(\d+)$/', $query, $matches)) { + if($mod['type'] < MOD_DELETEFILE) error(ERROR_NOACCESS); + // Delete file from post + + $boardName = $matches[1]; + $post = $matches[2]; + // Open board + if(!openBoard($boardName)) + error(ERROR_NOBOARD); + + // Delete post + deleteFile($post); + // Rebuild board + buildIndex(); + + + // Redirect + if(isset($_SERVER['HTTP_REFERER'])) + header('Location: ' . $_SERVER['HTTP_REFERER'], true, REDIRECT_HTTP); + else + header('Location: ?/' . sprintf(BOARD_PATH, $boardName) . FILE_INDEX, true, REDIRECT_HTTP); + } elseif(preg_match('/^\/' . $regex['board'] . 'delete\/(\d+)$/', $query, $matches)) { if($mod['type'] < MOD_DELETE) error(ERROR_NOACCESS); // Delete post |
