mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-24 07:30:10 +01:00
nntpchan: work around php nonsense
This commit is contained in:
parent
0b19051891
commit
a5e7b3da6f
@ -124,7 +124,7 @@ function post2nntp($post, $msgid) {
|
|||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
if ($result = $query->fetch(PDO::FETCH_ASSOC)) {
|
if ($result = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||||
return ">>".substr($result['message_id_digest'], 0, 16);
|
return ">>".substr($result['message_id_digest'], 0, 18);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return $o[0]; // Should send URL imo
|
return $o[0]; // Should send URL imo
|
||||||
|
29
post.php
29
post.php
@ -90,31 +90,36 @@ if (isset($_GET['Newsgroups']) && $config['nntpchan']['enabled']) {
|
|||||||
$content = file_get_contents("php://input");
|
$content = file_get_contents("php://input");
|
||||||
}
|
}
|
||||||
elseif ($ct == 'multipart/mixed' || $ct == 'multipart/form-data') {
|
elseif ($ct == 'multipart/mixed' || $ct == 'multipart/form-data') {
|
||||||
_syslog(LOG_INFO, "MM: Files: ".print_r($GLOBALS, true));
|
_syslog(LOG_INFO, "MM: Files: ".print_r($GLOBALS, true)); // Debug
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
|
|
||||||
$tmpfiles = $_FILES['attachment'];
|
$newfiles = array();
|
||||||
foreach ($tmpfiles as $id => $file) {
|
foreach ($_FILES['attachment']['error'] as $id => $error) {
|
||||||
if ($file['type'] == 'text/plain') {
|
if ($_FILES['attachment']['type'][$id] == 'text/plain') {
|
||||||
$content .= file_get_contents($file['tmp_name']);
|
$content .= file_get_contents($_FILES['attachment']['tmp_name'][$id]);
|
||||||
unset($_FILES['attachment'][$id]);
|
|
||||||
}
|
}
|
||||||
elseif ($file['type'] == 'message/rfc822') { // Signed message, ignore for now
|
elseif ($_FILES['attachment']['type'][$id] == 'message/rfc822') { // Signed message, ignore for now
|
||||||
unset($_FILES['attachment'][$id]);
|
|
||||||
}
|
}
|
||||||
else { // A real attachment :^)
|
else { // A real attachment :^)
|
||||||
|
$file = array();
|
||||||
|
$file['name'] = $_FILES['attachment']['name'][$id];
|
||||||
|
$file['type'] = $_FILES['attachment']['type'][$id];
|
||||||
|
$file['size'] = $_FILES['attachment']['size'][$id];
|
||||||
|
$file['tmp_name'] = $_FILES['attachment']['tmp_name'][$id];
|
||||||
|
$file['error'] = $_FILES['attachment']['error'][$id];
|
||||||
|
|
||||||
|
$newfiles["file$id"] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_FILES = $_FILES['attachment'];
|
$_FILES = $newfiles;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error("NNTPChan: Wrong mime type: $ct");
|
error("NNTPChan: Wrong mime type: $ct");
|
||||||
}
|
}
|
||||||
|
|
||||||
$_POST['subject'] = isset($_GET['Subject']) ? $_GET['Subject'] : '';
|
$_POST['subject'] = isset($_GET['Subject']) ? ($_GET['Subject'] == 'None' ? '' : $_GET['Subject']) : '';
|
||||||
$_POST['board'] = $xboard;
|
$_POST['board'] = $xboard;
|
||||||
|
|
||||||
if (isset ($_GET['From'])) {
|
if (isset ($_GET['From'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user