[5341] | 1 | <?php |
---|
| 2 | |
---|
| 3 | class Config |
---|
| 4 | { |
---|
| 5 | static $register; |
---|
| 6 | static $sessionStarted; |
---|
| 7 | |
---|
| 8 | static function module($config , $module = false) |
---|
| 9 | { |
---|
| 10 | //Todo: registrar na nova api o currentapp |
---|
| 11 | if(!$module) |
---|
| 12 | $module = $_SESSION['flags']['currentapp']; |
---|
[5399] | 13 | |
---|
| 14 | if( !isset( $_SESSION['config'][$module] ) || !isset( $_SESSION['config'][$module][$config] )) |
---|
| 15 | $_SESSION['config'][$module] = parse_ini_file( ROOTPATH."/config/$module.ini", true ); |
---|
[5341] | 16 | |
---|
| 17 | return isset($_SESSION['config'][$module][$config]) ? $_SESSION['config'][$module][$config] : false; |
---|
| 18 | |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | static function me($config) |
---|
| 22 | { |
---|
[5399] | 23 | |
---|
[5341] | 24 | return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false; |
---|
| 25 | } |
---|
[5399] | 26 | |
---|
| 27 | static function service( $service , $config ) |
---|
| 28 | { |
---|
| 29 | if( !isset( $_SESSION['wallet'][$service] ) || !isset( $_SESSION['wallet'][$service][$config] )) |
---|
| 30 | $_SESSION['wallet'][$service] = parse_ini_file( ROOTPATH."/config/$service.srv", true ); |
---|
[5415] | 31 | |
---|
| 32 | return (isset($_SESSION['wallet'][$service][$config])) ? $_SESSION['wallet'][$service][$config] : false; |
---|
[5399] | 33 | } |
---|
| 34 | |
---|
[5437] | 35 | static function get( $concept , $config = false , $module = false ) |
---|
| 36 | { |
---|
| 37 | $load = parse_ini_file( ROOTPATH."/config/$concept.ini", true ); |
---|
| 38 | |
---|
| 39 | if($config === false) return $load; |
---|
| 40 | |
---|
| 41 | return (isset($load[$config])) ? $load[$config] : false; |
---|
| 42 | } |
---|
| 43 | |
---|
[5341] | 44 | static function regSet( $name , $value) |
---|
| 45 | { |
---|
[5399] | 46 | self::$register[$name] = $value; |
---|
[5341] | 47 | } |
---|
| 48 | static function regGet ($name ) |
---|
| 49 | { |
---|
[5399] | 50 | return (isset(self::$register[$name]) ? self::$register[$name] : false ); |
---|
[5341] | 51 | } |
---|
| 52 | |
---|
[5764] | 53 | static function init( ) |
---|
[5341] | 54 | { |
---|
[5399] | 55 | |
---|
| 56 | if( !defined( 'ROOTPATH' ) ) |
---|
| 57 | define( 'ROOTPATH', dirname(__FILE__).'/..' ); |
---|
| 58 | |
---|
| 59 | if ( isset( $_COOKIE[ 'sessionid' ] ) ) |
---|
| 60 | { |
---|
| 61 | session_id( $_COOKIE[ 'sessionid' ] ); |
---|
| 62 | $GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ]; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | if( !self::$sessionStarted ) |
---|
| 66 | self::$sessionStarted = session_start(); |
---|
[5764] | 67 | // |
---|
| 68 | // if( $header === true ) |
---|
| 69 | // { |
---|
| 70 | // require_once (dirname(__FILE__).'/../../header.inc.php'); |
---|
| 71 | // |
---|
| 72 | // $_SESSION['wallet']['Sieve']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; |
---|
| 73 | // $_SESSION['wallet']['Sieve']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; |
---|
| 74 | // |
---|
| 75 | // $_SESSION['wallet']['Cyrus']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; |
---|
| 76 | // $_SESSION['wallet']['Cyrus']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; |
---|
| 77 | // |
---|
| 78 | // $_SESSION['wallet']['user']['uid'] = $GLOBALS['phpgw_info']['user']['userid']; |
---|
| 79 | // $_SESSION['wallet']['user']['uidNumber'] = $GLOBALS['phpgw_info']['user']['account_id']; |
---|
| 80 | // $_SESSION['wallet']['user']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; |
---|
| 81 | // $_SESSION['wallet']['user']['cn'] = $GLOBALS['phpgw_info']['user']['cn']; |
---|
| 82 | // $_SESSION['wallet']['user']['mail'] = $GLOBALS['phpgw_info']['user']['email']; |
---|
| 83 | // |
---|
| 84 | // $_SESSION['wallet']['PostgreSQL']['user'] = $GLOBALS['phpgw_info']['server']['db_user']; |
---|
| 85 | // $_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass']; |
---|
| 86 | // $_SESSION['wallet']['PostgreSQL']['dbname'] = $GLOBALS['phpgw_info']['server']['db_name']; |
---|
| 87 | // $_SESSION['wallet']['PostgreSQL']['host'] = $GLOBALS['phpgw_info']['server']['db_host']; |
---|
| 88 | // |
---|
| 89 | // $_SESSION['wallet']['OpenLDAP']['context'] = $GLOBALS['phpgw_info']['server']['ldap_context']; |
---|
| 90 | // $_SESSION['wallet']['OpenLDAP']['host'] = $GLOBALS['phpgw_info']['server']['ldap_host']; |
---|
| 91 | // |
---|
| 92 | // } |
---|
[5399] | 93 | |
---|
[5341] | 94 | } |
---|
[5399] | 95 | |
---|
[5341] | 96 | } |
---|
| 97 | |
---|
[5399] | 98 | Config::init(); |
---|
| 99 | |
---|
| 100 | |
---|
[5341] | 101 | ?> |
---|