X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=www%2Findex.php;h=d88b3217651b2da70cb14326f55fb2658a026dbd;hb=ea0e53db8b5a264b6e231038815d2c350076d02a;hp=84f87171fd94fbe46cb39f273796ad72cf4d8c01;hpb=e90135c8b78c87685fc4de865fcb59d1e84bcda2;p=readifood.git diff --git a/www/index.php b/www/index.php index 84f8717..d88b321 100644 --- a/www/index.php +++ b/www/index.php @@ -8,12 +8,13 @@ $root = join(DIRECTORY_SEPARATOR, array($_SERVER['DOCUMENT_ROOT'], "..")); $propel_root = join(DIRECTORY_SEPARATOR, array($root, "propel")); $lib_root = join(DIRECTORY_SEPARATOR, array($root, "lib")); - require_once "propel/Propel.php"; + require_once(join(DIRECTORY_SEPARATOR, array($root, "vendor", "autoload.php"))); Propel::init("$propel_root/build/conf/$propel_project-conf.php"); - set_include_path(join(PATH_SEPARATOR, array("$propel_root/build/classes", get_include_path()))); + set_include_path(join(PATH_SEPARATOR, array(join(DIRECTORY_SEPARATOR, array($propel_root, "build", "classes")), get_include_path()))); - $request = preg_replace('!^/branches/[^/]+/!', "", $_SERVER['REQUEST_URI']); + $script_url = array_key_exists('SCRIPT_URL', $_SERVER) ? $_SERVER['SCRIPT_URL'] : $_SERVER['REDIRECT_URL']; + $request = preg_replace('!^/branches/[^/]+/!', "", $script_url); $request = preg_replace('!^/+!', "", $request); $request = preg_replace('!/+$!', "", $request); @@ -28,26 +29,36 @@ else $module = strtolower($module); #echo "request: $request; module: $module; params: " . print_r($parameters, true); - $username = $_SERVER['REMOTE_USER']; - include_once("$lib_root/constants.php"); - include_once("$lib_root/functions.php"); - include_once("$lib_root/header.php"); - $q = new UserQuery; - $user = $q->findOneByUsername($username); - if (! $q->count()) { - echo "
User " . $_SERVER['REMOTE_USER'] . " needs an entry in the user table.
\n"; - } - else { - $user_id = $user->getContactId(); - $admin_level = $user->getAdmin(); - if ($module) { - echo "User $username needs an entry in the user table.
\n"; } + else { + $user_id = $user->getContactId(); + $admin_level = $user->getAdmin(); + if ($module) { + echo "