Beispiel #1
0
function AddPost($username, $postMessage)
{
    IncludeLibrary('html_purifier');
    $config = HTMLPurifier_Config::createDefault();
    $purifier = new HTMLPurifier($config);
    $postMessage = htmlspecialchars($purifier->purify($postMessage));
    if ($postMessage == "") {
        return false;
    }
    try {
        $conn = openConnection();
        $iduser = "******";
        $stmt = $conn->prepare("INSERT INTO message values(null, {$iduser}, default, default, :postmessage)");
        $stmt->bindParam(':username', $username);
        $stmt->bindParam(':postmessage', $postMessage);
        $stmt->execute();
    } catch (PDOException $e) {
        return false;
    }
    $conn = null;
    return true;
}
Beispiel #2
0
<?php

use PayPal\Api\Details;
use PayPal\Api\Item;
use PayPal\Api\Payment;
use PayPal\Api\PaymentExecution;
IncludeLibrary('paypal');
IncludeModel('donations');
global $donatePack;
function initialize_donate()
{
    if (!is_logged_in()) {
        Error('Invalid Access');
    }
    $GLOBALS['donatePack'] = GetDonationsPack();
}
function test()
{
    global $apiContext;
    // IncludeConfig('paypal/bootstrap.php');
    $payer = new Payer();
    $payer->setPaymentMethod("paypal");
    $item1 = new Item();
    $item1->setName('Ground Coffee 40 oz')->setCurrency('USD')->setQuantity(1)->setPrice(7.5);
    $item2 = new Item();
    $item2->setName('Granola bars')->setCurrency('USD')->setQuantity(5)->setPrice(2);
    $itemList = new ItemList();
    $itemList->setItems(array($item1, $item2));
    $details = new Details();
    $details->setShipping(1.2)->setTax(1.3)->setSubtotal(17.5);
    $amount = new Amount();