Auto save posted attachments to user's file directory.
This commit is contained in:
parent
ae47019faf
commit
91705fdb1f
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* rslight NNTP<->HTTP Gateway
|
||||
/*
|
||||
* rslight NNTP<->HTTP Gateway
|
||||
* Download: https://news.novabbs.com/getrslight
|
||||
*
|
||||
* Based on Newsportal by Florian Amrhein
|
||||
|
@ -21,8 +22,8 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
@session_start();
|
||||
|
||||
/*
|
||||
* Encode lines with 8bit-characters to quote-printable
|
||||
*
|
||||
|
@ -31,59 +32,275 @@
|
|||
* the function returns a sting containing the quoted-printable encoded
|
||||
* $line
|
||||
*/
|
||||
function encode_subject($line) {
|
||||
function encode_subject($line)
|
||||
{
|
||||
$newstring = mb_encode_mimeheader(quoted_printable_decode($line));
|
||||
return $newstring;
|
||||
}
|
||||
|
||||
if(!function_exists('quoted_printable_encode'))
|
||||
if (! function_exists('quoted_printable_encode')) {
|
||||
|
||||
function quoted_printable_encode($line)
|
||||
{
|
||||
function quoted_printable_encode($line) {
|
||||
global $www_charset;
|
||||
$qp_table = array(
|
||||
'=00', '=01', '=02', '=03', '=04', '=05',
|
||||
'=06', '=07', '=08', '=09', '=0A', '=0B',
|
||||
'=0C', '=0D', '=0E', '=0F', '=10', '=11',
|
||||
'=12', '=13', '=14', '=15', '=16', '=17',
|
||||
'=18', '=19', '=1A', '=1B', '=1C', '=1D',
|
||||
'=1E', '=1F', '_', '!', '"', '#',
|
||||
'$', '%', '&', "'", '(', ')',
|
||||
'*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9', ':', ';',
|
||||
'<', '=3D', '>', '=3F', '@', 'A',
|
||||
'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M',
|
||||
'N', 'O', 'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W', 'X', 'Y',
|
||||
'Z', '[', '\\', ']', '^', '=5F',
|
||||
'', 'a', 'b', 'c', 'd', 'e',
|
||||
'f', 'g', 'h', 'i', 'j', 'k',
|
||||
'l', 'm', 'n', 'o', 'p', 'q',
|
||||
'r', 's', 't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{', '|', '}',
|
||||
'~', '=7F', '=80', '=81', '=82', '=83',
|
||||
'=84', '=85', '=86', '=87', '=88', '=89',
|
||||
'=8A', '=8B', '=8C', '=8D', '=8E', '=8F',
|
||||
'=90', '=91', '=92', '=93', '=94', '=95',
|
||||
'=96', '=97', '=98', '=99', '=9A', '=9B',
|
||||
'=9C', '=9D', '=9E', '=9F', '=A0', '=A1',
|
||||
'=A2', '=A3', '=A4', '=A5', '=A6', '=A7',
|
||||
'=A8', '=A9', '=AA', '=AB', '=AC', '=AD',
|
||||
'=AE', '=AF', '=B0', '=B1', '=B2', '=B3',
|
||||
'=B4', '=B5', '=B6', '=B7', '=B8', '=B9',
|
||||
'=BA', '=BB', '=BC', '=BD', '=BE', '=BF',
|
||||
'=C0', '=C1', '=C2', '=C3', '=C4', '=C5',
|
||||
'=C6', '=C7', '=C8', '=C9', '=CA', '=CB',
|
||||
'=CC', '=CD', '=CE', '=CF', '=D0', '=D1',
|
||||
'=D2', '=D3', '=D4', '=D5', '=D6', '=D7',
|
||||
'=D8', '=D9', '=DA', '=DB', '=DC', '=DD',
|
||||
'=DE', '=DF', '=E0', '=E1', '=E2', '=E3',
|
||||
'=E4', '=E5', '=E6', '=E7', '=E8', '=E9',
|
||||
'=EA', '=EB', '=EC', '=ED', '=EE', '=EF',
|
||||
'=F0', '=F1', '=F2', '=F3', '=F4', '=F5',
|
||||
'=F6', '=F7', '=F8', '=F9', '=FA', '=FB',
|
||||
'=FC', '=FD', '=FE', '=FF');
|
||||
'=00',
|
||||
'=01',
|
||||
'=02',
|
||||
'=03',
|
||||
'=04',
|
||||
'=05',
|
||||
'=06',
|
||||
'=07',
|
||||
'=08',
|
||||
'=09',
|
||||
'=0A',
|
||||
'=0B',
|
||||
'=0C',
|
||||
'=0D',
|
||||
'=0E',
|
||||
'=0F',
|
||||
'=10',
|
||||
'=11',
|
||||
'=12',
|
||||
'=13',
|
||||
'=14',
|
||||
'=15',
|
||||
'=16',
|
||||
'=17',
|
||||
'=18',
|
||||
'=19',
|
||||
'=1A',
|
||||
'=1B',
|
||||
'=1C',
|
||||
'=1D',
|
||||
'=1E',
|
||||
'=1F',
|
||||
'_',
|
||||
'!',
|
||||
'"',
|
||||
'#',
|
||||
'$',
|
||||
'%',
|
||||
'&',
|
||||
"'",
|
||||
'(',
|
||||
')',
|
||||
'*',
|
||||
'+',
|
||||
',',
|
||||
'-',
|
||||
'.',
|
||||
'/',
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
':',
|
||||
';',
|
||||
'<',
|
||||
'=3D',
|
||||
'>',
|
||||
'=3F',
|
||||
'@',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'G',
|
||||
'H',
|
||||
'I',
|
||||
'J',
|
||||
'K',
|
||||
'L',
|
||||
'M',
|
||||
'N',
|
||||
'O',
|
||||
'P',
|
||||
'Q',
|
||||
'R',
|
||||
'S',
|
||||
'T',
|
||||
'U',
|
||||
'V',
|
||||
'W',
|
||||
'X',
|
||||
'Y',
|
||||
'Z',
|
||||
'[',
|
||||
'\\',
|
||||
']',
|
||||
'^',
|
||||
'=5F',
|
||||
'',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f',
|
||||
'g',
|
||||
'h',
|
||||
'i',
|
||||
'j',
|
||||
'k',
|
||||
'l',
|
||||
'm',
|
||||
'n',
|
||||
'o',
|
||||
'p',
|
||||
'q',
|
||||
'r',
|
||||
's',
|
||||
't',
|
||||
'u',
|
||||
'v',
|
||||
'w',
|
||||
'x',
|
||||
'y',
|
||||
'z',
|
||||
'{',
|
||||
'|',
|
||||
'}',
|
||||
'~',
|
||||
'=7F',
|
||||
'=80',
|
||||
'=81',
|
||||
'=82',
|
||||
'=83',
|
||||
'=84',
|
||||
'=85',
|
||||
'=86',
|
||||
'=87',
|
||||
'=88',
|
||||
'=89',
|
||||
'=8A',
|
||||
'=8B',
|
||||
'=8C',
|
||||
'=8D',
|
||||
'=8E',
|
||||
'=8F',
|
||||
'=90',
|
||||
'=91',
|
||||
'=92',
|
||||
'=93',
|
||||
'=94',
|
||||
'=95',
|
||||
'=96',
|
||||
'=97',
|
||||
'=98',
|
||||
'=99',
|
||||
'=9A',
|
||||
'=9B',
|
||||
'=9C',
|
||||
'=9D',
|
||||
'=9E',
|
||||
'=9F',
|
||||
'=A0',
|
||||
'=A1',
|
||||
'=A2',
|
||||
'=A3',
|
||||
'=A4',
|
||||
'=A5',
|
||||
'=A6',
|
||||
'=A7',
|
||||
'=A8',
|
||||
'=A9',
|
||||
'=AA',
|
||||
'=AB',
|
||||
'=AC',
|
||||
'=AD',
|
||||
'=AE',
|
||||
'=AF',
|
||||
'=B0',
|
||||
'=B1',
|
||||
'=B2',
|
||||
'=B3',
|
||||
'=B4',
|
||||
'=B5',
|
||||
'=B6',
|
||||
'=B7',
|
||||
'=B8',
|
||||
'=B9',
|
||||
'=BA',
|
||||
'=BB',
|
||||
'=BC',
|
||||
'=BD',
|
||||
'=BE',
|
||||
'=BF',
|
||||
'=C0',
|
||||
'=C1',
|
||||
'=C2',
|
||||
'=C3',
|
||||
'=C4',
|
||||
'=C5',
|
||||
'=C6',
|
||||
'=C7',
|
||||
'=C8',
|
||||
'=C9',
|
||||
'=CA',
|
||||
'=CB',
|
||||
'=CC',
|
||||
'=CD',
|
||||
'=CE',
|
||||
'=CF',
|
||||
'=D0',
|
||||
'=D1',
|
||||
'=D2',
|
||||
'=D3',
|
||||
'=D4',
|
||||
'=D5',
|
||||
'=D6',
|
||||
'=D7',
|
||||
'=D8',
|
||||
'=D9',
|
||||
'=DA',
|
||||
'=DB',
|
||||
'=DC',
|
||||
'=DD',
|
||||
'=DE',
|
||||
'=DF',
|
||||
'=E0',
|
||||
'=E1',
|
||||
'=E2',
|
||||
'=E3',
|
||||
'=E4',
|
||||
'=E5',
|
||||
'=E6',
|
||||
'=E7',
|
||||
'=E8',
|
||||
'=E9',
|
||||
'=EA',
|
||||
'=EB',
|
||||
'=EC',
|
||||
'=ED',
|
||||
'=EE',
|
||||
'=EF',
|
||||
'=F0',
|
||||
'=F1',
|
||||
'=F2',
|
||||
'=F3',
|
||||
'=F4',
|
||||
'=F5',
|
||||
'=F6',
|
||||
'=F7',
|
||||
'=F8',
|
||||
'=F9',
|
||||
'=FA',
|
||||
'=FB',
|
||||
'=FC',
|
||||
'=FD',
|
||||
'=FE',
|
||||
'=FF'
|
||||
);
|
||||
// are there "forbidden" characters in the string?
|
||||
for ($i = 0; $i < strlen($line) && ord($line[$i]) <= 127; $i ++);
|
||||
if ($i < strlen($line)) { // yes, there are. So lets encode them!
|
||||
|
@ -91,7 +308,8 @@ function quoted_printable_encode($line) {
|
|||
for ($to = strlen($line) - 1; ord($line[$to]) <= 127; $to --);
|
||||
// lets scan for the start and the end of the to be encoded _words_
|
||||
for (; $from > 0 && $line[$from] != ' '; $from --);
|
||||
if($from>0) $from++;
|
||||
if ($from > 0)
|
||||
$from ++;
|
||||
for (; $to < strlen($line) && $line[$to] != ' '; $to ++);
|
||||
// split the string into the to be encoded middle and the rest
|
||||
$begin = substr($line, 0, $from);
|
||||
|
@ -115,7 +333,8 @@ function quoted_printable_encode($line) {
|
|||
*
|
||||
* returns: a complete message-id
|
||||
*/
|
||||
function generate_msgid($identity) {
|
||||
function generate_msgid($identity)
|
||||
{
|
||||
global $CONFIG, $msgid_generate, $msgid_fqdn;
|
||||
switch ($msgid_generate) {
|
||||
case "no":
|
||||
|
@ -136,7 +355,8 @@ function generate_msgid($identity) {
|
|||
}
|
||||
}
|
||||
|
||||
function check_rate_limit($name,$set=0,$gettime=0) {
|
||||
function check_rate_limit($name, $set = 0, $gettime = 0)
|
||||
{
|
||||
global $CONFIG, $spooldir;
|
||||
if (strcasecmp($name, $CONFIG['anonusername']) == 0) {
|
||||
$name = session_id();
|
||||
|
@ -194,7 +414,8 @@ function check_rate_limit($name,$set=0,$gettime=0) {
|
|||
* $ref: The references of the article
|
||||
* $body: The article itself
|
||||
*/
|
||||
function message_post($subject,$from,$newsgroups,$ref,$body,$encryptthis=null,$encryptto=null,$authname=null,$followupto=null,$do_attach=null) {
|
||||
function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis = null, $encryptto = null, $authname = null, $followupto = null, $do_attach = null)
|
||||
{
|
||||
global $server, $port, $send_poster_host, $text_error, $CONFIG;
|
||||
global $www_charset, $config_dir, $spooldir;
|
||||
global $msgid_generate, $msgid_fqdn, $rslight_version;
|
||||
|
@ -232,6 +453,12 @@ function message_post($subject,$from,$newsgroups,$ref,$body,$encryptthis=null,$e
|
|||
}
|
||||
if ($do_attach) {
|
||||
move_uploaded_file($_FILES["photo"]["tmp_name"], $attachment_temp_dir . $_FILES["photo"]["name"]);
|
||||
if ($authname != null) {
|
||||
if (! is_dir($spooldir . '/upload/' . $authname)) {
|
||||
mkdir($spooldir . '/upload/' . $authname);
|
||||
}
|
||||
copy($attachment_temp_dir . $_FILES["photo"]["name"], $spooldir . '/upload/' . $authname . '/' . $_FILES["photo"]["name"]);
|
||||
}
|
||||
}
|
||||
$ns = nntp_open($server, $port);
|
||||
if ($ns != false) {
|
||||
|
@ -243,7 +470,6 @@ function message_post($subject,$from,$newsgroups,$ref,$body,$encryptthis=null,$e
|
|||
return $weg;
|
||||
}
|
||||
|
||||
|
||||
fputs($ns, 'Subject: ' . encode_subject($subject) . "\r\n");
|
||||
// For Synchronet use
|
||||
if (isset($fromname) && (isset($CONFIG['synchronet']) && ($CONFIG['synchronet'] == true))) {
|
||||
|
|
|
@ -37,13 +37,9 @@ $CONFIG = include ($config_file);
|
|||
@$abspeichern = $_REQUEST["abspeichern"];
|
||||
@$references = $_REQUEST["references"];
|
||||
@$id = $_REQUEST["id"];
|
||||
if (! isset($group))
|
||||
if (! isset($group) && isset($newsgroups)) {
|
||||
$group = $newsgroups;
|
||||
|
||||
include "auth.inc";
|
||||
if ($post_captcha)
|
||||
include "lib/captcha/captcha.php";
|
||||
|
||||
}
|
||||
// Save name in cookies
|
||||
if (($setcookies == true) && (isset($abspeichern)) && ($abspeichern == "ja")) {
|
||||
setcookie("cookie_name", stripslashes($name), time() + (3600 * 24 * 90), "/");
|
||||
|
@ -327,8 +323,8 @@ if ($show == 1) {
|
|||
name="<?php echo md5($fieldencrypt."subject")?>"
|
||||
value="<?php
|
||||
echo htmlspecialchars($subject);
|
||||
?>" size="40"
|
||||
maxlength="80"></td>
|
||||
?>"
|
||||
size="40" maxlength="80"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><b><?php echo $text_post["name"]?></b></td>
|
||||
|
@ -336,7 +332,7 @@ if ($show == 1) {
|
|||
<?php
|
||||
if (! isset($name) && $CONFIG['anonuser'])
|
||||
$name = $CONFIG['anonusername'];
|
||||
if ($form_noname === true) {
|
||||
if (isset($form_noname) && $form_noname === true) {
|
||||
echo htmlspecialchars($name);
|
||||
} else {
|
||||
echo '<input class="post" type="text" name="' . md5($fieldencrypt . "name") . '"';
|
||||
|
@ -398,9 +394,7 @@ if ($show == 1) {
|
|||
value="<?php
|
||||
if (isset($bodyzeile))
|
||||
echo htmlspecialchars(stripslashes($bodyzeile));
|
||||
?>">
|
||||
|
||||
<script language="JavaScript">
|
||||
?>"> <script language="JavaScript">
|
||||
<!--
|
||||
function quoten() {
|
||||
document.getElementById("postbody").value=document.getElementById("hidebody").value;
|
||||
|
|
Loading…
Reference in New Issue