Some code cleanup, including fixing attachments display.

This commit is contained in:
Retro_Guy 2024-03-01 20:03:16 -07:00
parent 7b234ebc82
commit fd5ce4f804
5 changed files with 22 additions and 41 deletions

View File

@ -1,22 +1,21 @@
<?php
header("Expires: ".gmdate("D, d M Y H:i:s",time()+(3600*24))." GMT");
header("Expires: ".gmdate("D, d M Y H:i:s",time()-(3600*24))." GMT");
//header("Expires: ".gmdate("D, d M Y H:i:s",time()+(3600*24))." GMT");
$group=$_REQUEST["group"];
$id=$_REQUEST["id"];
$attachment=$_REQUEST["attachment"];
include "config.inc.php";
include "auth.inc";
require("$file_newsportal");
if (!isset($attachment))
$attachment=0;
$message=message_read($id,$attachment,$group);
//print_r($message->header);
ob_clean();
if (!$message) {
header ("HTTP/1.0 404 Not Found");
echo "The Attachment doesn't exists";
} else {
header("Content-Disposition: inline; filename=".
$message->header->content_type_name[$attachment]);
header("Content-Disposition: inline; filename=" . $message->header->content_type_name[$attachment]);
header("Content-type: ".$message->header->content_type[$attachment]);
message_show("",$id,$attachment,$message);
}
?>
}

View File

@ -252,5 +252,4 @@ if ((isset($group)) && (isset($group_config))) {
// load the english language definitions first because some of the other
// definitions are incomplete
include ("lang/english.lang");
include ($file_language);
?>
include ($file_language);

View File

@ -24,18 +24,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
?>
<script>
function CopyToClipboard(id)
{
var r = document.createRange();
r.selectNode(document.getElementById(id));
window.getSelection().removeAllRanges();
window.getSelection().addRange(r);
document.execCommand('copy');
window.getSelection().removeAllRanges();
}
</script>
<?php
@ -530,18 +518,18 @@ function show_header_short($head, $group, $local_poster = false)
echo '<div class=np_ob_posted_date>';
// Copy MID to clipboard (requires js)
echo '<script>';
echo 'function CopyToClipboard(id)';
echo '{';
echo 'var r = document.createRange();';
echo 'r.selectNode(document.getElementById(id));';
echo 'window.getSelection().removeAllRanges();';
echo 'window.getSelection().addRange(r);';
echo "document.execCommand('copy');";
echo 'window.getSelection().removeAllRanges();';
echo '}';
echo '</script> ';
?>
<script>
function CopyToClipboard(id)
{
var r = document.createRange();
r.selectNode(document.getElementById(id));
window.getSelection().removeAllRanges();
window.getSelection().addRange(r);
document.execCommand('copy');
window.getSelection().removeAllRanges();
}
</script>
<p id="<?php echo $head->id; ?>" style="position: absolute; z-index: -9999;"><?php echo htmlspecialchars($head->id); ?></p>
&nbsp;<a href="#" onclick="CopyToClipboard('<?php echo $head->id; ?>');return false;" style="text-decoration: none" title="Copy message-id to clipboard"><i>copy mid</i></a>
<?php
@ -971,4 +959,4 @@ function articleflat_pageselect($group, $id, $article_count, $first)
$return .= '</span>';
}
return $return;
}
}

View File

@ -2392,4 +2392,4 @@ function delete_message_from_overboard($config_name, $group, $messageid)
file_put_contents($cachefile, serialize($cached_overboard));
}
}
}
}

View File

@ -9,17 +9,13 @@ if (isset($_COOKIE['tzo'])) {
} else {
$offset = $CONFIG['timezone'];
}
if ((isset($_REQUEST['command']) && $_REQUEST['command'] == 'Show') && password_verify($CONFIG['thissitekey'], $_REQUEST['key'])) {
$getfilename = $spooldir . '/upload/' . $_REQUEST['showfile'];
$getfh = fopen($getfilename, "rb");
$getfile = fread($getfh, filesize($getfilename));
fclose($getfh);
ob_clean();
header('Content-type: ' . $_REQUEST['contenttype']);
header('Content-disposition: filename="' . $_REQUEST['showfilename'] . '"');
file_put_contents($logfile, "\n" . format_log_date() . " Requesting: " . $_REQUEST['showfile'], FILE_APPEND);
echo file_get_contents($getfilename);
//echo $getfile;
readfile($getfilename);
exit(0);
}
$title .= ' - Browse files';
@ -140,5 +136,4 @@ function display_user_files($user, $offset)
$i ++;
}
echo '</table>';
}
?>
}