summaryrefslogtreecommitdiff
path: root/htdocs/src/base.inc.php
blob: d7a935421cb2239883444a63ccc1d0b9814678af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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";
}


?>