[763] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare - XML-RPC Test App * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | \**************************************************************************/ |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | $phpgw_info = array(); |
---|
| 14 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
| 15 | 'noheader' => True, |
---|
| 16 | 'nonavbar' => True, |
---|
| 17 | 'currentapp' => 'home', |
---|
| 18 | 'noapi' => True |
---|
| 19 | ); |
---|
| 20 | include('./inc/functions.inc.php'); |
---|
| 21 | include(PHPGW_SERVER_ROOT . 'phpgwapi/inc/xml_functions.inc.php'); |
---|
| 22 | |
---|
| 23 | /* Check header and authentication */ |
---|
| 24 | if (!$GLOBALS['phpgw_setup']->auth('Config')) |
---|
| 25 | { |
---|
| 26 | Header('Location: index.php'); |
---|
| 27 | exit; |
---|
| 28 | } |
---|
| 29 | // Does not return unless user is authorized |
---|
| 30 | |
---|
| 31 | $tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup'); |
---|
| 32 | $setup_tpl = CreateObject('setup.Template',$tpl_root); |
---|
| 33 | $setup_tpl->set_file(array( |
---|
| 34 | 'T_head' => 'head.tpl', |
---|
| 35 | 'T_footer' => 'footer.tpl' |
---|
| 36 | )); |
---|
| 37 | $setup_tpl->set_block('T_footer','footer','footer'); |
---|
| 38 | |
---|
| 39 | $host = 'us.egroupware.org'; |
---|
| 40 | $path = '/cvsdemo/xmlrpc.php'; |
---|
| 41 | |
---|
| 42 | $GLOBALS['phpgw_setup']->html->show_header(lang('Application List'),True); |
---|
| 43 | |
---|
| 44 | /* Login as demo */ |
---|
| 45 | $login = CreateObject( |
---|
| 46 | 'phpgwapi.xmlrpcmsg', |
---|
| 47 | 'system.login', |
---|
| 48 | array( |
---|
| 49 | CreateObject( |
---|
| 50 | 'phpgwapi.xmlrpcval', |
---|
| 51 | array( |
---|
| 52 | 'domain' => CreateObject('phpgwapi.xmlrpcval','default','string'), |
---|
| 53 | 'username' => CreateObject('phpgwapi.xmlrpcval','demo','string'), |
---|
| 54 | 'password' => CreateObject('phpgwapi.xmlrpcval','guest','string') |
---|
| 55 | ), |
---|
| 56 | 'struct' |
---|
| 57 | ) |
---|
| 58 | ) |
---|
| 59 | ); |
---|
| 60 | echo '<pre>' . htmlentities($login->serialize()) . "</pre>\n"; |
---|
| 61 | |
---|
| 62 | $c = CreateObject('phpgwapi.xmlrpc_client',$path,$host,80); |
---|
| 63 | $c->setDebug(1); |
---|
| 64 | $r = $c->send($login); |
---|
| 65 | $v = $r->value(); |
---|
| 66 | $result = xmlrpc_decode($v); |
---|
| 67 | |
---|
| 68 | /* Get applist */ |
---|
| 69 | $f = CreateObject('phpgwapi.xmlrpcmsg','system.listApps',''); |
---|
| 70 | echo '<pre>' . htmlentities($f->serialize()) . "</pre>\n"; |
---|
| 71 | |
---|
| 72 | $c = CreateObject('phpgwapi.xmlrpc_client',$path,$host,80); |
---|
| 73 | $c->setDebug(1); |
---|
| 74 | $c->username = $result['sessionid']; |
---|
| 75 | $c->password = $result['kp3']; |
---|
| 76 | $r = $c->send($f); |
---|
| 77 | |
---|
| 78 | /* Logout */ |
---|
| 79 | $logout = CreateObject( |
---|
| 80 | 'phpgwapi.xmlrpcmsg', |
---|
| 81 | 'system.logout', |
---|
| 82 | array( |
---|
| 83 | CreateObject( |
---|
| 84 | 'phpgwapi.xmlrpcval', |
---|
| 85 | array( |
---|
| 86 | 'sessionid' => CreateObject('phpgwapi.xmlrpcval',$result['sessionid'],'string'), |
---|
| 87 | 'kp3' => CreateObject('phpgwapi.xmlrpcval',$result['kp3'],'string') |
---|
| 88 | ), |
---|
| 89 | 'struct' |
---|
| 90 | ) |
---|
| 91 | ) |
---|
| 92 | ); |
---|
| 93 | echo '<pre>' . htmlentities($logout->serialize()) . "</pre>\n"; |
---|
| 94 | |
---|
| 95 | $c = CreateObject('phpgwapi.xmlrpc_client',$path,$host,80); |
---|
| 96 | $c->setDebug(1); |
---|
| 97 | $r = $c->send($logout); |
---|
| 98 | $v = $r->value(); |
---|
| 99 | |
---|
| 100 | $GLOBALS['phpgw_setup']->html->show_footer(); |
---|
| 101 | ?> |
---|