Ignore:
Timestamp:
01/18/12 16:10:57 (12 years ago)
Author:
cristiano
Message:

Ticket #2434 - Alteração da estrutura de diretórios da nova API

Location:
trunk/prototype
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/prototype

    • Property svn:ignore set to
      .links.php.kate-swp
  • trunk/prototype/api/config.php

    r5341 r5399  
    88    static function module($config , $module = false) 
    99    { 
    10         self::init(); 
    11        
    1210        //Todo: registrar na nova api o currentapp 
    1311        if(!$module) 
    1412            $module =  $_SESSION['flags']['currentapp']; 
    15         /* 
    16         if( !isset( $_SESSION['config'][$module] ) ) 
    17             Carregar Config do modulo 
    18          */   
     13   
     14        if( !isset( $_SESSION['config'][$module] ) || !isset( $_SESSION['config'][$module][$config] )) 
     15            $_SESSION['config'][$module] = parse_ini_file( ROOTPATH."/config/$module.ini", true ); 
    1916         
    2017        return isset($_SESSION['config'][$module][$config]) ? $_SESSION['config'][$module][$config] : false; 
     
    2421    static function me($config) 
    2522    { 
    26         self::init(); 
     23         
    2724        return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false; 
    28       
    2925    } 
    30  
     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 ); 
     31         
     32        return isset($_SESSION['wallet'][$service][$config]) ? $_SESSION['wallet'][$service][$config] : false; 
     33    } 
     34     
    3135    static function regSet( $name , $value) 
    3236    { 
    33             self::$register[$name] = $value; 
     37        self::$register[$name] = $value; 
    3438    } 
    3539    static function regGet ($name ) 
    3640    { 
    37             return (isset(self::$register[$name]) ? self::$register[$name] : false ); 
     41        return (isset(self::$register[$name]) ? self::$register[$name] : false ); 
    3842    } 
    3943 
    40     static function init() 
     44    static function init( $header = false ) 
    4145    { 
    42         if ( isset( $_COOKIE[ 'sessionid' ] ) )  
    43             session_id( $_COOKIE[ 'sessionid' ] );  
     46         
     47        if( !defined( 'ROOTPATH' ) ) 
     48            define( 'ROOTPATH', dirname(__FILE__).'/..' ); 
     49         
     50        if ( isset( $_COOKIE[ 'sessionid' ] ) )  
     51        { 
     52            session_id( $_COOKIE[ 'sessionid' ] );  
     53            $GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ]; 
     54        } 
     55                 
     56        if( !self::$sessionStarted ) 
     57            self::$sessionStarted = session_start(); 
     58                 
     59        if( $header === true ) 
     60        { 
     61            require_once (dirname(__FILE__).'/../../header.inc.php'); 
    4462 
    45         if( !self::$sessionStarted ) 
    46             self::$sessionStarted = session_start(); 
     63            $_SESSION['wallet']['Sieve']['user']          =  $GLOBALS['phpgw_info']['user']['account_lid']; 
     64            $_SESSION['wallet']['Sieve']['password']      =  $GLOBALS['phpgw_info']['user']['passwd']; 
     65 
     66            $_SESSION['wallet']['Cyrus']['user']          =  $GLOBALS['phpgw_info']['user']['account_lid']; 
     67            $_SESSION['wallet']['Cyrus']['password']      =  $GLOBALS['phpgw_info']['user']['passwd']; 
     68 
     69            $_SESSION['wallet']['user']['uid']            =  $GLOBALS['phpgw_info']['user']['userid']; 
     70            $_SESSION['wallet']['user']['uidNumber']      =  $GLOBALS['phpgw_info']['user']['account_id']; 
     71            $_SESSION['wallet']['user']['password']       =  $GLOBALS['phpgw_info']['user']['passwd']; 
     72            $_SESSION['wallet']['user']['cn']             =  $GLOBALS['phpgw_info']['user']['cn']; 
     73            $_SESSION['wallet']['user']['mail']           =  $GLOBALS['phpgw_info']['user']['email']; 
     74 
     75            $_SESSION['wallet']['PostgreSQL']['user']     = $GLOBALS['phpgw_info']['server']['db_user']; 
     76            $_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass']; 
     77            $_SESSION['wallet']['PostgreSQL']['dbname']   = $GLOBALS['phpgw_info']['server']['db_name']; 
     78            $_SESSION['wallet']['PostgreSQL']['host']     = $GLOBALS['phpgw_info']['server']['db_host']; 
     79             
     80            $_SESSION['wallet']['OpenLDAP']['context']   =  $GLOBALS['phpgw_info']['server']['ldap_context']; 
     81            $_SESSION['wallet']['OpenLDAP']['host']      =  $GLOBALS['phpgw_info']['server']['ldap_host']; 
     82            
     83        } 
     84                 
    4785    } 
     86 
    4887} 
    4988 
     89    Config::init(); 
     90         
     91 
    5092?> 
Note: See TracChangeset for help on using the changeset viewer.