Changeset 5399 for trunk/prototype/api
- Timestamp:
- 01/18/12 16:10:57 (12 years ago)
- Location:
- trunk/prototype
- Files:
-
- 12 deleted
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype
-
Property
svn:ignore
set to
.links.php.kate-swp
-
Property
svn:ignore
set to
-
trunk/prototype/api/cache/MemoryCache.php
r5341 r5399 42 42 43 43 public function __construct($conf=Null) { 44 $this->_memcache = new Memcache();45 $this->_config = $conf;44 //$this->_memcache = new Memcache(); 45 // $this->_config = $conf; 46 46 47 47 // host, port, persistent, weight 48 if($conf!==Null){49 foreach ($conf as $c){50 $result = $this->_memcache->addServer($c[0], $c[1], $c[2], $c[3]);51 }52 }53 else{54 $this->_memcache->addServer('localhost', 11211);55 }48 // if($conf!==Null){ 49 // foreach ($conf as $c){ 50 // $result = $this->_memcache->addServer($c[0], $c[1], $c[2], $c[3]); 51 // } 52 // } 53 // else{ 54 // $this->_memcache->addServer('localhost', 11211); 55 // } 56 56 } 57 57 … … 67 67 public function put($id, $data, $expire=0, $compressed=false){ 68 68 69 ob_start();70 print_r( "criando $id e armazenando no cache" );71 $output = ob_get_clean();72 file_put_contents( "/tmp/cache.log", file_get_contents( "/tmp/cache.log" ) . $output . "\n" );73 69 74 70 // if($compressed) … … 89 85 // $return = $this->_memcache->get($id); 90 86 $return = false; 91 92 if( $return ){93 ob_start();94 print_r( "lendo $id do cache" );95 $output = ob_get_clean();96 file_put_contents( "/tmp/cache.log", file_get_contents( "/tmp/cache.log" ) . $output . "\n" );97 }98 87 99 88 return( $return ); -
trunk/prototype/api/config.php
r5341 r5399 8 8 static function module($config , $module = false) 9 9 { 10 self::init();11 12 10 //Todo: registrar na nova api o currentapp 13 11 if(!$module) 14 12 $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 ); 19 16 20 17 return isset($_SESSION['config'][$module][$config]) ? $_SESSION['config'][$module][$config] : false; … … 24 21 static function me($config) 25 22 { 26 self::init(); 23 27 24 return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false; 28 29 25 } 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 31 35 static function regSet( $name , $value) 32 36 { 33 37 self::$register[$name] = $value; 34 38 } 35 39 static function regGet ($name ) 36 40 { 37 41 return (isset(self::$register[$name]) ? self::$register[$name] : false ); 38 42 } 39 43 40 static function init( )44 static function init( $header = false ) 41 45 { 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'); 44 62 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 47 85 } 86 48 87 } 49 88 89 Config::init(); 90 91 50 92 ?> -
trunk/prototype/api/controller.php
r5341 r5399 4 4 define( 'ROOTPATH', dirname(__FILE__).'/..' ); 5 5 6 require_once(ROOTPATH.'/ap p/config.php');6 require_once(ROOTPATH.'/api/config.php'); 7 7 8 8 /** … … 251 251 } 252 252 253 public static function links( $concept ) 253 //TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados 254 public static function links( $concept = false ) 254 255 { 255 256 if( !isset(self::$config[ $concept ]) ) … … 261 262 262 263 public static function isConcept( $concept ) 263 264 { 264 265 if( isset( self::$config[ $concept ] ) && 265 266 self::$config[ $concept ] ) … … 269 270 } 270 271 271 public static function getConcept( $concept )272 public static function getConcept( $concept, $moduleName = false ) 272 273 { 273 274 if( isset( self::$config[ $concept ] ) ) 274 275 return( self::$config[ $concept ] ); 275 276 276 return( self::$config[ $concept ] = self::loadConfig( $concept ) );277 277 return( self::$config[ $concept ] = self::loadConfig( $concept, $moduleName ) ); 278 } 278 279 279 280 public static function loadCache( $cacheType = 'Memory' ) … … 283 284 } 284 285 285 public static function loadConfig( $className, $isService = false ) 286 //TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados 287 public static function loadConfig( $className, $isService = false) 286 288 { 287 289 $fileName = $className.'.'.($isService ? 'srv' : 'ini'); 288 290 289 291 $config = self::$cache->get( $fileName ); 290 292 291 293 if( !$config ) 292 294 { 293 $config = parse_ini_file( ROOTPATH."/config/$fileName", true );295 $config = parse_ini_file( ROOTPATH.'/config/'.$fileName, true ); 294 296 295 297 self::$cache->put( $fileName, $config ); … … 379 381 } 380 382 383 //TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados 381 384 public static function service( $serviceName, $concept = false ) 382 385 { … … 393 396 self::$config[ $serviceName ]['type'] = 'service'; 394 397 395 self::import( 'ap p/'.self::$config[ $serviceName ]['type'] ); //TODO: Item 4398 self::import( 'api/'.self::$config[ $serviceName ]['type'] ); //TODO: Item 4 396 399 397 400 $service = self::load( self::$config[ $serviceName ]['path'], … … 416 419 } 417 420 421 //TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados 418 422 public static function interceptor( $method, $concept = false, $serviceName = false, $isService = false ) 419 423 { … … 506 510 * array( '=' , 'campo' , 'valor' ) 507 511 */ 508 512 513 //TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmo nos parametros passados 509 514 public static function serviceName( $URI, $original = false ) 510 515 { … … 530 535 } 531 536 537 //TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmos nas options passadas 532 538 public static function call( $method, $URI, $properties = false, $options = false, $service = false, $noTX = false ) 533 539 { -
trunk/prototype/api/datalayer.js
r5376 r5399 1013 1013 result = this.request( concept, id || filter.filter, filter.criteria ); 1014 1014 1015 if( result && bothSides && !filter.criteria.format ) 1015 if( result && bothSides && (!filter || 1016 !filter.criteria || 1017 !filter.criteria.format) ) 1016 1018 { 1017 1019 var newResult = [];
Note: See TracChangeset
for help on using the changeset viewer.