Changeset 6367 for sandbox/2.4.1-3
- Timestamp:
- 05/31/12 16:52:19 (12 years ago)
- Location:
- sandbox/2.4.1-3
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.1-3/phpgwapi/templates/default/login_default.php
r6352 r6367 183 183 $ch = curl_init(); 184 184 185 $restConf = parse_ini_file( __DIR__ . '/../../../prototype/config/REST.ini', true ); 186 185 187 $param = 'grant_type=password'; 186 $param .= '&client_id=' . $ GLOBALS['oauth']['client_id'];187 $param .= '&client_secret=' . $ GLOBALS['oauth']['client_secret'];188 $param .= '&client_id=' . $restConf['oauth']['client_id']; 189 $param .= '&client_secret=' . $restConf['oauth']['client_secret']; 188 190 $param .= '&username=' . $_POST['user']; 189 191 $param .= '&password=' . $_POST['passwd']; 190 192 191 193 // set URL and other appropriate options 192 curl_setopt($ch, CURLOPT_URL, $ GLOBALS['oauth']['url_token']);194 curl_setopt($ch, CURLOPT_URL, $restConf['oauth']['url_token']); 193 195 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: */*')); 194 196 curl_setopt($ch, CURLOPT_POST, TRUE); … … 210 212 $_SESSION['oauth']['scope'] = $a->scope; 211 213 $_SESSION['oauth']['refresh_token'] = $a->refresh_token; 212 213 214 214 215 } -
sandbox/2.4.1-3/prototype/api/config.php
r6357 r6367 5 5 class Config 6 6 { 7 8 7 static $register; 8 static $sessionStarted; 9 9 10 11 12 13 14 10 static function module($config , $module = false) 11 { 12 //Todo: registrar na nova api o currentapp 13 if(!$module) 14 $module = $_SESSION['flags']['currentapp']; 15 15 16 17 16 if( !isset( $_SESSION['config'][$module] ) || !isset( $_SESSION['config'][$module][$config] )) 17 $_SESSION['config'][$module] = parse_ini_file( ROOTPATH."/config/$module.ini", true ); 18 18 19 19 return isset($_SESSION['config'][$module][$config]) ? $_SESSION['config'][$module][$config] : false; 20 20 21 21 } 22 22 23 24 23 static function me($config) 24 { 25 25 26 27 26 return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false; 27 } 28 28 29 30 31 32 29 static function service( $service , $config ) 30 { 31 if( !isset( $_SESSION['wallet'][$service] ) || !isset( $_SESSION['wallet'][$service][$config] )) 32 $_SESSION['wallet'][$service] = parse_ini_file( ROOTPATH."/config/$service.srv", true ); 33 33 34 35 34 return (isset($_SESSION['wallet'][$service][$config])) ? $_SESSION['wallet'][$service][$config] : false; 35 } 36 36 37 38 39 37 static function get( $concept , $config = false , $module = false ) 38 { 39 $load = parse_ini_file( ROOTPATH."/config/$concept.ini", true ); 40 40 41 41 if($config === false) return $load; 42 42 43 44 43 return (isset($load[$config])) ? $load[$config] : false; 44 } 45 45 46 47 48 49 50 51 52 53 46 static function regSet( $name , $value) 47 { 48 self::$register[$name] = $value; 49 } 50 static function regGet ($name ) 51 { 52 return (isset(self::$register[$name]) ? self::$register[$name] : false ); 53 } 54 54 55 static function init( ) 56 { 55 static function init( ) 56 { 57 58 if( !defined( 'ROOTPATH' ) ) 59 define( 'ROOTPATH', dirname(__FILE__).'/..' ); 57 60 58 if( !defined( 'ROOTPATH' ) ) 59 define( 'ROOTPATH', dirname(__FILE__).'/..' ); 60 61 if ( isset( $_COOKIE[ 'sessionid' ] ) ) 62 { 63 session_id( $_COOKIE[ 'sessionid' ] ); 64 $GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ]; 65 } 61 if ( isset( $_COOKIE[ 'sessionid' ] ) ) 62 { 63 session_id( $_COOKIE[ 'sessionid' ] ); 64 $GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ]; 65 } 66 66 67 67 if( !self::$sessionStarted ) 68 self::$sessionStarted = session_start(); 69 // 70 // if( $header === true ) 71 // { 72 // require_once (dirname(__FILE__).'/../../header.inc.php'); 73 // 74 // $_SESSION['wallet']['Sieve']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; 75 // $_SESSION['wallet']['Sieve']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; 76 // 77 // $_SESSION['wallet']['Cyrus']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; 78 // $_SESSION['wallet']['Cyrus']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; 79 // 80 // $_SESSION['wallet']['user']['uid'] = $GLOBALS['phpgw_info']['user']['userid']; 81 // $_SESSION['wallet']['user']['uidNumber'] = $GLOBALS['phpgw_info']['user']['account_id']; 82 // $_SESSION['wallet']['user']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; 83 // $_SESSION['wallet']['user']['cn'] = $GLOBALS['phpgw_info']['user']['cn']; 84 // $_SESSION['wallet']['user']['mail'] = $GLOBALS['phpgw_info']['user']['email']; 85 // 86 // $_SESSION['wallet']['PostgreSQL']['user'] = $GLOBALS['phpgw_info']['server']['db_user']; 87 // $_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass']; 88 // $_SESSION['wallet']['PostgreSQL']['dbname'] = $GLOBALS['phpgw_info']['server']['db_name']; 89 // $_SESSION['wallet']['PostgreSQL']['host'] = $GLOBALS['phpgw_info']['server']['db_host']; 90 // 91 // $_SESSION['wallet']['OpenLDAP']['context'] = $GLOBALS['phpgw_info']['server']['ldap_context']; 92 // $_SESSION['wallet']['OpenLDAP']['host'] = $GLOBALS['phpgw_info']['server']['ldap_host']; 93 // 94 // } 68 self::$sessionStarted = session_start(); 95 69 96 } 70 } 71 72 public static function writeIniFile($assoc_arr, $path, $has_sections) 73 { 74 $content = ''; 75 76 if (!$handle = fopen($path, 'w')) 77 { 78 trigger_error("Permission failure when trying to open the file: $path ", E_USER_WARNING); 79 return FALSE; 80 } 81 82 self::_writeIniFile($content, $assoc_arr, $has_sections); 83 84 if (!fwrite($handle, $content)) 85 { 86 trigger_error("Permission failure when trying to write in the file: $path ", E_USER_WARNING); 87 } return FALSE; 88 89 fclose($handle); 90 return TRUE; 91 } 92 93 private static function _writeIniFile(&$content, $assoc_arr, $has_sections) 94 { 95 foreach ($assoc_arr as $key => $val) 96 { 97 if (is_array($val)) 98 { 99 if($has_sections) 100 { 101 $content .= "[$key]\n"; 102 self::_writeIniFile(&$content, $val, false); 103 } 104 else 105 foreach($val as $iKey => $iVal) 106 { 107 if (is_int($iKey)) 108 $content .= $key ."[] = $iVal\n"; 109 else 110 $content .= $key ."[$iKey] = $iVal\n"; 111 } 112 } 113 else 114 $content .= "$key = $val\n"; 115 } 116 } 97 117 98 118 } 99 119 100 120 Config::init(); 101 121 102 122 -
sandbox/2.4.1-3/prototype/config/oauthCliente.ini
r6351 r6367 1 1 service = PostgreSQL 2 PostgreSQL.concept = clients2 PostgreSQL.concept = rest_client 3 3 4 4 [PostgreSQL.mapping] -
sandbox/2.4.1-3/prototype/config/oauthCode.ini
r6351 r6367 1 1 service = PostgreSQL 2 PostgreSQL.concept = auth_codes2 PostgreSQL.concept = rest_auth_code 3 3 4 4 [PostgreSQL.mapping] -
sandbox/2.4.1-3/prototype/config/oauthRefreshToken.ini
r6351 r6367 1 1 service = PostgreSQL 2 PostgreSQL.concept = re fresh_tokens2 PostgreSQL.concept = rest_refresh_token 3 3 4 4 [PostgreSQL.mapping] … … 8 8 expires = expires 9 9 scope = scope 10 refresh_token = refresh_token 10 refresh_token = refresh_tokenr -
sandbox/2.4.1-3/prototype/config/oauthToken.ini
r6351 r6367 1 1 service = PostgreSQL 2 PostgreSQL.concept = access_tokens2 PostgreSQL.concept = rest_access_token 3 3 4 4 [PostgreSQL.mapping] -
sandbox/2.4.1-3/prototype/rest/dispatch.php
r6361 r6367 37 37 38 38 // handle request, passing the current env baseUri and autoload mapping; 39 40 $restConf = parse_ini_file( __DIR__ . '/../config/REST.ini', true ); 39 41 $request = new Request(array( 40 'baseUri'=> '/gustavo/expressoDFD/rest',42 'baseUri'=> $restConf['baseUri'], 41 43 'autoload' => $autoload, 42 44 ));
Note: See TracChangeset
for help on using the changeset viewer.