Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/enrol/paypal/ipn.php File Reference

Go to the source code of this file.

Namespaces

namespace  enrol

Functions

 message_paypal_error_to_admin ($subject, $data)

Variables

if(empty($_POST) or!empty($_GET)) $req = 'cmd=_notify-validate'
 Keep out casual intruders.
 $data = new stdClass()
foreach($_POST as $key=> $value$custom = explode('-', $data->custom)
$data userid = (int)$custom[0]
$data courseid = (int)$custom[1]
$data instanceid = (int)$custom[2]
$data payment_gross = $data->mc_gross
$data payment_currency = $data->mc_currency
$data timeupdated = time()
if(!$user=$DB->get_record("user",
array("id"=> $data->userid)))
if(!$course=$DB->get_record("course",
array("id"=> $data->courseid)))
if(!$context=get_context_instance(CONTEXT_COURSE,
$course->id)) if(!$plugin_instance=$DB->
get_record("enrol", array("id"=>
$data->instanceid,"status"=>0))) 
$plugin = enrol_get_plugin('paypal')
 get the user and course records
 $header = ''
 Open a connection back to PayPal to validate the data.
 $paypaladdr = empty($CFG->usepaypalsandbox) ? 'www.paypal.com' : 'www.sandbox.paypal.com'
 $fp = fsockopen ($paypaladdr, 80, $errno, $errstr, 30)
 exit

Function Documentation

message_paypal_error_to_admin ( subject,
data 
)

Definition at line 306 of file ipn.php.

Here is the call graph for this function:


Variable Documentation

foreach ($_POST as $key=> $value) $custom = explode('-', $data->custom)

Definition at line 58 of file ipn.php.

$data = new stdClass()

Definition at line 51 of file ipn.php.

$fp = fsockopen ($paypaladdr, 80, $errno, $errstr, 30)

Definition at line 97 of file ipn.php.

$header = ''

Open a connection back to PayPal to validate the data.

Definition at line 92 of file ipn.php.

$paypaladdr = empty($CFG->usepaypalsandbox) ? 'www.paypal.com' : 'www.sandbox.paypal.com'

Definition at line 96 of file ipn.php.

if (!$user=$DB->get_record("user", array("id"=> $data->userid))) if (!$course=$DB->get_record("course", array("id"=> $data->courseid))) if (!$context=get_context_instance(CONTEXT_COURSE, $course->id)) if (!$plugin_instance=$DB->get_record("enrol", array("id"=> $data->instanceid,"status"=>0))) $plugin = enrol_get_plugin('paypal')

get the user and course records

Definition at line 89 of file ipn.php.

if (empty($_POST) or!empty($_GET)) $req = 'cmd=_notify-validate'

Keep out casual intruders.

Read all the data from PayPal and get it ready for later; we expect only valid UTF-8 encoding, it is the responsibility of user to set it up properly in PayPal business account, it is documented in docs wiki.

Definition at line 49 of file ipn.php.

$data courseid = (int)$custom[1]

Definition at line 60 of file ipn.php.

Definition at line 300 of file ipn.php.

$data instanceid = (int)$custom[2]

Definition at line 61 of file ipn.php.

$data payment_currency = $data->mc_currency

Definition at line 63 of file ipn.php.

$data payment_gross = $data->mc_gross

Definition at line 62 of file ipn.php.

Definition at line 64 of file ipn.php.

$data userid = (int)$custom[0]

Definition at line 59 of file ipn.php.

 All Data Structures Namespaces Files Functions Variables Enumerations