config.php
Current file: /home/cristiano/expresso-api/prototype/api/config.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
42.86% 3 / 7 CRAP
56.00% 14 / 25
Config
0.00% 0 / 1
42.86% 3 / 7 58.57
56.00% 14 / 25
 module($config , $module = false)
0.00% 0 / 1 30
0.00% 0 / 5
 me($config)
100.00% 1 / 1 2
100.00% 1 / 1
 service( $service , $config )
100.00% 1 / 1 4
100.00% 3 / 3
 get( $concept , $config = false , $module = false )
100.00% 1 / 1 3
100.00% 3 / 3
 regSet( $name , $value)
0.00% 0 / 1 2
0.00% 0 / 2
 regGet ($name )
0.00% 0 / 1 6
0.00% 0 / 1
 init( )
0.00% 0 / 1 4.43
70.00% 7 / 10


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

Generated by PHP_CodeCoverage 1.1.2 using PHP 5.3.10 and PHPUnit 3.6.10 at Thu Mar 29 15:14:42 BRT 2012.