Attachment Mod

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
2035
71%
Very Good
444
16%
Good
175
6%
Fair
54
2%
Poor
156
5%
 
Total votes: 2864

abhishek1711
Registered User
Posts: 528
Joined: Tue Apr 17, 2007 6:08 am
Location: India
Contact:

Re: Attachment Mod

Post by abhishek1711 »

okie changed the download mode to "INLINE"

still the pictures are attached as files...and dont showup on the posts as Pics...i remember when i had got the mod installed , pics were visible...after that maybe some settings were changed...am doing as u said , anything else i can try?
Cp299
Registered User
Posts: 99
Joined: Thu Jul 17, 2003 12:21 am

Re: Attachment Mod

Post by Cp299 »

Still need to know how to get the drop down box to stay at "Not Assigned" by default (or whatever is chosen for that user). When I edit an account, it automatically sits on "Standard", thus changing their default when I save the account again. It's really annoying!
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17323
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: Attachment Mod

Post by DavidIQ »

abhishek1711 wrote:okie changed the download mode to "INLINE"

still the pictures are attached as files...and dont showup on the posts as Pics...i remember when i had got the mod installed , pics were visible...after that maybe some settings were changed...am doing as u said , anything else i can try?
How big is the image? In that screenshot you posted there is a setting titled Image Link Dimensions. If the dimension requirements are met then the picture will be shown as a link instead of the actual picture.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17323
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: Attachment Mod

Post by DavidIQ »

Cp299 wrote:Still need to know how to get the drop down box to stay at "Not Assigned" by default (or whatever is chosen for that user). When I edit an account, it automatically sits on "Standard", thus changing their default when I save the account again. It's really annoying!
Do they belong to a usergroup that has Standard as the default? Mine goes to Not Assigned by default.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
abhishek1711
Registered User
Posts: 528
Joined: Tue Apr 17, 2007 6:08 am
Location: India
Contact:

Re: Attachment Mod

Post by abhishek1711 »

DavidIQ wrote:
abhishek1711 wrote:okie changed the download mode to "INLINE"

still the pictures are attached as files...and dont showup on the posts as Pics...i remember when i had got the mod installed , pics were visible...after that maybe some settings were changed...am doing as u said , anything else i can try?
How big is the image? In that screenshot you posted there is a setting titled Image Link Dimensions. If the dimension requirements are met then the picture will be shown as a link instead of the actual picture.

nopes i changed it to 0 , which means no restrictions...still images are attached as files and not as pictures on the post
gfaSkyRanger
Registered User
Posts: 3
Joined: Wed Dec 06, 2006 10:19 pm
Contact:

Re: Attachment Mod

Post by gfaSkyRanger »

Is it possible, to connect this mod with the Cash-Mod ?

As an Example:
user A uploaded a File, sets 20 Points for the download.
user B wants to download the file from user A and has to pay 20 Points to user A for the Download.
User A gains 20 Points from user B for the download.

if User C wants to download the file from User A he even has to pay 20 Points, but he hasnt 20 Points.
so he cant download this File.
habanerolexi
Registered User
Posts: 4
Joined: Wed Aug 08, 2007 8:53 am

Re: Attachment Mod

Post by habanerolexi »

I can not upload larger Files. I always get the error message "No post mode specified". I configured php.ini and the upload_max_filesize is set to 50M.
But it seems that I can not upload any files larger than 8mb.
What could be the Problem?
gfaSkyRanger
Registered User
Posts: 3
Joined: Wed Dec 06, 2006 10:19 pm
Contact:

Re: Attachment Mod

Post by gfaSkyRanger »

then look for an entry in ur php.ini for 8M and change it.

i've changed all to 128M ...
User avatar
TeMa4
Registered User
Posts: 4
Joined: Fri Aug 10, 2007 12:43 am

Re: Attachment Mod

Post by TeMa4 »

Please help with my problem.

Attachement moves text to the right, and next msg is moved to the right colomn as well.

Image
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52112
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Attachment Mod

Post by Brf »

TeMa4 wrote:Please help with my problem.

Attachement moves text to the right, and next msg is moved to the right colomn as well.
That means you have done the edit to viewtopic_body.tpl incorrectly.
Skyline72
Registered User
Posts: 4
Joined: Mon Aug 13, 2007 3:33 pm

Re: Attachment Mod

Post by Skyline72 »

Hi,
I succesful installed this mod in my phpbb v2.0.22 and i can see all the related menu in the admin cp but I have an issue with the board, infact I'm not able to post any new thread nor modify older posts. When I try to do that there's only an empty screen and anything is loaded. Plus I didn't receive any kind of error messages so I don't know how to fix this issue.
Any ideas would be really appreciated :)

Thank you

Skyline
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17323
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: Attachment Mod

Post by DavidIQ »

Skyline72 wrote:Hi,
I succesful installed this mod in my phpbb v2.0.22 and i can see all the related menu in the admin cp but I have an issue with the board, infact I'm not able to post any new thread nor modify older posts. When I try to do that there's only an empty screen and anything is loaded. Plus I didn't receive any kind of error messages so I don't know how to fix this issue.
Any ideas would be really appreciated :)

Thank you

Skyline
Did you actually modify any files as outlined in docs/install.txt?
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
Skyline72
Registered User
Posts: 4
Joined: Mon Aug 13, 2007 3:33 pm

Re: Attachment Mod

Post by Skyline72 »

DavidIQ wrote: Did you actually modify any files as outlined in docs/install.txt?
Thx DavidIQ for your prompt reply ;)
Yes I installed and modified all files as described in install.txt.
Anyway just few minutes ago I fixed that issue since there was an error in the posting.php file and now I'm able again to post/edit in my forum but ... I get another problem :mrgreen: Now I'm not able to see the attachment mod working , this is what i can see when I insert a new thread... http://img68.imageshack.us/img68/1226/phpbb2rn4.jpg
Zrob
Registered User
Posts: 214
Joined: Sat Dec 30, 2006 2:27 am

How do I make db/directory writeable for attachments?

Post by Zrob »

Hello, I have just finished half of the installation for the attachment mod and I have one thing to do. After I ran the install.php that creates the tables in the data base, it said directory not writable how do I change this? other that that so far so good.

Thanks for any info :!:
Fred_Spider
Registered User
Posts: 19
Joined: Fri Dec 03, 2004 3:17 am

Bandwith problem

Post by Fred_Spider »

Someone help me please:
The file, in my server, that have more KBytes transferred is download.php. OK, that's normal for a site with many downloads. But checking more precisely i've realized that something is wrong with this file: I've compared the Kbytes transfered of this file with the portal.php file and check this out:

:arrow: download.php:
File size: 11.0Kb
Hits: 21.220
KBytes transferred: 3.685.270 Kb

:arrow: portal.php
File size: 19.2Kb
Hits: 30.785
KBytes transferred: 1.094.704 Kb

Isn't strange the fact that portal.php have a large size, more hits and transferred (much) less KBytes than download.php? What's heappening with my download.php file? My server is reaching the limit every month because of this! :cry:

But i will confess: I've made some changes at download.php file but I don't know if this changes have affected somehow the way the file works! If someone could please take a look at the file to check any problems I will be VERY VERY greatful!Thanks!

PS: My files are NOT at the same server the attachment MOD is installed!

Code: Select all

<?php
/** 
*
* @package attachment_mod
* @version $Id: download.php,v 1.6 2006/09/04 12:56:06 acydburn Exp $
* @copyright (c) 2002 Meik Sievertsen
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
*/
if (defined('IN_PHPBB'))
{
	die('Hacking attempt');
	exit;
}

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);

//
// Delete the / * to uncomment the block, and edit the values (read the comments) to
// enable additional security to your board (preventing third site linkage)
//
/*
define('ALLOWED_DENIED', 0);
define('DENIED_ALLOWED', 1);

//
// From this line on you are able to edit the stuff
//

// Possible Values:
// ALLOWED_DENIED <- First allow the listed sites, and then deny all others
// DENIED_ALLOWED <- First deny the listed sites, and then allow all others
$allow_deny_order = ALLOWED_DENIED;

//
// Allowed Syntax:
// Full Domain Name -> www.opentools.de
// Partial Domain Names -> opentools.de
//
$sites = array(
	$board_config['server_name'],	// This is your domain
	'opentools.de',
	'phpbb.com',
	'phpbbhacks.com',
	'phpbb.de'
);

// This is the message displayed, if someone links to this site...
$lang['Denied_Message'] = 'You are not authorized to view, download or link to this Site.';

// End of editable area

//
// Parse the order and evaluate the array
//

$site = explode('?', $HTTP_SERVER_VARS['HTTP_REFERER']);
$url = trim($site[0]);
//$url = $HTTP_HOST;

if ($url != '')
{
	$allowed = ($allow_deny_order == ALLOWED_DENIED) ? FALSE : TRUE;
	
	for ($i = 0; $i < count($sites); $i++)
	{
		if (strstr($url, $sites[$i]))
		{
			$allowed = ($allow_deny_order == ALLOWED_DENIED) ? TRUE : FALSE;
			break;
		}
	}
}
else
{
	$allowed = TRUE;
}

if ($allowed == FALSE)
{
	message_die(GENERAL_MESSAGE, $lang['Denied_Message']);
}

// Delete the following line, to uncomment this block
*/

