Example #1
0
<?php

session_start();
$root = $_SERVER['DOCUMENT_ROOT'] . '/';
$root = str_replace('//', '/', $root);
ini_set('include_path', ini_get('include_path') . ':' . $root . 'lib/:' . $root . 'lib/Paypal/:');
include 'db.php';
include 'functions.php';
if (!isset($_SESSION['uid'])) {
    $_SESSION['uid'] = generate_guid();
}
$db = Database::getInstance();
if (strstr($_SERVER['HTTP_HOST'], 'jabouzi.com')) {
    $db->setHost('localhost');
    $db->setUsername('jabouzic_db');
    $db->setPassword('7024043');
    $db->setDatabase('jabouzic_paypal');
} else {
    $db->setHost('localhost');
    $db->setUsername('root');
    $db->setPassword('7024043');
    $db->setDatabase('paypal');
}
$db->setPort();
$db->connect();
$db->query("SET NAMES 'utf8'", '');
//$configuration['paypal'] = array(
//'environment' => 'sandbox',
//'APIUsername' => 'jabouzi_api1.gmail.com',
//'APIPassword' => '4X6MBWTCUJSVL7JS',
//'APISignature' => 'AFcWxV21C7fd0v3bYYYRCpSSRl31As0cm3KQl7X48szW.6PrWXS8NxCU',
Example #2
0
function save_order($payerAddressId, $shippingAddressId, $cardType, $price, $shipping)
{
    global $db;
    $_SESSION['uid'] = generate_guid();
    $args = array(':uid' => $_SESSION['uid'], ':transaction_id' => 0, ':billing_id' => $payerAddressId, ':shipping_id' => $shippingAddressId, ':token' => '0', ':order_total' => $price + $shipping, ':order_description' => 'Paypal_payement_' . $cardType, ':status' => '', ':paypal_error_codes' => '', ':cardtype' => $cardType, ':lastCreditCardDigit' => '');
    $query = "INSERT INTO orders (\n\t\t\tuid,\n\t\t\ttransaction_id,\n\t\t\tbilling_id,\n\t\t\tshipping_id,\n\t\t\ttoken,\n\t\t\torder_total,\n\t\t\torder_description,\n\t\t\tstatus,\n\t\t\tpaypal_error_codes,\n\t\t\tcardtype,\n\t\t\tlastCreditCardDigit\n\t\t) VALUES (\n\t\t\t:uid,\n\t\t\t:transaction_id,\n\t\t\t:billing_id,\n\t\t\t:shipping_id,\n\t\t\t:token,\n\t\t\t:order_total,\n\t\t\t:order_description,\n\t\t\t:status,\n\t\t\t:paypal_error_codes,\n\t\t\t:cardtype,\n\t\t\t:lastCreditCardDigit\n\t\t)";
    $db->query($query, $args);
}
Example #3
0
/**
 * creates a single iCalendar formatted event.
 * The events are full day anually recurring events.
 * The events are set to CLASS:CONFIDENTIAL, and should therefore be transparent
 * to other users sharing your calendar (for example the time will show you as
 * available to other Outlook users)
 * @param string $data the data to be formatted
 * @return	the formatted string
 * @TODO Fix &lrm; tags by using proper unicode 200E code. Since the iCalendar does not user HTML, the &lrm; tag should not be used. This should only be an issue when Hebrew dates are used
 */
function getIcalRecord($date, $summary, $description, $URL = "")
{
    $dtstamp = getIcalTS();
    //current TS
    $startDate = getIcalDate($date);
    $endDate = getIcalDate($date, true);
    //not needed as per RFC2445 spec
    $iCalString = "\r\nBEGIN:VEVENT" . "\r\nDTSTAMP:{$dtstamp}" . "\r\nDTSTART;VALUE=DATE:{$startDate}" . "\r\nDTEND;VALUE=DATE:{$endDate}" . "\r\n" . formatIcalData("SUMMARY:{$summary}") . "\r\n" . formatIcalData("DESCRIPTION:{$description}") . "\r\nRRULE:FREQ=YEARLY" . "\r\nCLASS:CONFIDENTIAL" . "\r\nTRANSP:TRANSPARENT" . "\r\nUID:" . PGV_PHPGEDVIEW . '-' . generate_guid() . "\r\nCATEGORIES:" . PGV_PHPGEDVIEW . " Events" . "\r\n" . formatIcalData("URL:{$URL}") . "\r\nEND:VEVENT";
    return $iCalString;
}