Very simple Paypal Donations page. So simple that it's more effort to document it here than it was to make it
paypal.php
Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: paypal.php 0006 13:23 08/08/2008 kenny $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @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);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/paypal');
$mode = request_var('mode', '');
$sitename = $config['sitename'];
// Load the appropriate paypal file
switch ($mode)
{
case 'success':
$l_title = 'DONATION_SUCCESSFULL';
$template->set_filenames(array(
'body' => 'paypal/success_body.html')
);
break;
case 'cancel':
$l_title = 'DONATION_CANCELLED';
$template->set_filenames(array(
'body' => 'paypal/cancel_body.html')
);
break;
default:
$l_title = sprintf($user->lang['DONATION'], $sitename);
$template->set_filenames(array(
'body' => 'paypal/paypal_body.html')
);
break;
}
// Lets build a page ...
$template->assign_vars(array(
'L_DONATION' => sprintf($user->lang['DONATION'], $sitename),
'L_FAQ_TITLE' => $l_title,
'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP'],
'L_PAGE_CANCELLED' => sprintf($user->lang['PAGE_CANCELLED'], $sitename),
'L_PAGE_DONATION' => sprintf($user->lang['PAGE_DONATION'], $sitename),
'L_PAGE_SUCCESSFULL' => sprintf($user->lang['PAGE_SUCCESSFULL'], $sitename))
);
page_header($l_title);
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>
language/en/paypal.php
Code: Select all
<?php
/**
*
* paypal [English]
*
* @package language
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
'DONATION' => 'Donate to %1$s',
'DONATION_CANCELLED' => 'Donation Cancelled',
'DONATION_SUCCESSFULL' => 'Donation Successfull',
'PAGE_CANCELLED' => 'It seems you have decided to cancel your donation to %1$s.<br />Don\'t worry, it\'s ok - but do think about donating in the future - the more donations we get, the better we can make the site.<br />Thanks for checking out the site none the less<br /><br />The Team',
'PAGE_SUCCESSFULL' => 'Support %1$s by making a donation using PayPal.<br />Your donations ensure that we can pay our hosting bills and are able to keep this site online for the benefit of our users.<br /><br />If you are able to donate more than $5 it will keep us motiviated to produce Rewards for our Supporters and helps us that much more.',
'PAGE_DONATION' => 'Congratulations, you have successfully donated to %1$s!<br /><br />Your donation, no matter how big or small, is very greatly appreciated and will go towards keeping the site online<br />Hopefully in the future, we can set up a rewards system for those who have donated<br />For now though, you have your utmost thanks<br /><br />The team.',
));
?>
Place the following template files inside a "paypal" folder in your templates directory.
paypal/paypal_body.html
Code: Select all
<!-- INCLUDE overall_header.html -->
<h2>{L_DONATION}</h2>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<fieldset class="fields2">
<p>{L_PAGE_DONATION}</p><br />
<dl>
<dt>
<!-- Replace this code with your own paypal code -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but21.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="encrypted" value="----- INSERT YOUR CUSTOM PAYPAL CODE HERE || CHECK THE PAYPAL WEBSITE ON HOW TO GENERATE THIS -----
"></form>
<!-- Replace this code with your own paypal code -->
</dt>
</dl>
</fieldset>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- INCLUDE overall_footer.html -->
paypal/cancel_body.html
Code: Select all
<!-- INCLUDE overall_header.html -->
<h2>{L_DONATION_CANCELLED}</h2>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<fieldset class="fields2">
<p>{L_PAGE_CANCELLED}</p>
</fieldset>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- INCLUDE overall_footer.html -->
paypal/success_body.html
Code: Select all
<!-- INCLUDE overall_header.html -->
<h2>{L_DONATION_SUCCESSFULL}</h2>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<fieldset class="fields2">
<p>{L_PAGE_SUCCESSFULL</p>
</fieldset>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- INCLUDE overall_footer.html -->
Create a link to the paypal.php file wherever you like - easiest place is next to the FAQ / Members links in the breadcrumbs bar. Have a look at how the are created to see how you do it. Also, remember to add your custom paypal form info into the paypal_body.html file or you page won't work. There's more information on paypals website on how to generate a custom donations button