summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2016-05-05 10:54:09 +0200
committerczaks <marcin@6irc.net>2016-05-05 10:54:09 +0200
commitd310abc95c80a35f6cb4f8e5119e1d46bdb09b14 (patch)
tree6b77311856bf1dd7387377d99977d23c30a955c0 /post.php
parent186ad5ca86ae2255bbe0d6846a390963d63ae9e9 (diff)
parent19b70663d7e786fca0425b53eb79412fd5987255 (diff)
Merge branch 'master' of github.com:vichan-devel/vichan
Diffstat (limited to 'post.php')
-rw-r--r--post.php29
1 files changed, 12 insertions, 17 deletions
diff --git a/post.php b/post.php
index 4c944178..6e893747 100644
--- a/post.php
+++ b/post.php
@@ -7,16 +7,6 @@ require_once 'inc/functions.php';
require_once 'inc/anti-bot.php';
require_once 'inc/bans.php';
-// Fix for magic quotes
-if (get_magic_quotes_gpc()) {
- function strip_array($var) {
- return is_array($var) ? array_map('strip_array', $var) : stripslashes($var);
- }
-
- $_GET = strip_array($_GET);
- $_POST = strip_array($_POST);
-}
-
if ((!isset($_POST['mod']) || !$_POST['mod']) && $config['board_locked']) {
error("Board is locked");
}
@@ -447,7 +437,7 @@ if (isset($_POST['delete'])) {
$i = 0;
foreach ($_FILES as $key => $file) {
if ($file['size'] && $file['tmp_name']) {
- $file['filename'] = urldecode(get_magic_quotes_gpc() ? stripslashes($file['name']) : $file['name']);
+ $file['filename'] = urldecode($file['name']);
$file['extension'] = strtolower(mb_substr($file['filename'], mb_strrpos($file['filename'], '.') + 1));
if (isset($config['filename_func']))
$file['file_id'] = $config['filename_func']($file);
@@ -625,12 +615,14 @@ if (isset($_POST['delete'])) {
if ($post['has_file']) {
foreach ($post['files'] as $key => &$file) {
- if ($file['is_an_image'] && $config['ie_mime_type_detection'] !== false) {
- // Check IE MIME type detection XSS exploit
- $buffer = file_get_contents($upload, null, null, null, 255);
- if (preg_match($config['ie_mime_type_detection'], $buffer)) {
- undoImage($post);
- error($config['error']['mime_exploit']);
+ if ($file['is_an_image']) {
+ if ($config['ie_mime_type_detection'] !== false) {
+ // Check IE MIME type detection XSS exploit
+ $buffer = file_get_contents($upload, null, null, null, 255);
+ if (preg_match($config['ie_mime_type_detection'], $buffer)) {
+ undoImage($post);
+ error($config['error']['mime_exploit']);
+ }
}
require_once 'inc/image.php';
@@ -639,6 +631,9 @@ if (isset($_POST['delete'])) {
if (!$size = @getimagesize($file['tmp_name'])) {
error($config['error']['invalidimg']);
}
+ if (!in_array($size[2], array(IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_BMP))) {
+ error($config['error']['invalidimg']);
+ }
if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) {
error($config['error']['maxsize']);
}