Location: PHPKode > scripts > PHPBB Donation MOD with Paypal IPN > install_PayPal_IPN_Donation_MOD-v1.0.4.6/root/lwdonate.php
<?php
/***************************************************************************
 *				lwdonate.php
 *							
 *	begin				: 14/SEP/2004
 *	copyright			: Zou Xiong - Loewen Enterprise
 *	email				: hide@address.com
 *
 *	version				: 1.0.0.1 - 23/OCT/2004
 *
 ***************************************************************************/
/***************************************************************************
## Terms of Use 
## 
## All of my MODifications are to use and edit/change for phpBB End Users 
## 
## Plese DO NOT remove any copyright/licence declaration when using the MODification 
## 
## I will remain as the sole developer for all my MODifications unless stated otherwise
## 
## 
## Distribution Terms 
## 
## All of my MODifications are prohibited to distribute to others without the permission from me.
## 
## Plese DO NOT remove any copyright/licence declaration when using the MODification 
## 
## I will remain as the sole developer for all my MODifications unless stated otherwise
## 
## Re-Distribution Terms 
## 
## If you are distributing WHOLE or PART of my MOD in your MOD Projects or Pre-modded Projects or any other means, you must: 
## 
## Get the formal authorization from me first.
## 
## Plese DO NOT remove any copyright/licence declaration when using the MODification 
## 
## I will remain as the sole developer for all my MODification unless stated otherwise. Do NOT declare youself as my co-developer 
## 
## Re-Distribution Terms DOES NOT apply to MOD authors that developing Add-Ons to my MOD. You will be the Add-Ons' Developer/Author
##
***************************************************************************/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

// Initial var setup

/**
* @todo normalize?
*/
if(strlen($config['paypal_b_acct']) <=0 
	|| strlen($config['paypal_p_acct']) <=0 )
{
	//trigger_error($user->lang['LW_PAYPAL_ACCT_ERROR']);
	trigger_error('The paypal account has not been setup yet.');
	exit;
}

//get necessary page header inforamtion first.
page_header('Donation');


$currencydisplay = '';
$currencyoptions = '';
if(strlen($config['donate_currencies']) < 4)
{
	$config['donate_currencies'] = $config['paypal_currency_code'] . ";";
}
$currencyoptions = '<select name="currency_code" >';

$board_currencies = array();
$board_currencies = split("[;,]", $config['donate_currencies']);
for($i = 0; $i < count($board_currencies); $i++)
{
	if(strlen(trim($board_currencies[$i])) > 0)
	{
		$selected = '';
		if(strcasecmp(trim($config['paypal_currency_code']), trim($board_currencies[$i])) == 0)
		{
			$selected = 'selected';
		}
		$currencyoptions .= ('<option value="' . trim($board_currencies[$i]) . '" ' . $selected . '>' . lw_DM_display_currency_type_V3(trim($board_currencies[$i])) . '</option>');		
	}
}
$currencyoptions .= '</select>';

$methodoptions = '<select name="payment_method" >';
$payment_methods = array($user->lang['One_time_donation'], 
                         $user->lang['Recurring_one_week'],
                         $user->lang['Recurring_one_month'],
                         $user->lang['Recurring_three_month'],
                         $user->lang['Recurring_six_month'],
                         $user->lang['Recurring_one_year'],
                         );
for($i = 0; $i < count($payment_methods); $i++)
{
	if(strlen(trim($payment_methods[$i])) > 0)
	{
		$methodoptions .= ('<option value="' . $i . '">' . $payment_methods[$i] . '</option>');		
	}
}
$methodoptions .= '</select>';

//Get the donation explanation post
$message = $user->lang['LW_AMOUNT_TO_DONATE_EXPLAIN'];
$row = false;

if( $config['lw_dm_explanation_postid'] != null 
		&& strlen(trim($config['lw_dm_explanation_postid'])) > 0
		&& intval($config['lw_dm_explanation_postid']) > 0)
{
	$sql = $db->sql_build_query('SELECT', array(
		'SELECT'	=> 'p.*',
	
		'FROM'		=> array(
			POSTS_TABLE		=> 'p',
		),
	
		'WHERE'		=> 'p.post_id = ' . intval($config['lw_dm_explanation_postid']),
	));
	
	$result = $db->sql_query($sql);
	
	$row = $db->sql_fetchrow($result);
}

if( $row )
{
	// Parse the message and subject
	$message = censor_text($row['post_text']);

	// Define the global bbcode bitfield, will be used to load bbcodes
	$bbcode_bitfield = base64_decode($row['bbcode_bitfield']);	
	if ($bbcode_bitfield !== '')
	{
		$bbcode = new bbcode(base64_encode($bbcode_bitfield));
		$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
	}

	$message = bbcode_nl2br($message);
	$message = smiley_text($message);
	
	
}

$template->assign_vars(array(
		'SITENAME'						=> $config['sitename'],
		'SITE_DESCRIPTION'				=> $config['site_desc'],
		'U_INDEX'		=> append_sid("{$phpbb_root_path}index.".$phpEx),
		'L_INDEX'			=> $user->lang['FORUM_INDEX'],
		'S_LW_TOPUP'		=> append_sid("{$phpbb_root_path}lwdonate.".$phpEx),
		'L_LW_TOPUP'		=> $user->lang['LW_ACCT_DONATE_INTO'],
		'LW_PAYPAL_ACTION'	=> append_sid("{$phpbb_root_path}lwdonateconfirm.".$phpEx),	
		'L_LW_TOPUP_TITLE'	=> $user->lang['LW_DONATE_TITLE'], 	
		'L_LW_AMOUNT_TO_PAY'	=> $user->lang['LW_AMOUNT_TO_DONATE'], 	
		'L_LW_AMOUNT_TO_PAY_EXPLAIN' => $user->lang['LW_AMOUNT_TO_DONATE_EXPLAIN'],
		'L_LW_CURRENCY_TO_PAY'	=> $user->lang['LW_CURRENCY_TO_PAY'],
		'L_LW_CURRENCY_TO_PAY_EXPLAIN' => sprintf($user->lang['LW_CURRENCY_TO_PAY_EXPLAIN'], $config['donate_currencies']),
		'LW_WANT_ANONYMOUS' => $user->lang['LW_WANT_ANONYMOUS'],
		'L_LW_DONATE_WAY' => $user->lang['L_LW_DONATE_WAY'],
		'LW_DONATE_METHOD_EXPLAIN' => $user->lang['LW_DONATE_METHOD_EXPLAIN'],
		'L_LW_DONATE_METHOD' => $user->lang['L_LW_DONATE_METHOD'],
		'LW_DONATE_METHOD_OPTIONS' => $methodoptions,
		'LW_CURRENCY_OPTIONS' => $currencyoptions,
		'L_LW_DONATE_EXPLANATION' => $user->lang['LW_DONATE_EXPLANATION'],
		'L_LW_DONATE_EXPLANATION_TEXT' => $message,
		)
	);
	
// Output the page
$template->set_filenames(array(
	'body' => 'lwdonate_body.html')
);

page_footer();

?>


Return current item: PHPBB Donation MOD with Paypal IPN