############################################################## 
## MOD Title: Posting Upload Mod 
## MOD Author: ewelin < ewelin@muttdom.com > (Eric)  
## MOD Description: Full Album Pack Addon allows one to upload images
##									while posting a message and automatically enters
##									in the BBCode for the user.  
## MOD Version: 0.0.1 
## 
## Installation Level: Easy 
## Installation Time: 15 Minutes 
## Files To Edit: album_upload.php 
##								posting.php
##      					templates/subSilver/album_upload_body.tpl 
##								templates/subSilver/posting_body.tpl
##
## Included Files: N/A
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
############################################################## 
## For security purposes, please check: http://www.phpbb.com/mods/ 
## for the latest version of this MOD. Although MODs are checked 
## before being allowed in the MODs Database there is no guarantee 
## that there are no security problems within the MOD. No support 
## will be given for MODs not found within the MODs Database which 
## can be found at http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
############################################################## 
## MOD History: 
## 
##   2005/02/08 - Version 0.0.1 
##      - Initial Version 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ DIY INSTRUCTIONS ]------------------------------------------ 
#
Add the following line of code to your posting_body.tpl file wherever you think it fits best

<a href="javascript:void(0);" onclick="window.open('{L_POSTING_UPLOAD}', '_imageupload', 'resizable=yes,width=800,height=450');return false;">Upload to our Photo Album</a>
# 
#-----[ OPEN ]------------------------------------------ 
# 
album_upload.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
if( isset($HTTP_POST_VARS['user_id']) )
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod
if( isset($HTTP_POST_VARS['mode']) )
{
	$mode = intval($HTTP_POST_VARS['mode']);
}
elseif( isset($HTTP_GET_VARS['mode']) )
{
	$mode = intval($HTTP_GET_VARS['mode']);
}
// End ewelin Posting Upload Mod
# 
#-----[ FIND ]------------------------------------------ 
# 
else
{
	message_die(GENERAL_ERROR, 'No categories specified');
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod
elseif ( $mode == 'forum_upload' )
{
	$cat_id = album_get_personal_root_id($album_user_id);
}
// End ewelin Posting Upload Mod
# 
#-----[ FIND ]------------------------------------------ 
# 
	//
	// Start output of page
	//
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod	
if ($mode == 'forum_upload')
	$gen_simple_header = true;
// end ewelin Posting Upload Mod	

# 
#-----[ FIND ]------------------------------------------ 
# 
		$album_config['max_files_to_upload'] = 1;
	}
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start ewelin Posting Upload Mod
	$album_action = append_sid(album_append_uid("album_upload.$phpEx?cat_id=$cat_id"));
if ($mode == 'forum_upload') // use the 2nd line not the first!!! 
	$album_action .= '&mode=forum_upload';	
// End ewelin Posting Upload Mod
# 
#-----[ FIND ]------------------------------------------ 
#
		'S_ALBUM_ACTION' => append_sid(album_append_uid("album_upload.$phpEx?cat_id=$cat_id")),
# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
		'S_ALBUM_ACTION' => $album_action,
# 
#-----[ FIND ]------------------------------------------ 
#
	if ($album_config['pregenerate_fields'] == 1)
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod
	if ($mode != 'forum_upload')
	{
		$template->assign_block_vars('posting_upload_hidden', array());
	}
// End ewelin Posting Upload Mod
# 
#-----[ FIND ]------------------------------------------ 
#
		$template->assign_vars(array(
			'S_ALBUM_ACTION' => $uploader,	
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod
		if ($mode == 'forum_upload')
			$uploader .= '&mode=forum_upload';
// End ewelin Posting Upload Mod

# 
#-----[ FIND ]------------------------------------------ 
#
	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod	
	if ($mode == 'forum_upload')
		$gen_simple_footer = true;
// End ewelin Posting Upload Mod
# 
#-----[ FIND ]------------------------------------------ 
#
	for($index = 0; $index < count($upload_files['name']);$index++)
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
//  Start ewelin Posting Upload Mod 
	($mode == 'forum_upload') ? $bbcode_output = "" : '';
//  End ewelin Posting Upload Mod 
# 
#-----[ FIND ]------------------------------------------ 
#
		if ($album_config['email_notification'])
# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
		if ($album_config['email_notification'] || $mode == 'forum_upload')
# 
#-----[ FIND ]------------------------------------------ 
#
			include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
//  Start ewelin Posting Upload Mod 
			($mode == 'forum_upload') ? $bbcode_output .= "\\n[albumimg]" . $new_pic_id['pic_id'] . "[/albumimg]" : '';
			if ($album_config['email_notification'])
			{
//  End ewelin Posting Upload Mod 
# 
#-----[ FIND ]------------------------------------------ 
#
			}
		// Mighty Gorgon - Send email to admin for notification/approval - END
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
//  Start ewelin Posting Upload Mod 
			}
//  End ewelin Posting Upload Mod 
# 
#-----[ FIND ]------------------------------------------ 
#
	if ($thiscat['cat_approval'] == 0 && count($upload_errors) == 0)
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod
	if ($mode == 'forum_upload')
	{
		$message .= "<script language=\"javascript\" type=\"text/javascript\">\n";
		$message .= "<!--\n";
		$message .= "function add_code()\n";
		$message .= "{\n";
		$message .= "	var text = '" . $bbcode_output . "'\n";
		$message .= "	opener.document.forms['post'].message.value = opener.document.forms['post'].message.value + text;\n";
		$message .= "	opener.focus();\n";
		$message .= "	window.close();\n";
		$message .= "}\n";
		$message .= "add_code();\n";
		$message .= "//-->\n";
		$message .= "</script>\n";
	}
	else
	{
// End ewelin Posting Upload Mod
# 
#-----[ FIND ]------------------------------------------ 
#
	if ($album_config['switch_nuffload'] == 1)
# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod
	}
// End ewelin Posting Upload Mod
	if ($album_config['switch_nuffload'] == 1 && $mode != 'forum_upload')
# 
#-----[ OPEN ]------------------------------------------ 
# 
posting.php 
# 
#-----[ FIND ]------------------------------------------ 
#
	'L_OPTIONS' => $lang['Options'],
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
// Start ewelin Posting Upload Mod
	'L_POSTING_UPLOAD' => append_sid("album_upload.$phpEx?user_id=" . $userdata['user_id'] ."&mode=forum_upload"),
// End ewelin Posting Upload Mod
# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/album_upload_body.tpl
# 
#-----[ FIND ]------------------------------------------ 
#
<table width="98%" align="center" cellspacing="1" cellpadding="2" border="0">
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
<!-- BEGIN posting_upload_hidden -->
# 
#-----[ FIND ]------------------------------------------ 
# this is the end of the table started above for navigation
</table>
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
<!-- END posting_upload_hidden -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM