Changes between Version 1 and Version 2 of phpgwapi/how_does_API_work


Ignore:
Timestamp:
03/29/10 15:52:00 (14 years ago)
Author:
rodsouza
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • phpgwapi/how_does_API_work

    v1 v2  
    123123 
    124124O script '''/phpgwapi/setup/setup.inc.php''' define dados sobre a API, além das tabelas utiliadas. 
    125  
    126125 
    127126{{{ 
     
    155154    $setup_info[ 'phpgwapi' ][ 'tables' ][ ] = 'phpgw_async'; 
    156155}}} 
     156 
     157Caso a variável '''$GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'noapi' ]''' não tenha o valor '''true''' então é realizada a inclusão dos scripts a seguir, todos localizados no diretório de classes da '''API'''. 
     158 
     159 
     160{{{ 
     161#!php 
     162    if ( ! isset( $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'noapi' ] ) || ! $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'noapi' ] == true ) 
     163    { 
     164        include( PHPGW_API_INC . '/functions.inc.php' ); 
     165        include( PHPGW_API_INC . '/xml_functions.inc.php' ); 
     166        include( PHPGW_API_INC . '/soap_functions.inc.php' ); 
     167    } 
     168}}} 
     169 
     170O script '''/phpgwapi/inc/functions.inc.php''' inicia incluindo o script '''/phpgwapi/inc/common_functions.inc.php'''. Após algumas variáveis são populas caso o ExpressoLivre esteja utilizando o formato multi-domínios. 
     171 
     172Em seguida as classes '''phpgw''' e '''db''' são instanciadas. 
     173 
     174{{{ 
     175#!php 
     176    $GLOBALS[ 'phpgw' ] = CreateObject( 'phpgwapi.phpgw' ); 
     177    $GLOBALS[ 'phpgw' ]->db = CreateObject( 'phpgwapi.db' ); 
     178}}} 
     179 
     180Com a instância da classe referente à base de dados uma tentativa de conexão com à base é realizada. 
     181 
     182{{{ 
     183#!php 
     184    if (! 
     185    $GLOBALS['phpgw']->db->connect( 
     186        $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'db_name' ], 
     187        $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'db_host' ], 
     188        $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'db_port' ], 
     189        $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'db_user' ], 
     190        $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'db_pass' ], 
     191        $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'db_type' ] 
     192    ) ) 
     193}}} 
     194 
     195Caso não seja possível conectar-se então o famigerado erro '''Código 001''' é exibido. 
     196 
     197A etapa seguinte é popular informações sobre o servidor proveniente da base de dados em '''$GLOBALS[ 'phpgw_info' ][ 'server' ]'''. 
     198 
     199{{{ 
     200#!php 
     201    $GLOBALS[ 'phpgw' ]->db->query( "SELECT * from phpgw_config WHERE config_app='phpgwapi'", __LINE__, __FILE__ ); 
     202    while ( $GLOBALS[ 'phpgw' ]->db->next_record( ) ) 
     203    { 
     204        $GLOBALS[ 'phpgw_info' ][ 'server' ][ $GLOBALS[ 'phpgw' ]->db->f( 'config_name' ) ] = stripslashes( $GLOBALS[ 'phpgw' ]->db->f( 'config_value' ) ); 
     205    } 
     206}}} 
     207 
     208Segue um exemplo de '''$GLOBALS[ 'phpgw_info' ][ 'server' ]''' populada. 
     209 
     210{{{ 
     211    [server] => Array 
     212        ( 
     213            [header_admin_user] => expresso-admin 
     214            [header_admin_password] => e8d95a51f3af4a3b134bf6bb680a213a 
     215            [setup_acl] =>  
     216            [captcha] => 0 
     217            [num_badlogin] => 0 
     218            [atributoexpiracao] =>  
     219            [atributousuarios] =>  
     220            [certificado] => 0 
     221            [use_assinar_criptografar] => 0 
     222            [num_max_certs_to_cipher] => 0 
     223            [use_https] => 0 
     224            [sugestoes_email_to] =>  
     225            [domain_name] =>  
     226            [use_prefix_organization] =>  
     227            [show_domain_selectbox] =>  
     228            [db_persistent] =>  
     229            [sessions_type] => php4 
     230            [mcrypt_enabled] =>  
     231            [versions] => Array 
     232                ( 
     233                    [mcrypt] =>  
     234                    [phpgwapi] => 2.2.000 
     235                    [current_header] => 2.0 
     236                    [header] => 2.0 
     237                ) 
     238 
     239            [mcrypt_iv] => iwktq671fBY9ZZu1GNpCL8FrzIq4Y 
     240            [default_domain] => default 
     241            [db_host] => localhost 
     242            [db_port] => 5432 
     243            [db_name] => expresso 
     244            [db_user] => postgres 
     245            [db_pass] =>  
     246            [db_type] => pgsql 
     247            [site_title] => Expresso Livre 
     248            [max_access_log_age] => 20 
     249            [block_time] => 1 
     250            [num_unsuccessful_id] => 50 
     251            [num_unsuccessful_ip] => 500 
     252            [disable_autoload_langfiles] => True 
     253            [showpoweredbyon] => bottom 
     254            [holidays_url_path] => localhost 
     255            [usecookies] => True 
     256            [install_id] => eb6dc5e478cafcab4286441bec7a1e5b 
     257            [ldap_root_pw] => senha 
     258            [cal_expressoMail] => 1.2 
     259            [image_type] => 1 
     260            [useframes] => never 
     261            [sessions_app_timeout] => 1 
     262            [deny_user_grants_access] => True 
     263            [cal_type_tree_participants] => 3 
     264            [auto_search] => True 
     265            [temp_dir] => /tmp 
     266            [files_dir] => /home/projetos/expresso 
     267            [webserver_url] => /expresso 
     268            [hostname] => 127.0.0.1 
     269            [auth_type] => ldap 
     270            [account_repository] => ldap 
     271            [sql_encryption_type] => md5 
     272            [account_min_id] => 1000 
     273            [account_max_id] => 1000000 
     274            [name_jabber] => 127.0.0.1 
     275            [resource_jabber] => celepar 
     276            [port_jabber] => 8888 
     277            [server_webjabber] => 127.0.0.1 
     278            [server_ldap_jabber] => 127.0.0.1 
     279            [context_ldap_jabber] => dc=ecelepar10631 
     280            [user_ldap_jabber] => cn=admin 
     281            [password_ldap_jabber] => senha 
     282            [server_ldap_jabberit] => localhost 
     283            [context_ldap_jabberit] => dc=ecelepar10631 
     284            [user_ldap_jabberit] => uid=expresso-admin,ou=celepar,dc=ecelepar10631 
     285            [password_ldap_jabberit] => senha 
     286            [auto_create_expire] => never 
     287            [acl_default] => deny 
     288            [ldap_host] => 127.0.0.1 
     289            [ldap_context] => dc=ecelepar10631 
     290            [ldap_group_context] => dc=ecelepar10631 
     291            [ldap_root_dn] => cn=admin,dc=ecelepar10631 
     292            [ldap_encryption_type] => md5 
     293            [ldap_version3] => True 
     294            [mcrypt_algo] => tripledes 
     295            [mcrypt_mode] => cbc 
     296            [file_repository] => sql 
     297            [file_store_contents] => filesystem 
     298            [tz_offset] => -2 
     299            [asyncservice] => off 
     300            [lang_ctimes] => a:3:{s:2:"en";a:2:{s:5:"admin";i:1268134511;s:11:"preferences";i:1268134514;}s:5:"es-es";a:2:{s:5:"admin";i:1268134511;s:11:"preferences";i:1268134514;}s:5:"pt-br";a:2:{s:5:"admin";i:1268134511;s:11:"preferences";i:1268134514;}} 
     301            [name_jabberit] => im.pr.gov.br 
     302            [port_jabberit] => 5223 
     303            [resource_jabberit] => ECELEPAR10631 
     304            [use_ssl_jabberit] => true 
     305            [use_proxy_java] => false 
     306            [name_company_applet_jabberit] => Celepar 
     307            [mail_server] => localhost 
     308            [mail_port] => 143 
     309            [sessions_timeout] => 14400 
     310        ) 
     311}}}