From 4f84eb2b09bf51eabdc29b5eeec101e0260b1cb7 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 28 Jul 2016 09:37:48 +0200 Subject: Braintree integration: first version --- conf.php | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'conf.php') diff --git a/conf.php b/conf.php index e8ed000..d195a07 100644 --- a/conf.php +++ b/conf.php @@ -31,20 +31,16 @@ session_start(); error_reporting(0); ini_set('display_errors', 0); -/** - * Autoload a class if it isn't loaded yet - * - * This function is automatically called by PHP if a class isn't loaded yet. It shouldn't be used manually. - * - * @param string $pClass The name of the class to load - */ -function __autoload($pClass) { - require_once("classes/$pClass.php"); -} +set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); -set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__)); +spl_autoload_register(function ($pClass) { + $path = dirname(__FILE__) . "/classes/$pClass.php"; + if (file_exists($path)) { + require_once($path); + } +}); -require_once('./conf.private.php'); +require_once('conf.private.php'); try { $_pdo = new PDO("mysql:host=".DB_HOST.";port=".DB_PORT.";dbname=".DB_NAME.";charset=utf8", DB_USER, DB_PASS); @@ -52,3 +48,14 @@ try { } catch (PDOException $e) { die("Down until PDO error fixed."); } + +if (BRAINTREE_ENABLED) { + require_once('modules/braintree/lib/Braintree.php'); + + Braintree_Configuration::environment(BRAINTREE_ENVIRONMENT); + Braintree_Configuration::merchantId(BRAINTREE_MERCHANT); + Braintree_Configuration::publicKey(BRAINTREE_KEY_PUBLIC); + Braintree_Configuration::privateKey(BRAINTREE_KEY_PRIVATE); +} + +require_once('classes/Calculatable.php'); // Some definitions that are required -- cgit v1.2.3