function check_timestamp($collection, &$db) { if (array_key_exists('HTTP_X_IF_UNMODIFIED_SINCE', $_SERVER) && $db->get_max_timestamp($collection) > $_SERVER['HTTP_X_IF_UNMODIFIED_SINCE']) { report_problem(WEAVE_ERROR_NO_OVERWRITE, 412); } }
$db->delete_objects($collection, null, $params['parentid'], $params['predecessorid'], $params['newer'], $params['older'], $params['sort'], $params['limit'], $params['offset'], $params['ids'], $params['index_above'], $params['index_below']); } else { if ($function == 'storage') { if (!array_key_exists('HTTP_X_CONFIRM_DELETE', $_SERVER)) { report_problem(WEAVE_ERROR_NO_OVERWRITE, 412); } $db->delete_storage($username); } else { if (!array_key_exists('HTTP_X_CONFIRM_DELETE', $_SERVER)) { report_problem(WEAVE_ERROR_NO_OVERWRITE, 412); } log_error("delete " . "Server " . print_r($_SERVER, true)); $db->delete_user($username); } } } echo json_encode($server_time); } else { #bad protocol. There are protocols left? HEAD, I guess. report_problem(1, 400); } } } } } catch (Exception $e) { report_problem($e->getMessage(), $e->getCode()); } #The datasets we might be dealing with here are too large for sticking it all into an array, so #we need to define a direct-output method for the storage class to use. If we start producing multiples #(unlikely), we can put them in their own class. #include_once "WBOJsonOutput.php";
} // If we got this far, then its ok to fulfil the order $item_name = $listener->getData('item_name'); $item_number = $listener->getData('item_number'); $payer_name = trim($listener->getData('first_name') . ' ' . $listener->getData('last_name')); $payer_email = $listener->getData('payer_email'); process_order($transaction_id, $item_name, $item_number, $payer_name, $payer_email); // Tell PayPal that we have successfully processing IPN. header('HTTP/1.1 200 OK'); } catch (Exception $e) { // Tell PayPal that we had problems processing IPN. header('HTTP/1.1 500 Internal Server Error'); // Report error message. $message = 'IPN error: ' . (string) $e; $message .= PHP_EOL . PHP_EOL . $listener->getTextReport(); report_problem($message); } function process_order($transaction_id, $item_name, $item_number, $payer_name, $payer_email) { // For example: Fulfil the order, save details in the database. } function check_price($total, $currency) { // For example: Check that payment matches your advertised price. return true; } function check_receiver_email($email) { // For example: Check that email matches your PayPal account. return true; }