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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     1
<?php
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     2
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     3
// fix up REMOTE_USER for PHP FPM (FCGI) environment
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     4
if ( isset($_SERVER['REDIRECT_REMOTE_USER']) && !isset($_SERVER['REMOTE_USER']) )
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     5
	$_SERVER['REMOTE_USER'] =& $_SERVER['REDIRECT_REMOTE_USER'];
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     6
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     7
// define root directory
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     8
define('ACCOUNTS', dirname(dirname(__FILE__)) . '/');
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
     9
8
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents: 4
diff changeset
    10
// setup error handling policies
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents: 4
diff changeset
    11
ini_set('display_errors', 'on');
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents: 4
diff changeset
    12
error_reporting(E_ALL | E_STRICT | E_DEPRECATED);
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents: 4
diff changeset
    13
0
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    14
// include required files
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    15
require_once(ACCOUNTS . 'includes/functions.php');
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    16
load_credentials();
8
f68fdcc18df9 Started on the database
Dan Fuhry <dan@enanocms.org>
parents: 4
diff changeset
    17
require_once(ACCOUNTS . 'includes/db.php');
0
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    18
require_once(ACCOUNTS . 'includes/smarty/Smarty.class.php');
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    19
require_once(ACCOUNTS . 'includes/template-wrapper.php');
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    20
require_once(ACCOUNTS . 'includes/ldap.php');
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    21
require_once(ACCOUNTS . 'includes/kadm5.php');
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    22
require_once(ACCOUNTS . 'includes/users.php');
3
a044870a9d3d Added password reset function
Dan Fuhry <dan@fuhry.us>
parents: 0
diff changeset
    23
require_once(ACCOUNTS . 'includes/smtp.php');
0
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    24
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    25
session_start();
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    26
3
a044870a9d3d Added password reset function
Dan Fuhry <dan@fuhry.us>
parents: 0
diff changeset
    27
$adm = !empty($_SERVER['REMOTE_USER']) && ldap_test_group_membership($_SERVER['REMOTE_USER'], 'rtp');
a044870a9d3d Added password reset function
Dan Fuhry <dan@fuhry.us>
parents: 0
diff changeset
    28
define('IS_ADMIN', $adm);
a044870a9d3d Added password reset function
Dan Fuhry <dan@fuhry.us>
parents: 0
diff changeset
    29
4
2212b2ded8bf Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents: 3
diff changeset
    30
if ( !IS_ADMIN && defined('NEED_ADMIN') )
2212b2ded8bf Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents: 3
diff changeset
    31
{
2212b2ded8bf Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents: 3
diff changeset
    32
	queue_message(E_ERROR, "Access to that URL is restricted to administrators.");
2212b2ded8bf Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents: 3
diff changeset
    33
	redirect('/');
2212b2ded8bf Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents: 3
diff changeset
    34
}
2212b2ded8bf Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents: 3
diff changeset
    35
0
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    36
if ( !isset($_SESSION['messages']) )
3906ca745819 First commit!
Dan Fuhry <dan@fuhry.us>
parents:
diff changeset
    37
	$_SESSION['messages'] = array();