4 date_default_timezone_set("UTC");
6 $charity = "Readifood";
7 $propel_project = "readifood";
8 $root = join(DIRECTORY_SEPARATOR, array($_SERVER['DOCUMENT_ROOT'], ".."));
9 $propel_root = join(DIRECTORY_SEPARATOR, array($root, "propel"));
10 $lib_root = join(DIRECTORY_SEPARATOR, array($root, "lib"));
11 require_once "propel/Propel.php";
13 Propel::init("$propel_root/build/conf/$propel_project-conf.php");
14 set_include_path(join(PATH_SEPARATOR, array("$propel_root/build/classes", get_include_path())));
16 $request = preg_replace('!^/branches/[^/]+/!', "", $_SERVER['REQUEST_URI']);
17 $request = preg_replace('!^/+!', "", $request);
18 $request = preg_replace('!/+$!', "", $request);
20 # Extract module and parameters from URI.
21 $module = preg_replace('!/.*!', "", $request);
22 $parameters = split("/", preg_replace('!^[^/]*/!', "", $request));
23 if (count($parameters) == 1 && $parameters[0] == $module) $parameters = null;
26 if (! preg_match('/^[A-Za-z0-9-_]+$/', $module)) $module = null;
27 else if (! file_exists("$lib_root/$module.php")) $module = null;
28 else $module = strtolower($module);
29 #echo "request: $request; module: $module; params: " . print_r($parameters, true);
31 $http = (isset($_SERVER['HTTPS'])) ? "https" : "http";
32 $username = $_SERVER['REMOTE_USER'];
33 include_once("$lib_root/constants.php");
34 include_once("$lib_root/functions.php");
35 include_once("$lib_root/session.php");
36 include_once("$lib_root/header.php");
38 $user = $q->findOneByUsername($username);
40 echo "<h1 class=\"printonly\">$charity</h1>\n";
41 echo "<h1>Not logged in!</h1>\n";
42 if ($_SERVER['REMOTE_USER']) echo "<p>User <em>" . $_SERVER['REMOTE_USER'] . "</em> needs an entry in the user table.</p>\n";
45 $user_id = $user->getContactId();
46 $admin_level = $user->getAdmin();
48 echo "<h3 class=\"printonly\">$charity $module</h3>\n";
49 include_once("$lib_root/$module.php");
52 #else include_once("$lib_root/menu.php");
54 include_once("$lib_root/footer.php");