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 @@ -