$download_id = get_var('id', 0);
$thumbnail = get_var('thumb', 0);

// Send file to browser
function send_file_to_browser($attachment, $upload_dir)
{
	global $HTTP_USER_AGENT, $HTTP_SERVER_VARS, $lang, $db, $attach_config;

	$filename = ($upload_dir == '') ? $attachment['physical_filename'] : $upload_dir . '/' . $attachment['physical_filename'];

	$gotit = false;
	
	if (@!file_exists(@amod_realpath($filename)))
		{
			$filename = ($upload_dir == '') ? $attachment['physical_filename'] : trim($attach_config['download_path']) . '/' . $attachment['physical_filename'];
			$gotit = false;
		}
		else
		{
		$gotit = true;
		}

	//
	// Determine the Browser the User is using, because of some nasty incompatibilities.
	// Most of the methods used in this function are from phpMyAdmin. :)
	//
	if (!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) 
	{
		$HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
	}
	else if (!isset($HTTP_USER_AGENT))
	{
		$HTTP_USER_AGENT = '';
	}

	if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) 
	{
		$browser_version = $log_version[2];
		$browser_agent = 'opera';
	} 
	else if (ereg('MSIE ([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) 
	{
		$browser_version = $log_version[1];
		$browser_agent = 'ie';
	} 
	else if (ereg('OmniWeb/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) 
	{
		$browser_version = $log_version[1];
		$browser_agent = 'omniweb';
	} 
	else if (ereg('Netscape([0-9]{1})', $HTTP_USER_AGENT, $log_version)) 
	{
		$browser_version = $log_version[1];
		$browser_agent = 'netscape';
	} 
	else if (ereg('Mozilla/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) 
	{
		$browser_version = $log_version[1];
		$browser_agent = 'mozilla';
	} 
	else if (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) 
	{
		$browser_version = $log_version[1];
		$browser_agent = 'konqueror';
	} 
	else 
	{
		$browser_version = 0;
		$browser_agent = 'other';
	}

	// Correct the mime type - we force application/octetstream for all files, except images
	// Please do not change this, it is a security precaution
	if (!strstr($attachment['mimetype'], 'image'))
	{
		$attachment['mimetype'] = ($browser_agent == 'ie' || $browser_agent == 'opera') ? 'application/octetstream' : 'application/octet-stream';
	}

	// Now the tricky part... let's dance
//	@ob_end_clean();
//	@ini_set('zlib.output_compression', 'Off');
	header('Pragma: public');
//	header('Content-Transfer-Encoding: none');

	$real_filename = html_entity_decode(basename($attachment['real_filename']));

	// Send out the Headers
	header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $real_filename . '"');
	header('Content-Disposition: attachment; filename="' . $real_filename . '"');

	unset($real_filename);
	
	//
	// Now send the File Contents to the Browser
	//
	if ($gotit)
	{
		$sql = 'SELECT filesize
		FROM ' . ATTACHMENTS_DESC_TABLE . "
		WHERE attach_id IN ($attach_ids)";
		
    	$size = html_entity_decode(basename($attachment['filesize']));
		if ($size)
		{
			header("Content-length: $size");
		}
		readfile($filename);
	}
	else if (!$gotit)
	{
		$size = html_entity_decode(basename($attachment['filesize']));
		if ($size)
		{
			header("Content-length: $size");
		}
		readfile($filename);
	}
	

	exit;
}

//
// End Functions
//

//
// Start Session Management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

if (!$download_id)
{
	message_die(GENERAL_ERROR, $lang['No_attachment_selected']);
}

if ($attach_config['disable_mod'] && $userdata['user_level'] != ADMIN)
{
	message_die(GENERAL_MESSAGE, $lang['Attachment_feature_disabled']);
}
	
$sql = 'SELECT *
	FROM ' . ATTACHMENTS_DESC_TABLE . '
	WHERE attach_id = ' . (int) $download_id;

if (!($result = $db->sql_query($sql)))
{
	message_die(GENERAL_ERROR, 'Could not query attachment informations', '', __LINE__, __FILE__, $sql);
}

if (!($attachment = $db->sql_fetchrow($result)))
{
	message_die(GENERAL_MESSAGE, $lang['Error_no_attachment']);
}

$attachment['physical_filename'] = basename($attachment['physical_filename']);

$db->sql_freeresult($result);

// get forum_id for attachment authorization or private message authorization
$authorised = false;

$sql = 'SELECT *
	FROM ' . ATTACHMENTS_TABLE . '
	WHERE attach_id = ' . (int) $attachment['attach_id'];

if (!($result = $db->sql_query($sql)))
{
	message_die(GENERAL_ERROR, 'Could not query attachment informations', '', __LINE__, __FILE__, $sql);
}

$auth_pages = $db->sql_fetchrowset($result);
$num_auth_pages = $db->sql_numrows($result);

for ($i = 0; $i < $num_auth_pages && $authorised == false; $i++)
{
	$auth_pages[$i]['post_id'] = intval($auth_pages[$i]['post_id']);

	if ($auth_pages[$i]['post_id'] != 0)
	{
		$sql = 'SELECT forum_id
			FROM ' . POSTS_TABLE . '
			WHERE post_id = ' . (int) $auth_pages[$i]['post_id'];

		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not query post information', '', __LINE__, __FILE__, $sql);
		}

		$row = $db->sql_fetchrow($result);

		$forum_id = $row['forum_id'];

		$is_auth = array();
		$is_auth = auth(AUTH_ALL, $forum_id, $userdata); 

		if ($is_auth['auth_download'])
		{
			$authorised = TRUE;
		}
	}
	else
	{
		if ( (intval($attach_config['allow_pm_attach'])) && ( ($userdata['user_id'] == $auth_pages[$i]['user_id_2']) || ($userdata['user_id'] == $auth_pages[$i]['user_id_1']) ) || ($userdata['user_level'] == ADMIN) )
		{
			$authorised = TRUE;
		}
	}
}


if (!$authorised)
{
	message_die(GENERAL_MESSAGE, $lang['Sorry_auth_view_attach']);
}

//
// Get Information on currently allowed Extensions
//
$sql = "SELECT e.extension, g.download_mode
	FROM " . EXTENSION_GROUPS_TABLE . " g, " . EXTENSIONS_TABLE . " e
	WHERE (g.allow_group = 1) AND (g.group_id = e.group_id)";

if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query Allowed Extensions.', '', __LINE__, __FILE__, $sql);
}

$rows = $db->sql_fetchrowset($result);
$num_rows = $db->sql_numrows($result);

for ($i = 0; $i < $num_rows; $i++)
{
	$extension = strtolower(trim($rows[$i]['extension']));
	$allowed_extensions[] = $extension;
	$download_mode[$extension] = $rows[$i]['download_mode'];
}

// disallowed ?
if (!in_array($attachment['extension'], $allowed_extensions) && $userdata['user_level'] != ADMIN)
{
	message_die(GENERAL_MESSAGE, sprintf($lang['Extension_disabled_after_posting'], $attachment['extension']));
} 

$download_mode = intval($download_mode[$attachment['extension']]);

if ($thumbnail)
{
	$attachment['physical_filename'] = THUMB_DIR . '/t_' . $attachment['physical_filename'];
}

// Update download count
if (!$thumbnail)
{
	$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' 
	SET download_count = download_count + 1 
	WHERE attach_id = ' . (int) $attachment['attach_id'];
	
	if (!$db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, 'Couldn\'t update attachment download count', '', __LINE__, __FILE__, $sql);
	}
}

// Determine the 'presenting'-method
if ($download_mode == PHYSICAL_LINK)
{
	$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
	$server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['server_name']));
	$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
	$script_name = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($board_config['script_path']));

	if ($script_name[strlen($script_name)] != '/')
	{
		$script_name .= '/';
	}

	if (intval($attach_config['allow_ftp_upload']))
	{
		if (trim($attach_config['download_path']) == '')
		{
			message_die(GENERAL_ERROR, 'Physical Download not possible with the current Attachment Setting');
		}
		
		$url = trim($attach_config['download_path']) . '/' . $attachment['physical_filename'];
		$redirect_path = $url;
	}
	else
	{
		$url = $upload_dir . '/' . $attachment['physical_filename'];
//		$url = preg_replace('/^\/?(.*?\/)?$/', '\1', trim($url));
		$redirect_path = $server_protocol . $server_name . $server_port . $script_name . $url;
	}

	// Redirect via an HTML form for PITA webservers
	if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
	{
		header('Refresh: 0; URL=' . $redirect_path);
		echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $redirect_path . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $redirect_path . '">HERE</a> to be redirected</div></body></html>';
		exit;
	}

	// Behave as per HTTP/1.1 spec for others
	header('Location: ' . $redirect_path);
	exit;
}
else
{
	if (intval($attach_config['allow_ftp_upload']))
	{
		// We do not need a download path, we are not downloading physically
		send_file_to_browser($attachment, '');
		exit;
	}
	else
	{
		send_file_to_browser($attachment, $upload_dir);
		exit;
	}
}

?>
Post Reply

Return to “[2.0.x] MOD Database Releases”