0
|
1 |
<?php
|
|
2 |
|
|
3 |
function redirect($url)
|
|
4 |
{
|
|
5 |
header('HTTP/1.1 302 Found');
|
|
6 |
header("Location: $url");
|
|
7 |
exit;
|
|
8 |
}
|
|
9 |
|
|
10 |
/**
|
|
11 |
* Queue a message that will be displayed in a box on the next page load
|
|
12 |
* @param int Message type (E_NOTICE, E_WARNING, E_ERROR)
|
|
13 |
* @param string Message string
|
|
14 |
*/
|
|
15 |
|
|
16 |
function queue_message($code, $message)
|
|
17 |
{
|
|
18 |
$_SESSION['messages'][] = array(
|
|
19 |
'code' => $code
|
|
20 |
, 'message' => $message
|
|
21 |
);
|
|
22 |
}
|
|
23 |
|
|
24 |
function smarty_function_get_next_uid()
|
|
25 |
{
|
|
26 |
return get_next_available_uid();
|
|
27 |
}
|
|
28 |
|
|
29 |
function load_credentials()
|
|
30 |
{
|
|
31 |
$config = yaml_parse_file("/usr/local/etc/ssoinabox/webcreds.yml");
|
|
32 |
$keys = array('LDAP_BASEDN', 'UID_MIN', 'GID_MIN', 'ldap_server', 'ldap_manager', 'ldap_user_basedn', 'ldap_group_basedn', 'kerberos_admin', 'PHONE_EXT_MIN');
|
|
33 |
|
|
34 |
foreach ( $keys as $key )
|
|
35 |
{
|
|
36 |
if ( !isset($config[$key]) )
|
|
37 |
die("Config key $key is not set");
|
|
38 |
|
|
39 |
if ( preg_match('/^[A-Z_]+$/', $key) )
|
|
40 |
define($key, $config[$key]);
|
|
41 |
else
|
|
42 |
$GLOBALS[$key] = $config[$key];
|
|
43 |
}
|
|
44 |
}
|