new debug-level user-preference, show getctag in autoindex and do NOT treat webkit browsers like kde clients

This commit is contained in:
Ralf Becker 2010-10-31 07:56:29 +00:00
parent d3532ed7a1
commit 89b8f68f7e
3 changed files with 45 additions and 25 deletions

View File

@ -89,6 +89,8 @@ class groupdav extends HTTP_WebDAV_Server
/** /**
* Debug level: 0 = nothing, 1 = function calls, 2 = more info, 3 = complete $_SERVER array * Debug level: 0 = nothing, 1 = function calls, 2 = more info, 3 = complete $_SERVER array
* *
* Can now be enabled on a per user basis in GroupDAV prefs, if it is set here to 0!
*
* The debug messages are send to the apache error_log * The debug messages are send to the apache error_log
* *
* @var integer * @var integer
@ -123,6 +125,8 @@ class groupdav extends HTTP_WebDAV_Server
function __construct() function __construct()
{ {
if (!$this->debug) $this->debug = (int)$GLOBALS['egw_info']['user']['preferences']['groupdav']['debug_level'];
if ($this->debug > 2) error_log('groupdav: $_SERVER='.array2string($_SERVER)); if ($this->debug > 2) error_log('groupdav: $_SERVER='.array2string($_SERVER));
// identify clients, which do NOT support path AND full url in <D:href> of PROPFIND request // identify clients, which do NOT support path AND full url in <D:href> of PROPFIND request
@ -354,18 +358,15 @@ class groupdav extends HTTP_WebDAV_Server
$files['files'][0] = array( $files['files'][0] = array(
'path' => $path.$app.'/', 'path' => $path.$app.'/',
// KAddressbook doubles the folder, if the self URL contains the GroupDAV/CalDAV resourcetypes // KAddressbook doubles the folder, if the self URL contains the GroupDAV/CalDAV resourcetypes
'props' => $this->_properties($app,$app=='addressbook'&&strpos($_SERVER['HTTP_USER_AGENT'],'KHTML') !== false,$user,$path), 'props' => $this->_properties($app,$app=='addressbook'&&$handler->get_agent()=='kde',$user,$path),
); );
}
if ($method != 'REPORT' && isset($options['depth']) && !$options['depth'] && !$id)
{
// add ctag if handler implements it (only for depth 0) // add ctag if handler implements it (only for depth 0)
if (method_exists($handler,'getctag')) if (method_exists($handler,'getctag'))
{ {
$files['files'][0]['props'][] = HTTP_WebDAV_Server::mkprop( $files['files'][0]['props'][] = HTTP_WebDAV_Server::mkprop(
groupdav::CALENDARSERVER,'getctag',$handler->getctag($options['path'],$user)); groupdav::CALENDARSERVER,'getctag',$handler->getctag($options['path'],$user));
} }
return true; // depth 0 --> show only the self url if (!$options['depth']) return true; // depth 0 --> show only the self url
} }
return $handler->propfind($this->_slashify($options['path']),$options,$files,$user,$id); return $handler->propfind($this->_slashify($options['path']),$options,$files,$user,$id);
} }
@ -383,7 +384,7 @@ class groupdav extends HTTP_WebDAV_Server
*/ */
function _properties($app,$no_extra_types=false,$user=null,$path='/') function _properties($app,$no_extra_types=false,$user=null,$path='/')
{ {
if ($this->debug) error_log(__CLASS__."::$method: user='$user', app='$app'"); if ($this->debug) ;error_log(__CLASS__."::$method(app='$app', no_extra_types=$no_extra_types, user='$user', path='$path')");
if ($user) if ($user)
{ {
$account_lid = $this->accounts->id2name($user); $account_lid = $this->accounts->id2name($user);

View File

@ -246,7 +246,7 @@ abstract class groupdav_handler
{ {
if ($return_no_access && !is_null($entry)) if ($return_no_access && !is_null($entry))
{ {
if ($this->debug) error_log(__METHOD__."($method,,$id,$return_no_access) is_null(\$entry)=".(int)is_null($entry).", set to false"); if ($this->debug) error_log(__METHOD__."($method,,$id,$return_no_access) \$entry=".array2string($entry).", \$return_no_access set to false");
$return_no_access = false; $return_no_access = false;
} }
else else
@ -341,8 +341,10 @@ abstract class groupdav_handler
'bionicmessage.net' => 'funambol', // funambol GroupDAV connector from bionicmessage.net 'bionicmessage.net' => 'funambol', // funambol GroupDAV connector from bionicmessage.net
'zideone' => 'zideone', // zideone outlook plugin 'zideone' => 'zideone', // zideone outlook plugin
'lightning' => 'lightning', // Lighting (SOGo connector for addressbook) 'lightning' => 'lightning', // Lighting (SOGo connector for addressbook)
'webkit' => 'webkit', // Webkit Browser (also reports KHTML!)
'khtml' => 'kde', // KDE clients 'khtml' => 'kde', // KDE clients
'neon' => 'neon' 'neon' => 'neon',
'ical4ol' => 'ical4ol', // iCal4OL client
) as $pattern => $name) ) as $pattern => $name)
{ {
if (strpos($user_agent,$pattern) !== false) if (strpos($user_agent,$pattern) !== false)
@ -364,6 +366,7 @@ abstract class groupdav_handler
{ {
if ((int)$matches[1] < 868) $agent .= '_old'; if ((int)$matches[1] < 868) $agent .= '_old';
} }
break;
} }
} }
} }

View File

@ -82,7 +82,7 @@ class groupdav_hooks
unset($addressbooks[0]); unset($addressbooks[0]);
} }
$settings['add_default'] = array( $settings['addressbook-home-set'] = array(
'type' => 'multiselect', 'type' => 'multiselect',
'label' => 'Addressbooks to sync with Apple clients', 'label' => 'Addressbooks to sync with Apple clients',
'name' => 'addressbook-home-set', 'name' => 'addressbook-home-set',
@ -92,6 +92,22 @@ class groupdav_hooks
'admin' => False, 'admin' => False,
'default' => 'P', 'default' => 'P',
); );
$settings['debug_level'] = array(
'type' => 'select',
'label' => 'Debug level for Apache/PHP error-log',
'name' => 'debug_level',
'help' => 'Enables debug-messages to Apache/PHP error-log, allowing to diagnose problems on a per user basis.',
'values' => array(
'0' => '0 - off',
'1' => '1 - function calls',
'2' => '2 - more info',
'3' => '3 - complete $_SERVER array',
),
'xmlrpc' => true,
'admin' => false,
'default' => '0',
);
return $settings; return $settings;
} }
} }