aboutsummaryrefslogtreecommitdiff
path: root/conf.php
diff options
context:
space:
mode:
authorCamil Staps2016-07-28 09:37:48 +0200
committerCamil Staps2016-07-28 09:47:04 +0200
commit4f84eb2b09bf51eabdc29b5eeec101e0260b1cb7 (patch)
tree82722787d4018373720c66933f475bb2b1708c92 /conf.php
parentSplit Calculatable in trait and interface (diff)
Braintree integration: first version
Diffstat (limited to 'conf.php')
-rw-r--r--conf.php31
1 files changed, 19 insertions, 12 deletions
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