blob: 7b551b87abe5015a6e87014f9311917407d176a7 [file] [log] [blame]
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); $App = new App(); $Nav = new Nav(); $Menu = new Menu(); include($App->getProjectCommon()); # All on the same line to unclutter the user's desktop'
/*******************************************************************************
* Copyright (c) 2012 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christopher Guindon (Eclipse Foundation)- initial API and implementation
*******************************************************************************/
#
# Begin: page-specific settings. Change these.
$pageTitle = "Thank You";
$pageKeywords = "friends of eclipse, donation, contribution";
$pageAuthor = "Christopher Guindon";
//require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/friends/friend.class.php");
//require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/friends/contribution.class.php");
require_once("test/friends/friend.class.php");
require_once("test/friends/contribution.class.php");
require_once("/home/data/httpd/eclipse-php-classes/system/authcode.php");
ob_start();
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-synch';
//remove when not using sandbox
$auth_token = 'V8qE_sev7DTOjOHjTv9JdDUBy2wocTb6W96-h2CuQJO9kx_FKHz00gFq1ri';
$tx_token = $_POST['tx_token'];
$req .= "&tx=$tx_token&at=$auth_token";
// post back to PayPal system to validate
$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Host: www.sandbox.paypal.com\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
// If possible, securely post back to paypal using HTTPS
// Your PHP server will need to be SSL enabled
// $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
if (!$fp) {
echo "FsockOpen seems to have failed. <br/>";
}
else {
fputs ($fp, $header . $req);
// read the body data
$res = '';
$headerdone = false;
while (!feof($fp)) {
$line = fgets ($fp, 1024);
if (strcmp($line, "\r\n") == 0) {
// read the header
$headerdone = true;
}
else if ($headerdone)
{
// header has been read. now read the contents
$res .= $line;
}
}
// parse the data
$lines = explode("\n", $res);
$keyarray = array();
if (strcmp ($lines[0], "SUCCESS") == 0) {
for ($i=1; $i<count($lines);$i++){
list($key,$val) = explode("=", $lines[$i]);
$keyarray[urldecode($key)] = urldecode($val);
}
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
//if first_name, last_name, and anonymous are empty I will need to insert a form to get that information from the user.
//print_r($_POST);
//print_r($keyarray);
$firstname = $keyarray['first_name'];
$lastname = $keyarray['last_name'];
$bugzillaEmail = $_POST['item_number'];
$anonymous = $_POST['os1'];
$comment = strip_tags($_POST['os0']);
$amount = $keyarray['payment_gross'];
$itemname = $keyarray['item_name'];
$transactionID = $keyarray['txn_id'];
$paymentStatus = $keyarray['payment_status'];
$statusCheck = array('Completed', 'Pending');
include('includes/donation_process.inc.php');
include('content/en_donation_information.php');
}
else {
//if the user tries to access this page without proper validation print this:
?><p>There was an error in processing your transaction. Please contact <a href="mailto:friends@eclipse.org">friends@eclipse.org</a> with the transaction information from PayPal.</p><?
}
}
fclose ($fp);
?>
<? $html = ob_get_clean();
# Generate the web page
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);
?>