diff options
Diffstat (limited to 'htdocs/src/base.inc.php')
-rw-r--r-- | htdocs/src/base.inc.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/htdocs/src/base.inc.php b/htdocs/src/base.inc.php new file mode 100644 index 0000000..d7a9354 --- /dev/null +++ b/htdocs/src/base.inc.php @@ -0,0 +1,45 @@ +<?php + +/* Foursquare Community Site + * + * Copyright (C) 2011 Foursquare Church. + * + * Developers: Jesse Morgan <jmorgan@foursquarestaff.com> + * + */ + +require_once('config.inc.php'); + +require_once('Cif_Database.inc.php'); + +/* Set the timezone for PHP */ +date_default_timezone_set('America/Los_Angeles'); + +/* Start Session */ +session_start(); + +/* Helper functions */ +$__DB = null; + +function getDatabase() { + global $CONFIG, $__DB; + + if ($__DB == null) { + try { + $__DB = new Cif_Database($CONFIG['dbhost'], $CONFIG['dbuser'], + $CONFIG['dbpass'], $CONFIG['dbname']); + + } catch (Cif_Database_Exception $e) { + die("Could not connect to database"); + } + } + + return $__DB; +} + +function __autoload($class) { + require_once "$class.inc.php"; +} + + +?> |