packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/starthere.php
author Dan Fuhry <dan@enanocms.org>
Sat, 23 Feb 2013 14:26:05 -0500
changeset 8 f68fdcc18df9
parent 4 2212b2ded8bf
permissions -rw-r--r--
Started on the database

<?php

// fix up REMOTE_USER for PHP FPM (FCGI) environment
if ( isset($_SERVER['REDIRECT_REMOTE_USER']) && !isset($_SERVER['REMOTE_USER']) )
	$_SERVER['REMOTE_USER'] =& $_SERVER['REDIRECT_REMOTE_USER'];

// define root directory
define('ACCOUNTS', dirname(dirname(__FILE__)) . '/');

// setup error handling policies
ini_set('display_errors', 'on');
error_reporting(E_ALL | E_STRICT | E_DEPRECATED);

// include required files
require_once(ACCOUNTS . 'includes/functions.php');
load_credentials();
require_once(ACCOUNTS . 'includes/db.php');
require_once(ACCOUNTS . 'includes/smarty/Smarty.class.php');
require_once(ACCOUNTS . 'includes/template-wrapper.php');
require_once(ACCOUNTS . 'includes/ldap.php');
require_once(ACCOUNTS . 'includes/kadm5.php');
require_once(ACCOUNTS . 'includes/users.php');
require_once(ACCOUNTS . 'includes/smtp.php');

session_start();

$adm = !empty($_SERVER['REMOTE_USER']) && ldap_test_group_membership($_SERVER['REMOTE_USER'], 'rtp');
define('IS_ADMIN', $adm);

if ( !IS_ADMIN && defined('NEED_ADMIN') )
{
	queue_message(E_ERROR, "Access to that URL is restricted to administrators.");
	redirect('/');
}

if ( !isset($_SESSION['messages']) )
	$_SESSION['messages'] = array();