Version 1.3.0
This commit is contained in:
1 parent
7ef3d1712a
commit
f87d29ba65
290 files changed
+50206
-17930
No files matched your search
@@ -1,94 +1,92 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Board v1.1
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001,2002 Invision Power Services
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Attachment Handler module
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 10th March 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
$idx = new attach;
|
||||
|
||||
class attach {
|
||||
|
||||
|
||||
function attach()
|
||||
{
|
||||
global $ibforums, $DB, $std, $print, $skin_universal;
|
||||
|
||||
$ibforums->input['id'] = preg_replace( "/^(\d+)$/", "\\1", $ibforums->input['id'] );
|
||||
|
||||
if ($ibforums->input['id'] == "")
|
||||
{
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
|
||||
if ($ibforums->input['type'] == 'post')
|
||||
{
|
||||
// Handle post attachments.
|
||||
|
||||
$DB->query("SELECT pid, attach_id, attach_type, attach_file FROM ibf_posts WHERE pid='".$ibforums->input['id']."'");
|
||||
|
||||
if ( !$DB->get_num_rows() )
|
||||
{
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
|
||||
$post = $DB->fetch_row();
|
||||
|
||||
if ( $post['attach_id'] == "" )
|
||||
{
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
|
||||
$file = $ibforums->vars['upload_dir']."/".$post['attach_id'];
|
||||
|
||||
if ( file_exists( $file ) and ( $post['attach_type'] != "" ) )
|
||||
{
|
||||
// Update the "hits"..
|
||||
|
||||
$DB->query("UPDATE ibf_posts SET attach_hits=attach_hits+1 WHERE pid='".$post['pid']."'");
|
||||
|
||||
// Set up the headers..
|
||||
|
||||
@header( "Content-Type: ".$post['attach_type']."\nContent-Disposition: inline; filename=\"".$post['attach_file']."\"\nContent-Length: ".(string)(filesize( $file ) ) );
|
||||
|
||||
// Open and display the file..
|
||||
|
||||
$fh = fopen( $file, 'rb' ); // Set binary for Win even if it's an ascii file, it won't hurt.
|
||||
fpassthru( $fh );
|
||||
@fclose( $fh );
|
||||
}
|
||||
else
|
||||
{
|
||||
// File does not exist..
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board v1.3 Final
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Time: Sun, 04 Jan 2004 00:30:16 GMT
|
||||
| Release: 28e7bfb25f08ac72a789cb1b172fa185
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Attachment Handler module
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 10th March 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
$idx = new attach;
|
||||
|
||||
class attach {
|
||||
|
||||
|
||||
function attach()
|
||||
{
|
||||
global $ibforums, $DB, $std, $print, $skin_universal;
|
||||
|
||||
$ibforums->input['id'] = preg_replace( "/^(\d+)$/", "\\1", $ibforums->input['id'] );
|
||||
|
||||
if ($ibforums->input['id'] == "")
|
||||
{
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
|
||||
if ($ibforums->input['type'] == 'post')
|
||||
{
|
||||
// Handle post attachments.
|
||||
|
||||
$DB->query("SELECT pid, attach_id, attach_type, attach_file FROM ibf_posts WHERE pid='".$ibforums->input['id']."'");
|
||||
|
||||
if ( !$DB->get_num_rows() )
|
||||
{
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
|
||||
$post = $DB->fetch_row();
|
||||
|
||||
if ( $post['attach_id'] == "" )
|
||||
{
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
|
||||
$file = $ibforums->vars['upload_dir']."/".$post['attach_id'];
|
||||
|
||||
if ( file_exists( $file ) and ( $post['attach_type'] != "" ) )
|
||||
{
|
||||
// Update the "hits"..
|
||||
|
||||
$DB->query("UPDATE ibf_posts SET attach_hits=attach_hits+1 WHERE pid='".$post['pid']."'");
|
||||
|
||||
// Set up the headers..
|
||||
|
||||
@header( "Content-Type: ".$post['attach_type']."\nContent-Disposition: inline; filename=\"".$post['attach_file']."\"\nContent-Length: ".(string)(filesize( $file ) ) );
|
||||
|
||||
// Open and display the file..
|
||||
|
||||
$fh = fopen( $file, 'rb' ); // Set binary for Win even if it's an ascii file, it won't hurt.
|
||||
fpassthru( $fh );
|
||||
@fclose( $fh );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
// File does not exist..
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user