mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
new debug-level user-preference, show getctag in autoindex and do NOT treat webkit browsers like kde clients
This commit is contained in:
parent
d3532ed7a1
commit
89b8f68f7e
@ -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
|
||||||
@ -164,7 +168,7 @@ class groupdav extends HTTP_WebDAV_Server
|
|||||||
'//' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '/';
|
'//' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '/';
|
||||||
}
|
}
|
||||||
$this->principalURL .= 'principals/users/'.$GLOBALS['egw_info']['user']['account_lid'].'/';
|
$this->principalURL .= 'principals/users/'.$GLOBALS['egw_info']['user']['account_lid'].'/';
|
||||||
|
|
||||||
// if client requires pathes instead of URLs
|
// if client requires pathes instead of URLs
|
||||||
if ($this->client_require_href_as_url === false)
|
if ($this->client_require_href_as_url === false)
|
||||||
{
|
{
|
||||||
@ -277,7 +281,7 @@ class groupdav extends HTTP_WebDAV_Server
|
|||||||
{
|
{
|
||||||
$displayname = 'EGroupware (Cal|Card|Group)DAV server';
|
$displayname = 'EGroupware (Cal|Card|Group)DAV server';
|
||||||
}
|
}
|
||||||
|
|
||||||
$displayname = translation::convert($displayname, translation::charset(),'utf-8');
|
$displayname = translation::convert($displayname, translation::charset(),'utf-8');
|
||||||
// self url
|
// self url
|
||||||
$props = array(
|
$props = array(
|
||||||
@ -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);
|
||||||
@ -395,7 +396,7 @@ class groupdav extends HTTP_WebDAV_Server
|
|||||||
$account = $this->accounts->read($account_lid);
|
$account = $this->accounts->read($account_lid);
|
||||||
$displayname = $GLOBALS['egw']->translation->convert($account['account_fullname'],
|
$displayname = $GLOBALS['egw']->translation->convert($account['account_fullname'],
|
||||||
$GLOBALS['egw']->translation->charset(),'utf-8');
|
$GLOBALS['egw']->translation->charset(),'utf-8');
|
||||||
|
|
||||||
if ($user < 0)
|
if ($user < 0)
|
||||||
{
|
{
|
||||||
$principalType = 'groups';
|
$principalType = 'groups';
|
||||||
@ -404,7 +405,7 @@ class groupdav extends HTTP_WebDAV_Server
|
|||||||
{
|
{
|
||||||
$principalType = 'users';
|
$principalType = 'users';
|
||||||
}
|
}
|
||||||
|
|
||||||
$props = array(
|
$props = array(
|
||||||
self::mkprop('current-user-principal',array(self::mkprop('href',$this->principalURL))),
|
self::mkprop('current-user-principal',array(self::mkprop('href',$this->principalURL))),
|
||||||
self::mkprop('owner',array(self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account_lid.'/'))),
|
self::mkprop('owner',array(self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account_lid.'/'))),
|
||||||
@ -421,7 +422,7 @@ class groupdav extends HTTP_WebDAV_Server
|
|||||||
self::mkprop('href','urn:uuid:'.$GLOBALS['egw_info']['user']['account_lid']))),
|
self::mkprop('href','urn:uuid:'.$GLOBALS['egw_info']['user']['account_lid']))),
|
||||||
self::mkprop(groupdav::CALENDARSERVER,'email-address-set',array(
|
self::mkprop(groupdav::CALENDARSERVER,'email-address-set',array(
|
||||||
self::mkprop(groupdav::CALENDARSERVER,'email-address',$GLOBALS['egw_info']['user']['email']))),
|
self::mkprop(groupdav::CALENDARSERVER,'email-address',$GLOBALS['egw_info']['user']['email']))),
|
||||||
self::mkprop('getetag','EGw-no-etag-wGE'), // iPhone addressbook requires an etag here!
|
self::mkprop('getetag','EGw-no-etag-wGE'), // iPhone addressbook requires an etag here!
|
||||||
);
|
);
|
||||||
|
|
||||||
switch ($app)
|
switch ($app)
|
||||||
@ -707,16 +708,16 @@ class groupdav extends HTTP_WebDAV_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
|
if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
|
||||||
|
|
||||||
$this->_parse_path($options['path'],$id,$app,$user);
|
$this->_parse_path($options['path'],$id,$app,$user);
|
||||||
|
|
||||||
if (($handler = self::app_handler($app)) && method_exists($handler, 'post'))
|
if (($handler = self::app_handler($app)) && method_exists($handler, 'post'))
|
||||||
{
|
{
|
||||||
return $handler->post($options,$id,$user);
|
return $handler->post($options,$id,$user);
|
||||||
}
|
}
|
||||||
return '501 Not Implemented';
|
return '501 Not Implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PUT method handler
|
* PUT method handler
|
||||||
*
|
*
|
||||||
@ -734,7 +735,7 @@ class groupdav extends HTTP_WebDAV_Server
|
|||||||
$options['content'] .= fread($options['stream'],8192);
|
$options['content'] .= fread($options['stream'],8192);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
|
if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
|
||||||
|
|
||||||
if (!$this->_parse_path($options['path'],$id,$app,$user,$prefix))
|
if (!$this->_parse_path($options['path'],$id,$app,$user,$prefix))
|
||||||
@ -926,7 +927,7 @@ class groupdav extends HTTP_WebDAV_Server
|
|||||||
}
|
}
|
||||||
$parts = explode('/', $this->_unslashify($path));
|
$parts = explode('/', $this->_unslashify($path));
|
||||||
|
|
||||||
if (($account_id = $this->accounts->name2id($parts[0], 'account_lid')) ||
|
if (($account_id = $this->accounts->name2id($parts[0], 'account_lid')) ||
|
||||||
($account_id = $this->accounts->name2id($parts[0]=urldecode($parts[0]))))
|
($account_id = $this->accounts->name2id($parts[0]=urldecode($parts[0]))))
|
||||||
{
|
{
|
||||||
// /$user/$app/...
|
// /$user/$app/...
|
||||||
|
@ -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
|
||||||
@ -277,7 +277,7 @@ abstract class groupdav_handler
|
|||||||
if ($this->debug) error_log(__METHOD__."($method,,$id) HTTP_IF_NONE_MATCH='$_SERVER[HTTP_IF_NONE_MATCH]', etag='$etag': 304 Not Modified");
|
if ($this->debug) error_log(__METHOD__."($method,,$id) HTTP_IF_NONE_MATCH='$_SERVER[HTTP_IF_NONE_MATCH]', etag='$etag': 304 Not Modified");
|
||||||
return '304 Not Modified';
|
return '304 Not Modified';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
||||||
{
|
{
|
||||||
@ -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,12 +366,13 @@ abstract class groupdav_handler
|
|||||||
{
|
{
|
||||||
if ((int)$matches[1] < 868) $agent .= '_old';
|
if ((int)$matches[1] < 868) $agent .= '_old';
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($debug) error_log(__METHOD__."GroupDAV client: $agent");
|
if ($debug) error_log(__METHOD__."GroupDAV client: $agent");
|
||||||
|
|
||||||
return $agent;
|
return $agent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class groupdav_hooks
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Show GroupDAV preferences link in preferences
|
* Show GroupDAV preferences link in preferences
|
||||||
*
|
*
|
||||||
* @param string|array $args
|
* @param string|array $args
|
||||||
*/
|
*/
|
||||||
public static function menus($args)
|
public static function menus($args)
|
||||||
@ -41,7 +41,7 @@ class groupdav_hooks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* populates $settings for the preferences
|
* populates $settings for the preferences
|
||||||
*
|
*
|
||||||
@ -71,7 +71,7 @@ class groupdav_hooks
|
|||||||
'O' => lang('All in one'),
|
'O' => lang('All in one'),
|
||||||
'A' => lang('All'),
|
'A' => lang('All'),
|
||||||
) + $addressbooks;
|
) + $addressbooks;
|
||||||
|
|
||||||
// rewriting owner=0 to 'U', as 0 get's always selected by prefs
|
// rewriting owner=0 to 'U', as 0 get's always selected by prefs
|
||||||
if (!isset($addressbooks[0]))
|
if (!isset($addressbooks[0]))
|
||||||
{
|
{
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user