author | Dan Fuhry <dan@fuhry.us> |
Fri, 11 Jan 2013 05:41:41 -0500 | |
changeset 4 | 2212b2ded8bf |
parent 3 | a044870a9d3d |
child 8 | f68fdcc18df9 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
||
3 |
// fix up REMOTE_USER for PHP FPM (FCGI) environment |
|
4 |
if ( isset($_SERVER['REDIRECT_REMOTE_USER']) && !isset($_SERVER['REMOTE_USER']) ) |
|
5 |
$_SERVER['REMOTE_USER'] =& $_SERVER['REDIRECT_REMOTE_USER']; |
|
6 |
||
7 |
// define root directory |
|
8 |
define('ACCOUNTS', dirname(dirname(__FILE__)) . '/'); |
|
9 |
||
10 |
// include required files |
|
11 |
require_once(ACCOUNTS . 'includes/functions.php'); |
|
12 |
load_credentials(); |
|
13 |
require_once(ACCOUNTS . 'includes/smarty/Smarty.class.php'); |
|
14 |
require_once(ACCOUNTS . 'includes/template-wrapper.php'); |
|
15 |
require_once(ACCOUNTS . 'includes/ldap.php'); |
|
16 |
require_once(ACCOUNTS . 'includes/kadm5.php'); |
|
17 |
require_once(ACCOUNTS . 'includes/users.php'); |
|
3 | 18 |
require_once(ACCOUNTS . 'includes/smtp.php'); |
0 | 19 |
|
20 |
session_start(); |
|
21 |
||
3 | 22 |
$adm = !empty($_SERVER['REMOTE_USER']) && ldap_test_group_membership($_SERVER['REMOTE_USER'], 'rtp'); |
23 |
define('IS_ADMIN', $adm); |
|
24 |
||
4
2212b2ded8bf
Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents:
3
diff
changeset
|
25 |
if ( !IS_ADMIN && defined('NEED_ADMIN') ) |
2212b2ded8bf
Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents:
3
diff
changeset
|
26 |
{ |
2212b2ded8bf
Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents:
3
diff
changeset
|
27 |
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
|
28 |
redirect('/'); |
2212b2ded8bf
Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents:
3
diff
changeset
|
29 |
} |
2212b2ded8bf
Added OpenSSH public key support in LDAP
Dan Fuhry <dan@fuhry.us>
parents:
3
diff
changeset
|
30 |
|
0 | 31 |
if ( !isset($_SESSION['messages']) ) |
32 |
$_SESSION['messages'] = array(); |