From e66d26d0c1e78b894e1a3733b3720c22120a9e91 Mon Sep 17 00:00:00 2001 From: viniciuscb Date: Sat, 18 Jun 2005 20:29:17 +0000 Subject: [PATCH] XMLRPC: included support for on-browser xmlrpc authentication About Screen: support for image and url in description --- about.php | 46 +++++++++++++++++++++++++++++++++++----------- xmlrpc.php | 16 ++++++++++++++++ 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/about.php b/about.php index d387207f62..bd0cae8062 100644 --- a/about.php +++ b/about.php @@ -151,21 +151,45 @@ function about_display($info) { $infos = array('email' => $info[$key.'_email'],'name' => $infos); } + elseif(!is_array($infos) && isset($info[$key.'_url'])) + { + $infos = array('url' => $info[$key.'_url'],'name' => $infos); + } if (is_array($infos)) { - $names = explode('
',$infos['name']); - $emails = split('@|
',$infos['email']); - if (count($names) < count($emails)/2) + if ($infos['email']) { - $names = ''; + $names = explode('
',$infos['name']); + $emails = split('@|
',$infos['email']); + if (count($names) < count($emails)/2) + { + $names = ''; + } + $infos = ''; + while (list($user,$domain) = $emails) + { + if ($infos) $infos .= '
'; + $name = $names ? array_shift($names) : $user; + $infos .= "$name"; + array_shift($emails); array_shift($emails); + } } - $infos = ''; - while (list($user,$domain) = $emails) - { - if ($infos) $infos .= '
'; - $name = $names ? array_shift($names) : $user; - $infos .= "$name"; - array_shift($emails); array_shift($emails); + elseif($infos['url']) + { + $img = $info[$key.'_img']; + if ($img) + { + $img_url = $GLOBALS['phpgw']->common->image('phpgwapi',$img); + if (!$img_url) + { + $img_url = $GLOBALS['phpgw']->common->image($info['name'],$img); + } + $infos = '

'.$infos['name'].'
'; + } + else + { + $infos = ''.$infos['name'].''; + } } } $s .= ($n ? '
' : '') . $infos; diff --git a/xmlrpc.php b/xmlrpc.php index ba9d2d0c01..82b57f8b2a 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -12,6 +12,8 @@ /* $Id$ */ /* $Source$ */ + /*list($usec, $sec) = explode(" ", microtime()); + $GLOBALS['concisus']['script_start'] = ((float)$usec + (float)$sec);*/ $GLOBALS['phpgw_info'] = array(); $GLOBALS['phpgw_info']['flags'] = array( @@ -21,7 +23,11 @@ ); include('header.inc.php'); + //viniciuscb: a secure way to know if we're in a xmlrpc call... + $GLOBALS['phpgw_info']['server']['xmlrpc'] = true; + $server = CreateObject('phpgwapi.xmlrpc_server'); + /* uncomment here if you want to show all of the testing functions for compatibility */ //include(PHPGW_API_INC . '/xmlrpc.interop.php'); @@ -42,5 +48,15 @@ } $server->authed = $GLOBALS['phpgw']->session->verify($sessionid,$kp3); + if (!$server->authed and isset($_SERVER['PHP_AUTH_USER']) and isset($_SERVER['PHP_AUTH_PW'])) + { + $authed = $GLOBALS['phpgw']->session->create($login.'@'.$domain, $_SERVER['PHP_AUTH_PW'], 'text'); + + if ($authed) + { + $server->authed = true; + } + } + $server->service($_SERVER['HTTP_RAW_POST_DATA']); ?>