diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php
index 6f2c5cb431..2f6c620293 100644
--- a/addressbook/inc/class.addressbook_groupdav.inc.php
+++ b/addressbook/inc/class.addressbook_groupdav.inc.php
@@ -164,7 +164,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
if (isset($nresults))
{
- $files['files'] = $this->propfind_callback($path, $filter, array(0, (int)$nresults));
+ $files['files'] = $this->propfind_callback2($path, $filter, array(0, (int)$nresults));
// hack to support limit with sync-collection report: contacts are returned in modified ASC order (oldest first)
// if limit is smaller then full result, return modified-1 as sync-token, so client requests next chunk incl. modified
@@ -184,14 +184,28 @@ class addressbook_groupdav extends Api\CalDAV\Handler
}
/**
- * Callback for profind iterator
+ * Callback for propfind iterator
*
* @param string $path
* @param array& $filter
* @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)
+ function &propfind_callback($path, array $filter, $start=false)
+ {
+ return $this->propfind_callback2($path, $filter, $start);
+ }
+
+ /**
+ * Callback for propfind iterator with ability to skip reporting not found ids
+ *
+ * @param string $path
+ * @param array& $filter
+ * @param array|boolean $start =false false=return all or array(start,num)
+ * @param boolean $report_not_found_multiget_ids=true
+ * @return array with "files" array with values for keys path and props
+ */
+ function &propfind_callback2($path, array &$filter, $start=false, $report_not_found_multiget_ids=true)
{
//error_log(__METHOD__."('$path', ".array2string($filter).", ".array2string($start).", $report_not_found_multiget_ids)");
$starttime = microtime(true);
@@ -299,7 +313,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
if ($sync_collection_report) $token_was = $this->sync_collection_token;
self::$path_attr = 'id';
self::$path_extension = '.vcf';
- $files = array_merge($files, $this->propfind_callback($path, $accounts_filter, false, false));
+ $files = array_merge($files, $this->propfind_callback2($path, $accounts_filter, false, false));
self::$path_attr = 'carddav_name';
self::$path_extension = '';
if ($sync_collection_report && $token_was > $this->sync_collection_token)
diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php
index 599d694276..3e59d85b65 100644
--- a/addressbook/inc/class.addressbook_hooks.inc.php
+++ b/addressbook/inc/class.addressbook_hooks.inc.php
@@ -59,7 +59,7 @@ class addressbook_hooks
'link' => "javascript:egw.open('','$appname','add')"
),
'Advanced search' => "javascript:egw_openWindowCentered2('".
- Egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.search'),false).
+ Egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.extSearch'),false).
"','_blank',870,610,'yes')",
'Placeholders' => Egw::link('/index.php','menuaction=api.EGroupware\\Api\\Contacts\\Merge.show_replacements')
);
diff --git a/addressbook/inc/class.addressbook_import_contacts_csv.inc.php b/addressbook/inc/class.addressbook_import_contacts_csv.inc.php
index 656f296382..044cf2479b 100644
--- a/addressbook/inc/class.addressbook_import_contacts_csv.inc.php
+++ b/addressbook/inc/class.addressbook_import_contacts_csv.inc.php
@@ -67,12 +67,11 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
/**
* imports entries according to given definition object.
- * @param resource $_stream
- * @param string $_charset
- * @param definition $_definition
+ * @param importexport_definition $definition
+ * @param importexport_import_csv|null $import_csv
*/
- public function init(importexport_definition &$_definition ) {
-
+ protected function init(importexport_definition $definition, importexport_import_csv $import_csv = null)
+ {
// fetch the addressbook bo
$this->bocontacts = new addressbook_bo();
diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php
index a20f5eb42a..c354f3faf2 100644
--- a/addressbook/inc/class.addressbook_ui.inc.php
+++ b/addressbook/inc/class.addressbook_ui.inc.php
@@ -26,7 +26,7 @@ use EGroupware\Kanban\Hooks;
class addressbook_ui extends addressbook_bo
{
public $public_functions = array(
- 'search' => True,
+ 'extSearch' => True,
'edit' => True,
'view' => True,
'index' => True,
@@ -3301,7 +3301,7 @@ class addressbook_ui extends addressbook_bo
* @param array $_content
* @return string
*/
- function search($_content=array())
+ function extSearch($_content=array())
{
if(!empty($_content))
{
@@ -3481,7 +3481,7 @@ class addressbook_ui extends addressbook_bo
* Migrate contacts to or from LDAP (called by Admin >> Addressbook >> Site configuration (Admin only)
*
*/
- function migrate2ldap()
+ function migrate2ldap($type=null)
{
$GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' - '.lang('Migration to LDAP');
echo $GLOBALS['egw']->framework->header();
@@ -3493,7 +3493,7 @@ class addressbook_ui extends addressbook_bo
}
else
{
- parent::migrate2ldap($_GET['type']);
+ parent::migrate2ldap($type ?? $_GET['type']);
echo '
'.lang('Migration finished')."
\n";
}
echo $GLOBALS['egw']->framework->footer();
diff --git a/admin/inc/class.admin_asyncservice.inc.php b/admin/inc/class.admin_asyncservice.inc.php
index df66f9c39e..c21688e6a5 100644
--- a/admin/inc/class.admin_asyncservice.inc.php
+++ b/admin/inc/class.admin_asyncservice.inc.php
@@ -31,7 +31,7 @@ class admin_asyncservice
echo $GLOBALS['egw']->framework->header();
- $async = $GLOBALS['egw']->asyncservice; // use an own instance, as we might set debug=True
+ $async = new Api\Asyncservice(); // use an own instance, as we might set debug=True
$async->debug = !!$_POST['debug'];
diff --git a/admin/inc/class.admin_customfields.inc.php b/admin/inc/class.admin_customfields.inc.php
index fe26dbe79a..c285bbf1d5 100644
--- a/admin/inc/class.admin_customfields.inc.php
+++ b/admin/inc/class.admin_customfields.inc.php
@@ -146,11 +146,11 @@ class admin_customfields
// Handle incoming - types, options, etc.
if($this->manage_content_types)
{
- if(count($this->content_types) == 0)
+ if(empty($this->content_types))
{
$this->content_types = Api\Config::get_content_types($this->appname);
}
- if (count($this->content_types)==0)
+ if (empty($this->content_types))
{
// if you define your default types of your app with the search_link hook, they are available here, if no types were found
$this->content_types = (array)Api\Link::get_registry($this->appname,'default_types');
diff --git a/api/src/Asyncservice.php b/api/src/Asyncservice.php
index 55862d7813..ff766df323 100644
--- a/api/src/Asyncservice.php
+++ b/api/src/Asyncservice.php
@@ -659,7 +659,7 @@ class Asyncservice
$webserver = posix_getpwuid(posix_getuid ());
echo '
'.lang("You need to add the webserver user '%1' to the group '%2'.",$webserver['name'],$group['name'])."
\n"; }
}
- if (($fd = popen('/bin/sh -c "type -p '.$name.'"','r')))
+ if (function_exists('popen') && ($fd = popen('/bin/sh -c "type -p '.$name.'"','r')))
{
$this->$name = fgets($fd,256);
@pclose($fd);
@@ -707,7 +707,7 @@ class Asyncservice
}
$times = False;
$other_cronlines = array();
- if (($crontab = popen('/bin/sh -c "'.$this->crontab.' -l" 2>&1','r')) !== False)
+ if (function_exists('popen') && ($crontab = popen('/bin/sh -c "'.$this->crontab.' -l" 2>&1','r')) !== False)
{
$n = 0;
while ($line = fgets($crontab,256))
@@ -762,7 +762,7 @@ class Asyncservice
$other_cronlines = array();
$this->installed($other_cronlines); // find other installed cronlines
- if (($crontab = popen('/bin/sh -c "'.$this->crontab.' -" 2>&1','w')) !== False)
+ if (function_exists('popen') && ($crontab = popen('/bin/sh -c "'.$this->crontab.' -" 2>&1','w')) !== False)
{
foreach ($other_cronlines as $cronline)
{
diff --git a/api/src/Etemplate/Request/Cache.php b/api/src/Etemplate/Request/Cache.php
index 4f536aab91..d98cdc973b 100644
--- a/api/src/Etemplate/Request/Cache.php
+++ b/api/src/Etemplate/Request/Cache.php
@@ -76,9 +76,6 @@ class Cache extends Etemplate\Request
{
$this->id = $_id ? $_id : self::request_id();
//error_log(__METHOD__."($_id) this->id=$this->id");
-
- // hack to quiten IDE Warning for not calling parent::__construct, which we can not!
- if (false) parent::__construct();
}
/**
@@ -96,9 +93,10 @@ class Cache extends Etemplate\Request
* Factory method to get a new request object or the one for an existing request
*
* @param string $id =null
- * @return Request|boolean the object or false if $id is not found
+ * @param bool $handle_not_found =true true: handle not found by trying to redirect, false: just return null
+ * @return Request|null null if Request not found and $handle_not_found === false
*/
- static function read($id=null)
+ public static function read($id=null, $handle_not_found=true)
{
$request = new Cache($id);
diff --git a/api/src/Etemplate/Widget/Nextmatch.php b/api/src/Etemplate/Widget/Nextmatch.php
index e0c5b1c770..85136e833d 100644
--- a/api/src/Etemplate/Widget/Nextmatch.php
+++ b/api/src/Etemplate/Widget/Nextmatch.php
@@ -204,7 +204,8 @@ class Nextmatch extends Etemplate\Widget
{
$value['options-cat_id'][''] = lang('All categories');
}
- $value['options-cat_id'] += Select::typeOptions('select-cat', ',,'.$cat_app,$no_lang=true,false,$value['cat_id']);
+ $no_lang = true;
+ $value['options-cat_id'] += Select::typeOptions('select-cat', ',,'.$cat_app,$no_lang,false,$value['cat_id']);
Select::fix_encoded_options($value['options-cat_id']);
}
diff --git a/api/src/Etemplate/Widget/Select.php b/api/src/Etemplate/Widget/Select.php
index d3a7f13115..e8cf3c18df 100644
--- a/api/src/Etemplate/Widget/Select.php
+++ b/api/src/Etemplate/Widget/Select.php
@@ -654,12 +654,12 @@ class Select extends Etemplate\Widget
$options[$cat['id']] += $cat['data'];
}
}
- // preserv unavailible cats (eg. private user-cats)
- if ($value && ($unavailible = array_diff(is_array($value) ? $value : explode(',',$value),array_keys((array)$options))))
+ // preserve unavailable cats (eg. private user-cats)
+ if (isset(self::$request) && $value && ($unavailable = array_diff(is_array($value) ? $value : explode(',',$value),array_keys((array)$options))))
{
// unavailable cats need to be merged in again
$unavailable_name = $form_name.self::UNAVAILABLE_CAT_POSTFIX;
- self::$request->preserv[$unavailable_name] = $unavailible;
+ self::$request->preserv[$unavailable_name] = $unavailable;
}
$no_lang = True;
break;
diff --git a/api/src/Etemplate/Widget/Tree.php b/api/src/Etemplate/Widget/Tree.php
index 35fe83e68d..46644dccf1 100644
--- a/api/src/Etemplate/Widget/Tree.php
+++ b/api/src/Etemplate/Widget/Tree.php
@@ -308,7 +308,7 @@ class Tree extends Etemplate\Widget
{
// += to keep further options set by app code
self::$request->sel_options[$form_name] += self::typeOptions($this->attrs['type'], $this->attrs['options'],
- $no_lang=null, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name), $form_name);
+ $no_lang, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name), $form_name);
// if no_lang was modified, forward modification to the client
if ($no_lang != $this->attr['no_lang'])
diff --git a/api/src/Link.php b/api/src/Link.php
index 137fae0c28..1c9154e184 100644
--- a/api/src/Link.php
+++ b/api/src/Link.php
@@ -1015,7 +1015,7 @@ class Link extends Link\Storage
$view[$name] = $id[$n];
}
}
- else
+ elseif(is_array($view))
{
$view[$reg['view_id']] = $id;
}
diff --git a/api/src/loader.php b/api/src/loader.php
index d1959c5f2e..881e595e7d 100644
--- a/api/src/loader.php
+++ b/api/src/loader.php
@@ -24,10 +24,6 @@ use EGroupware\Api\Egw;
// Declaration of should be compatible with , varios places where method parameters change
// --> switching it off for now, as it makes error-log unusable
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
-if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime())
-{
- set_magic_quotes_runtime(false);
-}
$egw_min_php_version = '7.3';
if (!function_exists('version_compare') || version_compare(PHP_VERSION,$egw_min_php_version) < 0)
@@ -35,7 +31,7 @@ if (!function_exists('version_compare') || version_compare(PHP_VERSION,$egw_min_
die("EGroupware requires PHP $egw_min_php_version or greater. Please contact your System Administrator to upgrade PHP!");
}
-if (!defined('EGW_API_INC')) define('EGW_API_INC',PHPGW_API_INC); // this is to support the header upgrade
+if (!defined('EGW_API_INC') && defined('PHPGW_API_INC')) define('EGW_API_INC',PHPGW_API_INC); // this is to support the header upgrade
/* Make sure the header.inc.php is current. */
if (!isset($GLOBALS['egw_domain']) || $GLOBALS['egw_info']['server']['versions']['header'] < $GLOBALS['egw_info']['server']['versions']['current_header'])
@@ -80,7 +76,7 @@ if (Session::init_handler())
if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw)) // only egw object has wakeup2, setups egw_minimal eg. has not!
{
- $GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app)
+ $GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/environment to this request (eg. changed current app)
$GLOBALS['egw_info']['flags']['session_restore_time'] = microtime(true) - $GLOBALS['egw_info']['flags']['page_start_time'];
if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment
diff --git a/api/src/loader/common.php b/api/src/loader/common.php
index fda5174ec6..12b2c432a5 100755
--- a/api/src/loader/common.php
+++ b/api/src/loader/common.php
@@ -426,7 +426,11 @@ if (!function_exists('display_sidebox'))
*/
function display_sidebox($appname,$menu_title,$_file)
{
- $file = str_replace('preferences.uisettings.index', 'preferences.preferences_settings.index', $_file);
+ $file = array_map(function($item)
+ {
+ return is_array($item) ? $item :
+ str_replace('preferences.uisettings.index', 'preferences.preferences_settings.index', $item);
+ }, $_file);
$GLOBALS['egw']->framework->sidebox($appname,$menu_title,$file);
}
}
diff --git a/calendar/inc/class.calendar_groupdav.inc.php b/calendar/inc/class.calendar_groupdav.inc.php
index f415e68bcc..bbba7a310d 100644
--- a/calendar/inc/class.calendar_groupdav.inc.php
+++ b/calendar/inc/class.calendar_groupdav.inc.php
@@ -1160,7 +1160,7 @@ class calendar_groupdav extends Api\CalDAV\Handler
if (preg_match('/^METHOD:(PUBLISH|REQUEST)(\r\n|\r|\n)(.*)^BEGIN:VEVENT/ism', $options['content']))
{
$handler = $this->_get_handler();
- if (($foundEvents = $handler->search($vCalendar, null, false, $charset)))
+ if (($foundEvents = $handler->iCalSearch($vCalendar, null, false, $charset)))
{
$id = array_shift($foundEvents);
list($eventId) = explode(':', $id);
@@ -1548,11 +1548,12 @@ class calendar_groupdav extends Api\CalDAV\Handler
* @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)
*/
- function put_response_headers($entry, $path, $retval, $path_attr_is_name=true)
+ function put_response_headers($entry, $path, $retval, $path_attr_is_name=true, $etag=null)
{
$schedule_tag = null;
- $etag = $this->get_etag($entry, $schedule_tag);
+ if (!isset($etag)) $etag = $this->get_etag($entry, $schedule_tag);
if ($this->use_schedule_tag)
{
diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php
index 5cf1722ee8..5b0279e67d 100644
--- a/calendar/inc/class.calendar_ical.inc.php
+++ b/calendar/inc/class.calendar_ical.inc.php
@@ -3218,7 +3218,7 @@ class calendar_ical extends calendar_boupdate
return $event;
}
- function search($_vcalData, $contentID=null, $relax=false, $charset=null)
+ function iCalSearch($_vcalData, $contentID=null, $relax=false, $charset=null)
{
if (($events = $this->icaltoegw($_vcalData, $charset)))
{
diff --git a/calendar/inc/class.calendar_import_csv.inc.php b/calendar/inc/class.calendar_import_csv.inc.php
index 395760c48e..814423b5ac 100644
--- a/calendar/inc/class.calendar_import_csv.inc.php
+++ b/calendar/inc/class.calendar_import_csv.inc.php
@@ -43,8 +43,10 @@ class calendar_import_csv extends importexport_basic_import_csv {
/**
* Set up import
+ * @param importexport_definition $definition
+ * @param importexport_import_csv|null $import_csv
*/
- protected function init(importexport_definition &$definition, importexport_import_csv &$import_csv=NULL)
+ protected function init(importexport_definition $definition, importexport_import_csv $import_csv=NULL)
{
// fetch the addressbook bo
$this->bo= new calendar_boupdate();
@@ -76,8 +78,9 @@ class calendar_import_csv extends importexport_basic_import_csv {
*
* @return boolean success
*/
- public function import_record(\calendar_egw_record &$record, &$import_csv)
+ public function import_record(importexport_iface_egw_record &$record, &$import_csv)
{
+ if (!is_a($record, calendar_egw_record::class)) throw new TypeError();
// set eventOwner
$options =& $this->definition->plugin_options;
$options['owner'] = $options['owner'] ? $options['owner'] : $this->user;
diff --git a/calendar/inc/class.calendar_merge.inc.php b/calendar/inc/class.calendar_merge.inc.php
index a34d5a0eec..2d8ecada0d 100644
--- a/calendar/inc/class.calendar_merge.inc.php
+++ b/calendar/inc/class.calendar_merge.inc.php
@@ -119,11 +119,11 @@ class calendar_merge extends Api\Storage\Merge
* @param string $charset=null charset to override default set by mimetype or export charset
* @return string|boolean merged document or false on error
*/
- function merge_string($content,$ids,$err,$mimetype,$fix)
+ function &merge_string($content, $ids, &$err, $mimetype, array $fix=null, $charset=null)
{
$ids = $this->validate_ids((array)$ids, $content);
- return parent::merge_string($content, $ids, $err, $mimetype,$fix);
+ return parent::merge_string($content, $ids, $err, $mimetype, $fix, $charset);
}
/**
diff --git a/calendar/inc/class.calendar_owner_etemplate_widget.inc.php b/calendar/inc/class.calendar_owner_etemplate_widget.inc.php
index fa89ce4beb..384403d25b 100644
--- a/calendar/inc/class.calendar_owner_etemplate_widget.inc.php
+++ b/calendar/inc/class.calendar_owner_etemplate_widget.inc.php
@@ -217,7 +217,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
);
foreach($lists as $list_id => $list)
{
- $_results[''+$list_id] = array(
+ $_results[(string)$list_id] = array(
'label' => $list,
'resources' => $bo->enum_mailing_list($type.$list_id)
);
diff --git a/importexport/inc/class.importexport_basic_import_csv.inc.php b/importexport/inc/class.importexport_basic_import_csv.inc.php
index 418dd1eacf..7fc0c9ceff 100644
--- a/importexport/inc/class.importexport_basic_import_csv.inc.php
+++ b/importexport/inc/class.importexport_basic_import_csv.inc.php
@@ -220,8 +220,10 @@ abstract class importexport_basic_import_csv implements importexport_iface_impor
/**
* Stub to hook into import initialization - set lookups, etc.
+ * @param importexport_definition $definition
+ * @param importexport_import_csv|null $import_csv
*/
- protected function init(importexport_definition &$definition, importexport_import_csv &$import_csv = null)
+ protected function init(importexport_definition $definition, importexport_import_csv $import_csv = null)
{
}
diff --git a/importexport/templates/default/definition_index.xet b/importexport/templates/default/definition_index.xet
index 3e7e7cd285..8490c334f1 100644
--- a/importexport/templates/default/definition_index.xet
+++ b/importexport/templates/default/definition_index.xet
@@ -21,7 +21,7 @@
-
+
diff --git a/importexport/templates/default/schedule_index.xet b/importexport/templates/default/schedule_index.xet
index 27daa3176e..04aaade92c 100644
--- a/importexport/templates/default/schedule_index.xet
+++ b/importexport/templates/default/schedule_index.xet
@@ -38,7 +38,7 @@
-
+
@@ -74,8 +74,8 @@
-
-
+
+
diff --git a/importexport/templates/default/wizard_basic_export_csv.choose_fields.xet b/importexport/templates/default/wizard_basic_export_csv.choose_fields.xet
index ee49343449..6fa2ef9896 100644
--- a/importexport/templates/default/wizard_basic_export_csv.choose_fields.xet
+++ b/importexport/templates/default/wizard_basic_export_csv.choose_fields.xet
@@ -27,7 +27,7 @@
-
+
diff --git a/importexport/templates/default/wizard_basic_import_csv.fieldmapping.xet b/importexport/templates/default/wizard_basic_import_csv.fieldmapping.xet
index 7e841cab5a..fa8629d782 100644
--- a/importexport/templates/default/wizard_basic_import_csv.fieldmapping.xet
+++ b/importexport/templates/default/wizard_basic_import_csv.fieldmapping.xet
@@ -28,8 +28,8 @@
-
-
+
+
diff --git a/infolog/inc/class.infolog_bo.inc.php b/infolog/inc/class.infolog_bo.inc.php
index 596b80ca05..13b6df5a31 100644
--- a/infolog/inc/class.infolog_bo.inc.php
+++ b/infolog/inc/class.infolog_bo.inc.php
@@ -1447,9 +1447,10 @@ class infolog_bo
function link_titles(array $ids)
{
$titles = array();
- foreach ($this->search($params=array(
+ $params = array(
'col_filter' => array('info_id' => $ids),
- )) as $info)
+ );
+ foreach ($this->search($params) as $info)
{
$titles[$info['info_id']] = $this->link_title($info);
}
diff --git a/infolog/inc/class.infolog_tracking.inc.php b/infolog/inc/class.infolog_tracking.inc.php
index e58fb18ad2..d0d371daff 100644
--- a/infolog/inc/class.infolog_tracking.inc.php
+++ b/infolog/inc/class.infolog_tracking.inc.php
@@ -142,7 +142,7 @@ class infolog_tracking extends Api\Storage\Tracking
* @param array $old
* @return string
*/
- function get_subject($data,$old)
+ function get_subject($data, $old, $deleted = null, $receiver = null)
{
if ($data['prefix'])
{
@@ -170,7 +170,7 @@ class infolog_tracking extends Api\Storage\Tracking
* @param array $old
* @return string
*/
- function get_message($data,$old)
+ function get_message($data, $old, $receiver = null)
{
if ($data['message']) return $data['message']; // async notification
diff --git a/resources/inc/class.resources_acl_ui.inc.php b/resources/inc/class.resources_acl_ui.inc.php
index e57d5b68ef..b8c010a815 100755
--- a/resources/inc/class.resources_acl_ui.inc.php
+++ b/resources/inc/class.resources_acl_ui.inc.php
@@ -137,7 +137,7 @@ class resources_acl_ui
$row['icon_url'] = $GLOBALS['egw_info']['server']['webserver_url']. resources_bo::ICON_PATH.'/'.$row['data']['icon'];
}
- $row['subs'] = count($row['children']);
+ $row['subs'] = count($row['children'] ?? []);
$row['class'] = 'level'.$row['level'];
diff --git a/resources/inc/class.resources_import_csv.inc.php b/resources/inc/class.resources_import_csv.inc.php
index 08276dea7d..0904ef08f3 100644
--- a/resources/inc/class.resources_import_csv.inc.php
+++ b/resources/inc/class.resources_import_csv.inc.php
@@ -28,12 +28,11 @@ class resources_import_csv extends importexport_basic_import_csv {
/**
* imports entries according to given definition object.
- * @param resource $_stream
- * @param string $_charset
- * @param definition $_definition
+ * @param importexport_definition $definition $definition
+ * @param ?importexport_import_csv $import_csv
*/
- public function init(importexport_definition $_definition ) {
-
+ protected function init(importexport_definition $definition, importexport_import_csv $import_csv = null)
+ {
// fetch the resource bo
$this->bo = new resources_bo();
diff --git a/resources/inc/class.resources_so.inc.php b/resources/inc/class.resources_so.inc.php
index 305939f335..eb15a9bfaa 100755
--- a/resources/inc/class.resources_so.inc.php
+++ b/resources/inc/class.resources_so.inc.php
@@ -47,21 +47,23 @@ class resources_so extends Api\Storage
* Reimplemented to do some minimal caching (re-use already read data)
*
* @param int|array $res_id res_id
+ * @param string|array $extra_cols string or array of strings to be added to the SELECT, eg. "count(*) as num"
+ * @param string $join sql to do a join, added as is after the table-name, eg. ", table2 WHERE x=y" or
* @return array|boolean data if row could be retrived else False
*/
- function read($res_id)
+ function read($keys, $extra_cols='', $join='')
{
- if (is_array($res_id) && count($res_id) == 1 && isset($res_id['res_id'])) $res_id = $res_id['res_id'];
+ if (is_array($keys) && count($keys) == 1 && isset($keys['keys'])) $keys = $keys['keys'];
- /*if (!is_array($res_id) && $res_id == $this->data['res_id'])
+ /*if (!is_array($keys) && $keys == $this->data['keys'])
{
- error_log(__METHOD__.'('.array2string($res_id).') this->data[res_id]='.array2string($this->data['res_id']).' --> returning this->data');
+ error_log(__METHOD__.'('.array2string($keys).') this->data[keys]='.array2string($this->data['keys']).' --> returning this->data');
}
else
{
- error_log(__METHOD__.'('.array2string($res_id).') this->data[res_id]='.array2string($this->data['res_id']).' --> returning parent::read()');
+ error_log(__METHOD__.'('.array2string($keys).') this->data[keys]='.array2string($this->data['keys']).' --> returning parent::read()');
}*/
- return !is_array($res_id) && $res_id == $this->data['res_id'] ? $this->data : parent::read($res_id);
+ return !is_array($keys) && $keys == $this->data['keys'] ? $this->data : parent::read($keys, $extra_cols, $join);
}
/**
@@ -70,11 +72,12 @@ class resources_so extends Api\Storage
* Reimplemented to do some minimal caching (re-use already read data)
*
* @param int|array $res_id id of resource
+ * @param boolean $only_return_ids =false return $ids of delete call to db object, but not run it (can be used by extending classes!)
* @return int|array affected rows, should be 1 if ok, 0 if an error or array with id's if $only_return_ids
*/
- function delete($res_id)
+ function delete($keys=null,$only_return_ids=false)
{
- if (($ok = parent::delete($res_id)) && !is_array($res_id) && $res_id == $this->data['res_id'])
+ if (($ok = parent::delete($keys, $only_return_ids)) && !$only_return_ids && !is_array($keys) && $keys == $this->data['res_id'])
{
unset($this->data);
}
@@ -85,12 +88,13 @@ class resources_so extends Api\Storage
* saves a resource including extra fields
*
* @param array $resource key => value
- * @return mixed id of resource if all right, false if fale
+ * @param string|array $extra_where =null extra where clause, eg. to check an etag, returns true if no affected rows!
+ * @return int|boolean 0 on success, or errno != 0 on error, or true if $extra_where is given and no rows affected
*/
- function save($resource)
+ function save($keys=null,$extra_where=null)
{
- $this->data = $resource;
- if(parent::save() != 0) return false;
+ $this->data = $keys;
+ if(parent::save(null, $extra_where) != 0) return false;
$res_id = $this->data['res_id'];
return $res_id;
diff --git a/timesheet/inc/class.timesheet_bo.inc.php b/timesheet/inc/class.timesheet_bo.inc.php
index 58964e7d65..08f5287f5a 100644
--- a/timesheet/inc/class.timesheet_bo.inc.php
+++ b/timesheet/inc/class.timesheet_bo.inc.php
@@ -552,7 +552,7 @@ class timesheet_bo extends Api\Storage
($this->quantity_sum ? "SUM(ts_quantity) AS ts_quantity" : '0'),
'0','NULL','0','0','0','0','0','0',"SUM($total_sql) AS ts_total"
),'GROUP BY '.$sum_sql[$type],$sum_extra_cols,$wildcard,$empty,$op,'UNION',$filter,$join,$need_full_no_count);
- $sum_extra_cols[$type]{0} = '0';
+ $sum_extra_cols[$type][0] = '0';
}
$union_order[] = 'ts_start '.$sort;
return parent::search('','',implode(',',$union_order),'','',false,'',$start);
@@ -565,10 +565,12 @@ class timesheet_bo extends Api\Storage
*
* @param int $ts_id
* @param boolean $ignore_acl =false should the Acl be checked
+ * @param string $join ='' *UNSUPPORTED*
* @return array|boolean array with timesheet entry, null if timesheet not found or false if no rights
*/
- function read($ts_id,$ignore_acl=false)
+ function read($ts_id,$ignore_acl=false,$join='')
{
+ if (!is_bool($ignore_acl)) throw new TypeError();
//error_log(__METHOD__."($ts_id,$ignore_acl) ".function_backtrace());
if (!(int)$ts_id || (int)$ts_id != $this->data['ts_id'] && !parent::read($ts_id))
{
diff --git a/timesheet/inc/class.timesheet_import_csv.inc.php b/timesheet/inc/class.timesheet_import_csv.inc.php
index 8cde57169b..f1f51e6643 100644
--- a/timesheet/inc/class.timesheet_import_csv.inc.php
+++ b/timesheet/inc/class.timesheet_import_csv.inc.php
@@ -46,9 +46,10 @@ class timesheet_import_csv extends importexport_basic_import_csv
/**
* Initialize for import
*
- * @param definition $_definition
+ * @param importexport_definition $definition
+ * @param ?importexport_import_csv $import_csv
*/
- protected function init( importexport_definition $_definition, importexport_import_csv &$import_csv )
+ protected function init(importexport_definition $definition, importexport_import_csv $import_csv=null)
{
// fetch the bo
$this->bo = new timesheet_bo();
@@ -60,10 +61,10 @@ class timesheet_import_csv extends importexport_basic_import_csv
$import_csv->conversion_class = $this;
// set Owner
- $plugin_options = $_definition->plugin_options;
- $plugin_options['record_owner'] = isset( $_definition->plugin_options['record_owner'] ) ?
- $_definition->plugin_options['record_owner'] : $this->user;
- $_definition->plugin_options = $plugin_options;
+ $plugin_options = $definition->plugin_options;
+ $plugin_options['record_owner'] = isset( $definition->plugin_options['record_owner'] ) ?
+ $definition->plugin_options['record_owner'] : $this->user;
+ $definition->plugin_options = $plugin_options;
// For converting human-friendly lookups
$this->lookups = array(
@@ -483,7 +484,7 @@ class timesheet_import_csv extends importexport_basic_import_csv
// end of iface_export_plugin
// Extra conversion functions - must be static
- public static function addr_id( $n_family,$n_given=null,$org_name=null )
+ public static function addr_id( $n_family,$n_given=null,$org_name=null, &$record=null)
{
// find in Addressbook, at least n_family AND (n_given OR org_name) have to match
@@ -497,7 +498,7 @@ class timesheet_import_csv extends importexport_basic_import_csv
if(!is_null($n_given)) $n_given = trim($n_given);
if (!is_object($contacts))
{
- $contacts =& CreateObject('phpgwapi.contacts');
+ $contacts = new Api\Contacts();
}
if (!is_null($org_name)) // org_name given?
{
@@ -523,4 +524,3 @@ class timesheet_import_csv extends importexport_basic_import_csv
return False;
}
}
-?>
diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php
index 5e948c75b9..82b5086e93 100644
--- a/timesheet/inc/class.timesheet_ui.inc.php
+++ b/timesheet/inc/class.timesheet_ui.inc.php
@@ -500,7 +500,7 @@ class timesheet_ui extends timesheet_bo
* @param boolean $id_only if true only return (via $rows) an array of contact-ids, dont save state to session
* @return int total number of contacts matching the selection
*/
- function get_rows(&$query_in,&$rows,&$readonlys,$id_only=false)
+ function get_rrows(&$query_in,&$rows,&$readonlys,$id_only=false)
{
$this->show_sums = false;
$end_date = false;
@@ -935,7 +935,7 @@ class timesheet_ui extends timesheet_bo
$date_filters['custom'] = 'custom';
$content['nm'] = array(
- 'get_rows' => TIMESHEET_APP.'.timesheet_ui.get_rows',
+ 'get_rows' => TIMESHEET_APP.'.timesheet_ui.get_rrows',
'options-filter' => $date_filters,
'options-filter2' => array('No details','Details'),
'order' => 'ts_start',// IO name of the column to sort after (optional for the sortheaders)
@@ -1170,7 +1170,7 @@ class timesheet_ui extends timesheet_bo
@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small
$query['num_rows'] = -1; // all
$readonlys = null;
- $this->get_rows($query,$checked,$readonlys,true); // true = only return the id's
+ $this->get_rrows($query,$checked,$readonlys,true); // true = only return the id's
}
}
//error_log(__METHOD__."('$action', ".array2string($checked).', '.array2string($use_all).",,, '$session_name')");