Author: ralfbecker
New Revision: 55600
URL: http://svn.stylite.de/viewvc/egroupware?rev=55600&view=rev
Log:
fix all IDE warnings, before moving classes to api, in case we want to merge it back to 14.x
Modified:
trunk/addressbook/inc/class.addressbook_groupdav.inc.php
trunk/calendar/inc/class.calendar_groupdav.inc.php
trunk/infolog/inc/class.infolog_groupdav.inc.php
trunk/phpgwapi/inc/class.groupdav.inc.php
trunk/phpgwapi/inc/class.groupdav_handler.inc.php
trunk/phpgwapi/inc/class.groupdav_hooks.inc.php
trunk/phpgwapi/inc/class.groupdav_principals.inc.php
ā trunk/addressbook/inc/class.addressbook_groupdav.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_groupdav.inc.php Sat Apr 2 10:40:34 2016
@@ -1,6 +1,6 @@
<?php
/**
- * EGroupware: GroupDAV access: addressbook handler
+ * EGroupware: CalDAV/CardDAV/GroupDAV access: Addressbook handler
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
@@ -21,8 +21,6 @@
*
* Permanent error_log() calls should use $this->groupdav->log($str) instead, to be send to PHP error_log()
* and our request-log (prefixed with "### " after request and response, like exceptions).
- *
- * @todo check/fix contacts in LDAP (no carddav_name column!)
*/
class addressbook_groupdav extends groupdav_handler
{
@@ -106,7 +104,7 @@
* @param array &$options
* @param array &$files
* @param int $user account_id
- * @param string $id=''
+ * @param string $id =''
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
*/
function propfind($path,&$options,&$files,$user,$id='')
@@ -127,6 +125,7 @@
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) $filter['account_id'] = null;
// process REPORT filters or multiget href's
+ $nresults = null;
if (($id || $options['root']['name'] != 'propfind') && !$this->_report_filters($options,$filter,$id, $nresults))
{
return false;
@@ -188,7 +187,7 @@
*
* @param string $path
* @param array& $filter
- * @param array|boolean $start=false false=return all or array(start,num)
+ * @param array|boolean $start =false false=return all or array(start,num)
* @return array with "files" array with values for keys path and props
*/
function &propfind_callback($path,array &$filter,$start=false,$report_not_found_multiget_ids=true)
@@ -384,6 +383,7 @@
$options['filters']['attrs']['test'] : 'anyof';
$prop_filters = array();
+ $matches = $prop_test = $column = null;
foreach($options['filters'] as $n => $filter)
{
if (!is_int($n)) continue; // eg. attributes of filter xml element
@@ -464,7 +464,7 @@
if ($prop_filters)
{
$filters[] = $filter = '(('.implode($filter_test=='allof'?') AND (':') OR (', $prop_filters).'))';
- if ($this->debug) error_log(__METHOD__."($path,...) sql-filter: $filter");
+ if ($this->debug) error_log(__METHOD__."(path=$options[path], ...) sql-filter: $filter");
}
}
// parse limit from $options['other']
@@ -537,11 +537,13 @@
*
* @param array &$options
* @param int $id
- * @param int $user=null account_id
+ * @param int $user =null account_id
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
*/
function get(&$options,$id,$user=null)
{
+ unset($user); // not used, but required by function signature
+
if (!is_array($contact = $this->_common_get_put_delete('GET',$options,$id)))
{
return $contact;
@@ -561,8 +563,8 @@
*
* @param array &$options
* @param int $id
- * @param int $user=null account_id of owner, default null
- * @param string $prefix=null user prefix from path (eg. /ralf from /ralf/addressbook)
+ * @param int $user =null account_id of owner, default null
+ * @param string $prefix =null user prefix from path (eg. /ralf from /ralf/addressbook)
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
*/
function put(&$options,$id,$user=null,$prefix=null)
@@ -577,9 +579,9 @@
}
$handler = self::_get_handler();
- $vCard = htmlspecialchars_decode($options['content']);
// Fix for Apple Addressbook
- $vCard = preg_replace('/item\d\.(ADR|TEL|EMAIL|URL)/', '\1', $vCard);
+ $vCard = preg_replace('/item\d\.(ADR|TEL|EMAIL|URL)/', '\1',
+ htmlspecialchars_decode($options['content']));
$charset = null;
if (!empty($options['content_type']))
{
@@ -733,8 +735,10 @@
{
$new_members = array($new_members);
}
- foreach($new_members as &$uid) $uid = substr($uid,9); // cut off "urn:uuid:" prefix
-
+ foreach($new_members as &$uid)
+ {
+ $uid = substr($uid,9); // cut off "urn:uuid:" prefix
+ }
if ($oldContact)
{
$to_add = array_diff($new_members,$oldContact['members']);
@@ -809,6 +813,7 @@
$lists_ctag = $this->bo->lists_ctag($user);
}
//error_log(__METHOD__."('$path', ".array2string($user_in).") --> user=".array2string($user)." --> ctag=$ctag=".date('Y-m-d H:i:s',$ctag).", lists_ctag=".($lists_ctag ? $lists_ctag.'='.date('Y-m-d H:i:s',$lists_ctag) : '').' returning '.max($ctag,$lists_ctag));
+ unset($user_in);
return $ctags[$path] = max($ctag, $accounts_ctag, $lists_ctag);
}
@@ -830,14 +835,16 @@
*
* @link http://www.mail-archive.com/calendarserver-users@lists.macosforge.org/msg01156.html
*
- * @param array $props=array() regular props by the groupdav handler
+ * @param array $props =array() regular props by the groupdav handler
* @param string $displayname
- * @param string $base_uri=null base url of handler
- * @param int $user=null account_id of owner of collection
+ * @param string $base_uri =null base url of handler
+ * @param int $user =null account_id of owner of collection
* @return array
*/
- public function extra_properties(array $props=array(), $displayname, $base_uri=null, $user=null)
- {
+ public function extra_properties(array $props, $displayname, $base_uri=null, $user=null)
+ {
+ unset($displayname, $base_uri, $user); // not used, but required by function signature
+
if (!isset($props['addressbook-description']))
{
// default addressbook description: can be overwritten via PROPPATCH, in which case it's already set
@@ -889,6 +896,7 @@
$databaseFields['X-ABSHOWAS'] = $supportedFields['X-ABSHOWAS'] = array('fileas_type'); // Horde vCard class uses uppercase prop-names!
// Apple Addressbook pre Lion (OS X 10.7) messes up CLASS and CATEGORIES (Lion cant set them but leaves them alone)
+ $matches = null;
if (preg_match('|CFNetwork/([0-9]+)|i', $_SERVER['HTTP_USER_AGENT'],$matches) && $matches[1] < 520 ||
// iOS 5.1.1 does not display CLASS or CATEGORY, but wrongly escapes multiple, comma-separated categories
// and appends CLASS: PUBLIC to an empty NOTE: field --> leaving them out for iOS
@@ -946,17 +954,17 @@
* the same UID and/or carddav_name as not deleted contacts and would block access to valid entries
*
* @param string|int $id
- * @param string $path=null
+ * @param string $path =null
* @return array|boolean array with entry, false if no read rights, null if $id does not exist
*/
function read($id, $path=null)
{
- static $non_deleted_tids;
+ static $non_deleted_tids=null;
if (is_null($non_deleted_tids))
{
- $non_deleted_tids = $this->bo->content_types;
- unset($non_deleted_tids[Api\Contacts::DELETED_TYPE]);
- $non_deleted_tids = array_keys($non_deleted_tids);
+ $tids = $this->bo->content_types;
+ unset($tids[Api\Contacts::DELETED_TYPE]);
+ $non_deleted_tids = array_keys($tids);
}
$contact = $this->bo->read(array(self::$path_attr => $id, 'tid' => $non_deleted_tids));
@@ -1044,7 +1052,7 @@
/**
* Return calendars/addressbooks shared from other users with the current one
*
- * @param boolean $ignore_all_in_one=false if true, return selected addressbooks and not array() for all-in-one
+ * @param boolean $ignore_all_in_one =false if true, return selected addressbooks and not array() for all-in-one
* @return array account_id => account_lid pairs
*/
function get_shared($ignore_all_in_one=false)
@@ -1065,7 +1073,7 @@
$this->home_set_pref[$key] = $id;
}
}
- foreach($this->bo->get_addressbooks(EGW_ACL_READ) as $id => $label)
+ foreach(array_keys($this->bo->get_addressbooks(EGW_ACL_READ)) as $id)
{
if (($id || !$GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) &&
$GLOBALS['egw_info']['user']['account_id'] != $id && // no current user and no accounts, if disabled in ab prefs
Modified: trunk/calendar/inc/class.calendar_groupdav.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_groupdav.inc.php?rev=55600&r1=55599&r2=55600&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_groupdav.inc.php (original)
+++ trunk/calendar/inc/class.calendar_groupdav.inc.php Sat Apr 2 10:40:34 2016
@@ -1,13 +1,13 @@
<?php
/**
- * EGroupware: CalDAV / GroupDAV access: calendar handler
+ * EGroupware: CalDAV/CardDAV/GroupDAV access: Calendar handler
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package calendar
* @subpackage groupdav
* @author Ralf Becker
- * @copyright (c) 2007-15 by Ralf Becker
+ * @copyright (c) 2007-16 by Ralf Becker
* @version $Id$
*/
Modified: trunk/infolog/inc/class.infolog_groupdav.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/infolog/inc/class.infolog_groupdav.inc.php?rev=55600&r1=55599&r2=55600&view=diff
==============================================================================
--- trunk/infolog/inc/class.infolog_groupdav.inc.php (original)
+++ trunk/infolog/inc/class.infolog_groupdav.inc.php Sat Apr 2 10:40:34 2016
@@ -1,13 +1,13 @@
<?php
/**
- * EGroupware: GroupDAV access: infolog handler
+ * EGroupware: CalDAV/CardDAV/GroupDAV access: InfoLog handler
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package infolog
* @subpackage groupdav
* @author Ralf Becker
- * @copyright (c) 2007-15 by Ralf Becker
+ * @copyright (c) 2007-16 by Ralf Becker
* @version $Id$
*/
@@ -146,6 +146,7 @@
$filter = $this->get_infolog_filter($path, $user);
// process REPORT filters or multiget href's
+ $nresults = null;
if (($id || $options['root']['name'] != 'propfind') && !$this->_report_filters($options, $filter, $id, $nresults))
{
// return empty collection, as iCal under iOS 5 had problems with returning "404 Not found" status
@@ -217,7 +218,7 @@
*
* @param string $path
* @param array $filter
- * @param array|boolean $start=false false=return all or array(start,num)
+ * @param array|boolean $start =false false=return all or array(start,num)
* @return array with "files" array with values for keys path and props
*/
function &propfind_callback($path,array $filter,$start=false)
@@ -234,6 +235,7 @@
$order = 'info_datemodified';
$sort = 'DESC';
+ $matches = null;
if (preg_match('/^([a-z0-9_]+)( DESC| ASC)?$/i', $filter['order'], $matches))
{
$order = $matches[1];
@@ -337,8 +339,6 @@
{
if ($options['filters'])
{
- $cal_filters_in = $cal_filters; // remember filter, to be able to reset standard open-filter, if client sets own filters
-
foreach($options['filters'] as $filter)
{
switch($filter['name'])
@@ -508,7 +508,7 @@
"NOT info_datecompleted > 0". (isset($end) ? " AND info_created < $end" : '').
')';
$sql = '('.implode(' OR ', $to_or).')';
- if ($this->debug > 1) error_log(__FILE__ . __METHOD__.'('.array2string($attrs).") time-range={$filter['attrs']['start']}-{$filter['attrs']['end']} --> $sql");
+ if ($this->debug > 1) error_log(__FILE__ . __METHOD__.'('.array2string($attrs).") time-range=$attrs[start]-$attrs[end] --> $sql");
return $sql;
}
@@ -517,11 +517,13 @@
*
* @param array &$options
* @param int $id
- * @param int $user=null account_id
+ * @param int $user =null account_id
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
*/
function get(&$options,$id,$user=null)
{
+ unset($user); // not used, but required by function signature
+
if (!is_array($task = $this->_common_get_put_delete('GET',$options,$id)))
{
return $task;
@@ -539,12 +541,14 @@
*
* @param array &$options
* @param int $id
- * @param int $user=null account_id of owner, default null
- * @param string $prefix=null user prefix from path (eg. /ralf from /ralf/addressbook)
+ * @param int $user =null account_id of owner, default null
+ * @param string $prefix =null user prefix from path (eg. /ralf from /ralf/addressbook)
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
*/
function put(&$options,$id,$user=null,$prefix=null)
{
+ unset($prefix); // not used, but required by function signature
+
if ($this->debug) error_log(__METHOD__."($id, $user)".print_r($options,true));
$oldTask = $this->_common_get_put_delete('PUT',$options,$id);
@@ -584,9 +588,9 @@
// send evtl. necessary respose headers: Location, etag, ...
// but only for new entries, as X-INFOLOG-STATUS get's not updated on client, if we confirm with an etag
- if ($retval !== true && (!$path_attr_is_name ||
+ if ($retval !== true)
// POST with add-member query parameter
- $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_GET['add-member'])))
+ //$_SERVER['REQUEST_METHOD'] == 'POST' && isset($_GET['add-member'])))
{
$this->put_response_headers($infoId, $options['path'], $retval, self::$path_attr == 'caldav_name');
}
@@ -609,7 +613,7 @@
* Callback for infolog_ical::importVTODO to implement infolog-cat-action
*
* @param array $task
- * @param array $oldTask=null
+ * @param array $oldTask =null
* @return array modified task data
*/
public function cat_action(array $task, $oldTask=null)
@@ -768,14 +772,16 @@
/**
* Add extra properties for calendar collections
*
- * @param array $props=array() regular props by the groupdav handler
+ * @param array $props =array() regular props by the groupdav handler
* @param string $displayname
- * @param string $base_uri=null base url of handler
- * @param int $user=null account_id of owner of collection
+ * @param string $base_uri =null base url of handler
+ * @param int $user =null account_id of owner of collection
* @return array
*/
- public function extra_properties(array $props=array(), $displayname, $base_uri=null,$user=null)
- {
+ public function extra_properties(array $props, $displayname, $base_uri=null,$user=null)
+ {
+ unset($base_uri); // not used, but required by function signature
+
// calendar description
$displayname = translation::convert(lang('Tasks of'),translation::charset(),'utf-8').' '.$displayname;
$props['calendar-description'] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-description',$displayname);
Modified: trunk/phpgwapi/inc/class.groupdav.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/inc/class.groupdav.inc.php?rev=55600&r1=55599&r2=55600&view=diff
==============================================================================
--- trunk/phpgwapi/inc/class.groupdav.inc.php (original)
+++ trunk/phpgwapi/inc/class.groupdav.inc.php Sat Apr 2 10:40:34 2016
@@ -252,7 +252,7 @@
$this->dav_powered_by = str_replace('EGroupware','EGroupware '.$GLOBALS['egw_info']['server']['versions']['phpgwapi'],
$this->dav_powered_by);
- parent::__Construct();
+ parent::__construct();
// hack to allow to use query parameters in WebDAV, which HTTP_WebDAV_Server interprets as part of the path
list($this->_SERVER['REQUEST_URI']) = explode('?',$this->_SERVER['REQUEST_URI']);
/*if (substr($this->_SERVER['REQUEST_URI'],-13) == '/;add-member/')
@@ -306,6 +306,8 @@
*/
function OPTIONS($path, &$dav, &$allow)
{
+ unset($allow); // not used, but required by function signature
+
// locking support
if (!in_array('2', $dav)) $dav[] = '2';
@@ -361,6 +363,7 @@
$this->propfind_options = $options;
// parse path in form [/account_lid]/app[/more]
+ $id = $app = $user = $user_prefix = null;
if (!self::_parse_path($options['path'],$id,$app,$user,$user_prefix) && $app && !$user && $user !== 0)
{
if ($this->debug > 1) error_log(__CLASS__."::$method: user='$user', app='$app', id='$id': 404 not found!");
@@ -435,9 +438,9 @@
* Add a collection to a PROPFIND request
*
* @param string $path
- * @param array $props=array() extra properties 'resourcetype' is added anyway, name => value pairs or name => HTTP_WebDAV_Server([namespace,]name,value)
- * @param array $privileges=array('read') values for current-user-privilege-set
- * @param array $supported_privileges=null default $this->supported_privileges
+ * @param array $props =array() extra properties 'resourcetype' is added anyway, name => value pairs or name => HTTP_WebDAV_Server([namespace,]name,value)
+ * @param array $privileges =array('read') values for current-user-privilege-set
+ * @param array $supported_privileges =null default $this->supported_privileges
* @return array with values for keys 'path' and 'props'
*/
public function add_collection($path, array $props = array(), array $privileges=array('read','read-acl','read-current-user-privilege-set'), array $supported_privileges=null)
@@ -454,9 +457,9 @@
* Add a resource to a PROPFIND request
*
* @param string $path
- * @param array $props=array() extra properties 'resourcetype' is added anyway, name => value pairs or name => HTTP_WebDAV_Server([namespace,]name,value)
- * @param array $privileges=array('read') values for current-user-privilege-set
- * @param array $supported_privileges=null default $this->supported_privileges
+ * @param array $props =array() extra properties 'resourcetype' is added anyway, name => value pairs or name => HTTP_WebDAV_Server([namespace,]name,value)
+ * @param array $privileges =array('read') values for current-user-privilege-set
+ * @param array $supported_privileges =null default $this->supported_privileges
* @return array with values for keys 'path' and 'props'
*/
public function add_resource($path, array $props = array(), array $privileges=array('read','read-current-user-privilege-set'), array $supported_privileges=null)
@@ -529,7 +532,7 @@
*
* @param string $name name of privilege
* @param string|array $data string with describtion or array with agregated privileges plus value for key '*description*', '*ns*', '*only*'
- * @param string $path=null path to match with $data['*only*']
+ * @param string $path =null path to match with $data['*only*']
* @return array of self::mkprop() arrays
*/
protected function supported_privilege($name, $data, $path=null)
@@ -557,8 +560,8 @@
* Checks if a given property was requested in propfind request
*
* @param string $name property name
- * @param string $ns=null namespace, if that is to be checked too
- * @param boolean $return_prop=false if true return the property array with values for 'name', 'xmlns', 'attrs', 'children'
+ * @param string $ns =null namespace, if that is to be checked too
+ * @param boolean $return_prop =false if true return the property array with values for 'name', 'xmlns', 'attrs', 'children'
* @return boolean|string|array true: $name explicitly requested (or autoindex), "all": allprop or "names": propname requested, false: $name was not requested
*/
function prop_requested($name, $ns=null, $return_prop=false)
@@ -686,14 +689,14 @@
*
* @param array &$files
* @param string $path / or //
- * @param int $depth=0
+ * @param int $depth =0
* @return string|boolean http status or true|false
*/
protected function add_resources_collection(array &$files, $path, $depth=0)
{
if (!isset($GLOBALS['egw_info']['user']['apps']['resources']))
{
- if ($this->debug) error_log(__CLASS__."::$method(path=$path) 403 Forbidden: no app rights for 'resources'");
+ if ($this->debug) error_log(__METHOD__."(path=$path) 403 Forbidden: no app rights for 'resources'");
return "403 Forbidden: no app rights for 'resources'"; // no rights for the given app
}
list(,$what) = explode('/', $path);
@@ -707,7 +710,7 @@
}
if ($depth)
{
- foreach(groupdav_principals::get_resources() as $res_id => $resource)
+ foreach(groupdav_principals::get_resources() as $resource)
{
if ($is_location == groupdav_principals::resource_is_location($resource))
{
@@ -788,9 +791,9 @@
* Add an application collection to a user home or the root
*
* @param string $app
- * @param boolean $no_extra_types=false should the GroupDAV and CalDAV types be added (KAddressbook has problems with it in self URL)
- * @param int $user=null owner of the collection, default current user
- * @param string $path='/'
+ * @param boolean $no_extra_types =false should the GroupDAV and CalDAV types be added (KAddressbook has problems with it in self URL)
+ * @param int $user =null owner of the collection, default current user
+ * @param string $path ='/'
* @return array with values for keys 'path' and 'props'
*/
protected function add_app($app,$no_extra_types=false,$user=null,$path='/')
@@ -800,6 +803,7 @@
if (is_string($user) && $user[0] == 'r' && ($resource = groupdav_principals::read_resource(substr($user, 1))))
{
$is_location = groupdav_principals::resource_is_location($resource);
+ $displayname = null;
list($principalType, $account_lid) = explode('/', groupdav_principals::resource2name($resource, $is_location, $displayname));
}
elseif ($user)
@@ -857,6 +861,7 @@
}
// add props modifyable via proppatch from client, eg. calendar-color, see self::$proppatch_props
+ $ns = null;
foreach((array)$GLOBALS['egw_info']['user']['preferences'][$app] as $name => $value)
{
unset($ns);
@@ -972,6 +977,7 @@
{
if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
+ $id = $app = $user = null;
if (!$this->_parse_path($options['path'],$id,$app,$user) || $app == 'principals')
{
return $this->autoindex($options);
@@ -1031,6 +1037,7 @@
//'DAV:sync-token' => 'sync-token',
);
$n = 0;
+ $collection_props = null;
foreach($files['files'] as $file)
{
if (!isset($collection_props))
@@ -1042,7 +1049,10 @@
if(!$n++)
{
echo "
\n\t\n\t\t| # | \n\t\t".lang('Name')." | ";
- foreach($props2show as $label) echo "\t\t".lang($label)." | \n";
+ foreach($props2show as $label)
+ {
+ echo "\t\t".lang($label)." | \n";
+ }
echo "\t
\n";
}
$props = $this->props2array($file['props']);
@@ -1083,9 +1093,9 @@
foreach($collection_props as $name => $value)
{
$class = $class == 'row_on' ? 'row_off' : 'row_on';
- $ns = explode(':',$name);
- $name = array_pop($ns);
- $ns = implode(':',$ns);
+ $parts = explode(':', $name);
+ $name = array_pop($parts);
+ $ns = implode(':', $parts);
echo "\t\n\t\t| ".htmlspecialchars($ns)." |
".htmlspecialchars($name)." | \n";
echo "\t\t".$value." | \n\t
\n";
}
@@ -1132,14 +1142,13 @@
{
$value = preg_replace('/\<(D:)?href\>('.preg_quote($this->base_uri.'/','/').')?([^<]+)\<\/(D:)?href\>/i','<\\1href>\\3',$value);
}
- $value = $value[0] == '<' || strpos($value, "\n") !== false ? ''.htmlspecialchars($value).'
' : htmlspecialchars($value);
+ $ret = $value[0] == '<' || strpos($value, "\n") !== false ? ''.htmlspecialchars($value).'
' : htmlspecialchars($value);
if ($href)
{
- $value = preg_replace('/<a href="(.+)">/', '', $value);
- $value = str_replace('</a>', '', $value);
- }
- return $value;
+ $ret = str_replace('</a>', '', preg_replace('/<a href="(.+)">/', '', $ret));
+ }
+ return $ret;
}
/**
@@ -1204,6 +1213,7 @@
}
if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
+ $id = $app = $user = null;
$this->_parse_path($options['path'],$id,$app,$user);
if (($handler = self::app_handler($app)))
@@ -1267,12 +1277,14 @@
switch($action)
{
case 'attachment-add':
+ $matches = null;
if (isset($this->_SERVER['HTTP_CONTENT_DISPOSITION']) &&
substr($this->_SERVER['HTTP_CONTENT_DISPOSITION'], 0, 10) === 'attachment' &&
preg_match('/filename="?([^";]+)/', $this->_SERVER['HTTP_CONTENT_DISPOSITION'], $matches))
{
$filename = egw_vfs::basename($matches[1]);
}
+ $path = null;
if (!($to = self::fopen_attachment($handler->app, $handler->get_id($entry), $filename, $this->_SERVER['CONTENT_TYPE'], $path)) ||
isset($options['stream']) && ($copied=stream_copy_to_stream($options['stream'], $to)) === false ||
isset($options['content']) && ($copied=fwrite($to, $options['content'])) === false)
@@ -1288,7 +1300,7 @@
case 'attachment-remove':
case 'attachment-update':
- if (empty($_GET['managed-id']) || !($path = self::managed_id2path($_GET['managed-id'], $app, $id)))
+ if (empty($_GET['managed-id']) || !($path = self::managed_id2path($_GET['managed-id'], $handler->app, $id)))
{
self::xml_error(self::mkprop(self::CALDAV, 'valid-managed-id-parameter', ''));
return '403 Forbidden';
@@ -1340,7 +1352,7 @@
// check/handle Prefer: return-representation
// we can NOT use 204 No content (forbidds a body) with return=representation, therefore we need to use 200 Ok instead!
- if ($handler->check_return_representation($options, $id, $user) && (int)$ret == 204)
+ if ($handler->check_return_representation($options, $id) && (int)$ret == 204)
{
$ret = '200 Ok';
}
@@ -1446,19 +1458,20 @@
*
* @param string $app
* @param int|string $id
- * @param string $filename defaults to 'attachment'
- * @param string $mime=null mime-type to generate extension
- * @param string &$path=null on return path opened
+ * @param string $_filename defaults to 'attachment'
+ * @param string $mime =null mime-type to generate extension
+ * @param string &$path =null on return path opened
* @return resource
*/
- protected static function fopen_attachment($app, $id, $filename, $mime=null, &$path=null)
- {
- $filename = empty($filename) ? 'attachment' : egw_vfs::basename($filename);
+ protected static function fopen_attachment($app, $id, $_filename, $mime=null, &$path=null)
+ {
+ $filename = empty($_filename) ? 'attachment' : egw_vfs::basename($_filename);
if (strpos($mime, ';')) list($mime) = explode(';', $mime); // in case it contains eg. charset info
$ext = !empty($mime) ? mime_magic::mime2ext($mime) : '';
+ $matches = null;
if (!$ext || substr($filename, -strlen($ext)-1) == '.'.$ext ||
preg_match('/\.([^.]+)$/', $filename, $matches) && mime_magic::ext2mime($matches[1]) == $mime)
{
@@ -1494,7 +1507,7 @@
*/
protected static function path2location($path)
{
- static $url_prefix;
+ static $url_prefix = null;
if (!isset($url_prefix))
{
$url_prefix = '';
@@ -1560,8 +1573,8 @@
* Return vfs-path of a managed-id
*
* @param string $managed_id
- * @param string $app=null app-name to check against path
- * @param string|int $id=null id to check agains path
+ * @param string $app =null app-name to check against path
+ * @param string|int $id =null id to check agains path
* @return string|boolean "/apps/$app/$id/something" or false if not found or not belonging to given $app/$id
*/
static public function managed_id2path($managed_id, $app=null, $id=null)
@@ -1619,11 +1632,15 @@
if ($this->debug) error_log(__METHOD__."(".array2string($options).')');
// parse path in form [/account_lid]/app[/more]
+ $id = $app = $user = $user_prefix = null;
self::_parse_path($options['path'],$id,$app,$user,$user_prefix); // allways returns false if eg. !$id
if ($app == 'principals' || $id || $options['path'] == '/')
{
if ($this->debug > 1) error_log(__METHOD__.": user='$user', app='$app', id='$id': 404 not found!");
- foreach($options['props'] as &$prop) $prop['status'] = '403 Forbidden';
+ foreach($options['props'] as &$prop)
+ {
+ $prop['status'] = '403 Forbidden';
+ }
return 'NOT allowed to PROPPATCH that resource!';
}
// store selected props in preferences, eg. calendar-color, see self::$proppatch_props
@@ -1699,6 +1716,7 @@
if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
+ $id = $app = $user = $prefix = null;
if (!$this->_parse_path($options['path'],$id,$app,$user,$prefix))
{
return '404 Not Found';
@@ -1734,6 +1752,7 @@
{
if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
+ $id = $app = $user = null;
if (!$this->_parse_path($options['path'],$id,$app,$user))
{
return '404 Not Found';
@@ -1795,6 +1814,7 @@
*/
function LOCK(&$options)
{
+ $id = $app = $user = null;
self::_parse_path($options['path'],$id,$app,$user);
$path = egw_vfs::app_entry_lock_path($app,$id);
@@ -1828,6 +1848,7 @@
*/
function UNLOCK(&$options)
{
+ $id = $app = $user = null;
self::_parse_path($options['path'],$id,$app,$user);
$path = egw_vfs::app_entry_lock_path($app,$id);
@@ -1843,10 +1864,10 @@
*/
function checkLock($path)
{
+ $id = $app = $user = null;
self::_parse_path($path,$id,$app,$user);
- $path = egw_vfs::app_entry_lock_path($app,$id);
-
- return egw_vfs::checkLock($path);
+
+ return egw_vfs::checkLock(egw_vfs::app_entry_lock_path($app, $id));
}
/**
@@ -1857,9 +1878,10 @@
*/
function ACL(&$options)
{
+ $id = $app = $user = null;
self::_parse_path($options['path'],$id,$app,$user);
- if ($this->debug) error_log(__METHOD__.'('.array2string($options).") path=$path");
+ if ($this->debug) error_log(__METHOD__.'('.array2string($options).") path=$options[path]");
$options['errors'] = array();
switch ($app)
@@ -1884,7 +1906,7 @@
* @param int &$id
* @param string &$app addressbook, calendar, infolog (=infolog)
* @param int &$user
- * @param string &$user_prefix=null
+ * @param string &$user_prefix =null
* @return boolean true on success, false on error
*/
function _parse_path($path,&$id,&$app,&$user,&$user_prefix=null)
@@ -2019,7 +2041,7 @@
/**
* Log the request
*
- * @param string $extra='' extra text to add below request-log, eg. exception thrown
+ * @param string $extra ='' extra text to add below request-log, eg. exception thrown
*/
protected function log_request($extra='')
{
@@ -2065,7 +2087,10 @@
$content .= 'HTTP/1.1 '.$this->_http_status."\n";
$content .= 'Date: '.str_replace('+0000', 'GMT', gmdate('r'))."\n";
$content .= 'Server: '.$_SERVER['SERVER_SOFTWARE']."\n";
- foreach(headers_list() as $line) $content .= $line."\n";
+ foreach(headers_list() as $line)
+ {
+ $content .= $line."\n";
+ }
if (($c = ob_get_flush())) $content .= "\n";
if (self::$log_level !== 'f' && strlen($c) > 1536) $c = substr($c,0,1536)."\n*** LOG TRUNKATED\n";
$content .= $c;
@@ -2084,7 +2109,10 @@
}
else
{
- foreach(explode("\n",$content) as $line) error_log($line);
+ foreach(explode("\n",$content) as $line)
+ {
+ error_log($line);
+ }
}
}
}
@@ -2093,7 +2121,7 @@
* Output xml error element
*
* @param string|array $xml_error string with name for empty element in DAV NS or array with props
- * @param string $human_readable=null human readable error message
+ * @param string $human_readable =null human readable error message
*/
public static function xml_error($xml_error, $human_readable=null)
{
@@ -2179,6 +2207,7 @@
public static function exception_handler(Exception $e)
{
// logging exception as regular egw_execption_hander does
+ $headline = null;
_egw_log_exception($e,$headline);
// exception handler sending message back to the client as basic auth message
Modified: trunk/phpgwapi/inc/class.groupdav_handler.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/inc/class.groupdav_handler.inc.php?rev=55600&r1=55599&r2=55600&view=diff
==============================================================================
--- trunk/phpgwapi/inc/class.groupdav_handler.inc.php (original)
+++ trunk/phpgwapi/inc/class.groupdav_handler.inc.php Sat Apr 2 10:40:34 2016
@@ -1,13 +1,13 @@
<?php
/**
- * EGroupware: GroupDAV access: abstract baseclass for groupdav/caldav/carddav handlers
+ * EGroupware: CalDAV/CardDAV/GroupDAV access: abstract baseclass for application handlers
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package api
* @subpackage groupdav
* @author Ralf Becker
- * @copyright (c) 2007-13 by Ralf Becker
+ * @copyright (c) 2007-16 by Ralf Becker
* @version $Id$
*/
@@ -119,7 +119,7 @@
function __construct($app, groupdav $groupdav)
{
$this->app = $app;
- if (!is_null($parent->debug)) $this->debug = $groupdav->debug;
+ if (!is_null($groupdav->debug)) $this->debug = $groupdav->debug;
$this->base_uri = $groupdav->base_uri;
$this->groupdav = $groupdav;
@@ -151,14 +151,17 @@
* @param int &$total
* @return array with "files" array with values for keys path and props
*/
- function &propfind_callback($path, array $filter,$start,&$total) { }
+ function &propfind_callback($path, array $filter,$start,&$total)
+ {
+ unset($path, $filter, $start, $total); // not used, but required by function signature
+ }
/**
* Handle get request for an applications entry
*
* @param array &$options
* @param int $id
- * @param int $user=null account_id
+ * @param int $user =null account_id
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
*/
abstract function get(&$options,$id,$user=null);
@@ -168,7 +171,7 @@
*
* @param array &$options
* @param int $id
- * @param int $user=null account_id of owner, default null
+ * @param int $user =null account_id of owner, default null
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
*/
abstract function put(&$options,$id,$user=null);
@@ -186,7 +189,7 @@
* Read an entry
*
* @param string|int $id
- * @param string $path=null implementation can use it, used in call from _common_get_put_delete
+ * @param string $path =null implementation can use it, used in call from _common_get_put_delete
* @return array|boolean array with entry, false if no read rights, null if $id does not exist
*/
abstract function read($id /*,$path=null*/);
@@ -214,21 +217,23 @@
/**
* Add extra properties for collections
*
- * @param array $props=array() regular props by the groupdav handler
+ * @param array $props =array() regular props by the groupdav handler
* @param string $displayname
- * @param string $base_uri=null base url of handler
- * @param int $user=null account_id of owner of collection
+ * @param string $base_uri =null base url of handler
+ * @param int $user =null account_id of owner of collection
* @return array
*/
- public function extra_properties(array $props=array(), $displayname, $base_uri=null, $user=null)
- {
+ public function extra_properties(array $props, $displayname, $base_uri=null, $user=null)
+ {
+ unset($displayname, $base_uri, $user); // not used, but required by function signature
+
return $props;
}
/**
* Get the etag for an entry, can be reimplemented for other algorithm or field names
*
- * @param array|int $event array with event or cal_id
+ * @param array|int $entry array with event or cal_id
* @return string|boolean string with etag or false
*/
function get_etag($entry)
@@ -268,7 +273,7 @@
* @param array &$options
* @param int|string &$id on return self::$path_extension got removed
* @param boolean &$return_no_access=false if set to true on call, instead of '403 Forbidden' the entry is returned and $return_no_access===false
- * @param boolean $ignore_if_match=false if true, ignore If-Match precondition
+ * @param boolean $ignore_if_match =false if true, ignore If-Match precondition
* @return array|string entry on success, string with http-error-code on failure, null for PUT on an unknown id
*/
function _common_get_put_delete($method,&$options,&$id,&$return_no_access=false,$ignore_if_match=false)
@@ -343,7 +348,7 @@
*
* @param array $options
* @param int $id
- * @param int $user=null account_id
+ * @param int $user =null account_id
* @return string|boolean http status of get or null if no representation was requested
*/
public function check_return_representation($options, $id, $user=null)
@@ -385,7 +390,7 @@
*/
public function update_tags($entry)
{
-
+ unset($entry); // not used, but required by function signature
}
/**
@@ -408,8 +413,6 @@
$handler_cache[$app] = new $class($app, $groupdav);
}
- if ($debug) error_log(__METHOD__."('$app')");
-
return $handler_cache[$app];
}
@@ -420,7 +423,7 @@
*/
static function get_agent()
{
- static $agent;
+ static $agent=null;
if (is_null($agent))
{
@@ -464,6 +467,7 @@
switch ($agent)
{
case 'cfnetwork':
+ $matches = null;
if (preg_match('/address%20book\/([0-9.]+)/', $user_agent, $matches))
{
if ((int)$matches[1] < 868) $agent .= '_old';
@@ -481,9 +485,7 @@
}
}
}
-
- if ($debug) error_log(__METHOD__."GroupDAV client: $agent");
-
+ //error_log(__METHOD__."GroupDAV client: $agent");
return $agent;
}
@@ -503,12 +505,14 @@
* Priviledges are for the collection, not the resources / entries!
*
* @param string $path path of collection
- * @param int $user=null owner of the collection, default current user
+ * @param int $user =null owner of the collection, default current user
* @return array with privileges
*/
public function current_user_privileges($path, $user=null)
{
- static $grants;
+ unset($path); // not used, but required by function signature
+
+ static $grants=null;
if (is_null($grants))
{
$grants = $this->get_grants();
@@ -556,8 +560,8 @@
* @param int|array $entry id or array of new created entry
* @param string $path
* @param int|string $retval
- * @param boolean $path_attr_is_name=true true: path_attr is ca(l|rd)dav_name, false: id (GroupDAV needs Location header)
- * @param string $etag=null etag, to not calculate it again (if != null)
+ * @param boolean $path_attr_is_name =true true: path_attr is ca(l|rd)dav_name, false: id (GroupDAV needs Location header)
+ * @param string $etag =null etag, to not calculate it again (if != null)
*/
function put_response_headers($entry, $path, $retval, $path_attr_is_name=true, $etag=null)
{
@@ -602,6 +606,8 @@
*/
static function get_settings($hook_data)
{
+ unset($hook_data); // not used, but required by function signature
+
return array();
}
@@ -655,13 +661,13 @@
*
* base_uri of WebDAV class can be both, depending on EGroupware config
*
- * @param boolean $full_uri=true
+ * @param boolean $full_uri =true
* @return string eg. https://domain.com/egroupware/groupdav.php
*/
public function base_uri($full_uri=true)
{
- static $uri;
- static $path;
+ static $uri=null;
+ static $path=null;
if (!isset($uri))
{
@@ -726,7 +732,7 @@
*
* @param string $path
* @param int $user parameter necessary to call getctag, if no $token specified
- * @param int $token=null modification time, default call getctag($path, $user) to fetch it
+ * @param int $token =null modification time, default call getctag($path, $user) to fetch it
* @return string
*/
public function get_sync_token($path, $user, $token=null)
@@ -822,7 +828,7 @@
*
* @param groupdav_handler $handler
* @param array $filter filter for propfind call
- * @param array $files=array() extra files/responses to return too
+ * @param array $files =array() extra files/responses to return too
*/
public function __construct(groupdav_handler $handler, $path, array $filter,array &$files=array())
{
Modified: trunk/phpgwapi/inc/class.groupdav_hooks.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/inc/class.groupdav_hooks.inc.php?rev=55600&r1=55599&r2=55600&view=diff
==============================================================================
--- trunk/phpgwapi/inc/class.groupdav_hooks.inc.php (original)
+++ trunk/phpgwapi/inc/class.groupdav_hooks.inc.php Sat Apr 2 10:40:34 2016
@@ -1,13 +1,13 @@
<?php
/**
- * EGroupware: GroupDAV hooks: eg. preferences
+ * EGroupware: CalDAV/CardDAV/GroupDAV access: hooks eg. preferences
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package api
* @subpackage groupdav
* @author Ralf Becker
- * @copyright (c) 2010-13 by Ralf Becker
+ * @copyright (c) 2010-16 by Ralf Becker
* @version $Id$
*/
Modified: trunk/phpgwapi/inc/class.groupdav_principals.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/inc/class.groupdav_principals.inc.php?rev=55600&r1=55599&r2=55600&view=diff
==============================================================================
--- trunk/phpgwapi/inc/class.groupdav_principals.inc.php (original)
+++ trunk/phpgwapi/inc/class.groupdav_principals.inc.php Sat Apr 2 10:40:34 2016
@@ -1,13 +1,13 @@
<?php
/**
- * EGroupware: GroupDAV access: groupdav/caldav/carddav principals handlers
+ * EGroupware: CalDAV/CardDAV/GroupDAV access: Principals handlers
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package api
* @subpackage groupdav
* @author Ralf Becker
- * @copyright (c) 2008-12 by Ralf Becker
+ * @copyright (c) 2008-16 by Ralf Becker
* @version $Id$
*/
@@ -78,11 +78,13 @@
* Currently we return all reports independed of path
*
* @param string $path eg. '/principals/'
- * @param array $reports=null
+ * @param array $reports =null
* @return array HTTP_WebDAV_Server::mkprop('supported-report-set', ...)
*/
protected function supported_report_set($path, array $reports=null)
{
+ unset($path); // not used, but required by function signature
+
if (is_null($reports)) $reports = $this->supported_reports;
$supported = array();
@@ -117,7 +119,7 @@
$this->groupdav->log(__METHOD__."('$path', ".array2string($options).",, $user) not implemented report, returning 501 Not Implemented");
return '501 Not Implemented';
}
- list(,$principals,$type,$name,$rest) = explode('/',$path,5);
+ list(,,$type,$name,$rest) = explode('/',$path,5);
// /principals/users/$name/
// /users/$name/calendar-proxy-read/
// /users/$name/calendar-proxy-write/
@@ -291,7 +293,7 @@
continue;
}
// find prop to expand
- foreach($prop_files['files'][0]['props'] as $name => $expand_prop)
+ foreach($prop_files['files'][0]['props'] as $expand_prop)
{
if ($expand_prop['name'] === $prop_name) break;
}
@@ -526,7 +528,10 @@
foreach($search_props as $search_prop)
{
// search resource for $search_prop
- foreach($resource['props'] as $prop) if ($prop['name'] === $search_prop['name']) break;
+ foreach($resource['props'] as $prop)
+ {
+ if ($prop['name'] === $search_prop['name']) break;
+ }
if ($prop['name'] === $search_prop['name']) // search_prop NOT found
{
foreach((array)$prop['val'] as $value)
@@ -559,7 +564,7 @@
*
* @param string $value value to test
* @param string $match criteria/sub-string
- * @param string $match_type='contains' 'starts-with', 'ends-with' or 'equals'
+ * @param string $match_type ='contains' 'starts-with', 'ends-with' or 'equals'
*/
private static function match($value, $match, $match_type='contains')
{
@@ -635,6 +640,8 @@
*/
function principal_search_property_set_report($path,&$options,&$files,$user)
{
+ unset($path, $options, $files, $user); // not used, but required by function signature
+
static $search_props = array(
// from iOS iCal
'displayname' => 'Display Name',
@@ -787,7 +794,10 @@
$this->groupdav->log(__METHOD__."('$name', ...) account '$name' NOT found OR not visible to you (check account-selection preference)!");
return '404 Not Found';
}
- while (substr($rest,-1) == '/') $rest = substr($rest,0,-1);
+ while (substr($rest,-1) == '/')
+ {
+ $rest = substr($rest,0,-1);
+ }
switch(