From b41f53d0f1f35f1118261aaa12c837d813c6d679 Mon Sep 17 00:00:00 2001 From: Gary Date: Tue, 21 Apr 2026 18:04:04 +0100 Subject: [PATCH 01/28] Version bump v1.9.0 --- db/SCHEMA.sql | 2 +- functions/upgrade_queries.php | 1 + functions/upgrade_queries/upgrade_queries_1.9.php | 8 ++++++++ functions/version.php | 6 +++--- misc/CHANGELOG | 6 ++++++ 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 functions/upgrade_queries/upgrade_queries_1.9.php diff --git a/db/SCHEMA.sql b/db/SCHEMA.sql index 054584321..de8688875 100755 --- a/db/SCHEMA.sql +++ b/db/SCHEMA.sql @@ -1102,5 +1102,5 @@ CREATE TABLE `nominatim_cache` ( # Dump of table -- for autofix comment, leave as it is # ------------------------------------------------------------ -UPDATE `settings` SET `version` = "1.8"; +UPDATE `settings` SET `version` = "1.9"; UPDATE `settings` SET `dbversion` = 46; diff --git a/functions/upgrade_queries.php b/functions/upgrade_queries.php index bea08c448..e6966bec6 100644 --- a/functions/upgrade_queries.php +++ b/functions/upgrade_queries.php @@ -21,6 +21,7 @@ include('upgrade_queries/upgrade_queries_1.6.php'); include('upgrade_queries/upgrade_queries_1.7.php'); include('upgrade_queries/upgrade_queries_1.8.php'); +include('upgrade_queries/upgrade_queries_1.9.php'); // output if required diff --git a/functions/upgrade_queries/upgrade_queries_1.9.php b/functions/upgrade_queries/upgrade_queries_1.9.php new file mode 100644 index 000000000..b28765e23 --- /dev/null +++ b/functions/upgrade_queries/upgrade_queries_1.9.php @@ -0,0 +1,8 @@ + Date: Tue, 21 Apr 2026 18:06:13 +0100 Subject: [PATCH 02/28] Bugfix: Empty address list in subnets view --- app/subnets/addresses/print-address-table.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/subnets/addresses/print-address-table.php b/app/subnets/addresses/print-address-table.php index e028bf351..9bdd5a5df 100644 --- a/app/subnets/addresses/print-address-table.php +++ b/app/subnets/addresses/print-address-table.php @@ -63,11 +63,12 @@ function unset_array_value(&$array, $value) { if($User->settings->enableCustomers != 1) { unset_array_value($selected_ip_fields, 'customer_id'); } /* Addresses and fields manupulations */ +if (!isset($addresses) || !is_array($addresses)) + $addresses = []; # save for visual display ! $addresses_visual = $addresses; # new compress functions -$addresses=[]; $Addresses->addresses_types_fetch(); foreach($Addresses->address_types as $t) { if($t['compress']=="Yes" && $User->user->compressOverride!="Uncompress") { From 1a44d5434ba4f553d81e75883dd57ce64f12e1c7 Mon Sep 17 00:00:00 2001 From: Gary Date: Fri, 24 Apr 2026 22:38:55 +0100 Subject: [PATCH 03/28] Bugfix: Update rack SVG and HTML escaping/unescaping Fixes #4595 --- app/admin/racks/edit-rack-devices-result.php | 2 +- app/dashboard/widgets/changelog.php | 2 +- app/dashboard/widgets/customers.php | 2 +- .../address-details/address-details.php | 2 +- app/subnets/addresses/print-address-table.php | 2 +- app/subnets/subnet-details/subnet-details.php | 2 +- app/subnets/subnet-slaves-subnets.php | 2 +- app/subnets/subnet-slaves.php | 2 +- .../physical-circuits/all-circuits.php | 2 +- .../circuit-details-general.php | 2 +- app/tools/customers/all-customers.php | 4 +-- app/tools/racks/print-racks-list.php | 2 +- app/tools/racks/print-single-rack.php | 2 +- app/tools/routing/bgp/details-general.php | 2 +- .../search-results_customers.php | 4 +-- app/tools/vlan/domain-vlans-all.php | 2 +- app/tools/vlan/domain-vlans.php | 2 +- app/tools/vlan/vlan-details.php | 2 +- app/tools/vrf/all_vrf.php | 2 +- app/tools/vrf/vrf-details.php | 2 +- functions/classes/class.PDO.php | 2 +- functions/classes/class.Rackspace.php | 30 +++++++++++++------ functions/classes/class.SubnetsTable.php | 2 +- functions/global_functions.php | 14 ++++++++- 24 files changed, 58 insertions(+), 34 deletions(-) diff --git a/app/admin/racks/edit-rack-devices-result.php b/app/admin/racks/edit-rack-devices-result.php index 2b7982459..a2bf90229 100755 --- a/app/admin/racks/edit-rack-devices-result.php +++ b/app/admin/racks/edit-rack-devices-result.php @@ -109,7 +109,7 @@ # is that subrack already placed somewhere? if ($Database->getObjectQuery("rackContents", "SELECT * from `rackContents` where `subrackId` = ? limit 1;", [$POST->subrackid])) { $Result->show("danger", _("Subrack is already in a rack"), true); } - $values = array("name"=>$subrack->name, + $values = array("name"=>unescape_input($subrack->name), "rack"=>$POST->rackid, "rack_start"=>$POST->rack_start, "rack_size"=>$POST->rack_size, diff --git a/app/dashboard/widgets/changelog.php b/app/dashboard/widgets/changelog.php index 5d16f2496..396e1754f 100755 --- a/app/dashboard/widgets/changelog.php +++ b/app/dashboard/widgets/changelog.php @@ -99,7 +99,7 @@ // field $field = array_pad(explode(":", $c), 2 , ''); - $value = array_pad(explode("=>", html_entity_decode($field[1])), 2, ''); + $value = array_pad(explode("=>", unescape_input($field[1])), 2, ''); $field = trim(str_replace(array("[","]"), "", $field[0])); if(is_array(@$Log->changelog_keys[$type])) { diff --git a/app/dashboard/widgets/customers.php b/app/dashboard/widgets/customers.php index 0442ba569..f13acf2d3 100644 --- a/app/dashboard/widgets/customers.php +++ b/app/dashboard/widgets/customers.php @@ -55,7 +55,7 @@ foreach ($customers as $customer) { // print details print ''. "\n"; - print " $customer->title"; + print " $customer->title"; print " $customer->address, $customer->postcode $customer->city, $customer->state"; print " $customer->contact_person ($customer->contact_phone)"; print ''; diff --git a/app/subnets/addresses/address-details/address-details.php b/app/subnets/addresses/address-details/address-details.php index cc343b67a..515f6bffc 100644 --- a/app/subnets/addresses/address-details/address-details.php +++ b/app/subnets/addresses/address-details/address-details.php @@ -121,7 +121,7 @@ print ""; print " "._('Customer').""; if($customer!==false) - print " $customer->title "; + print " $customer->title "; else print " "._("None").""; print ""; diff --git a/app/subnets/addresses/print-address-table.php b/app/subnets/addresses/print-address-table.php index 9bdd5a5df..cbabcdcaa 100644 --- a/app/subnets/addresses/print-address-table.php +++ b/app/subnets/addresses/print-address-table.php @@ -484,7 +484,7 @@ function unset_array_value(&$array, $value) { # customer_id if($User->settings->enableCustomers=="1" && @$cnt_obj["customer_id"] && $User->get_module_permissions ("customers")>=User::ACCESS_R) { $customer = $Tools->fetch_object ("customers", "id", $addresses[$n]->customer_id); - print $customer===false ? "" : "$customer->title "; + print $customer===false ? "" : "$customer->title "; } # print custom fields diff --git a/app/subnets/subnet-details/subnet-details.php b/app/subnets/subnet-details/subnet-details.php index 437c961bc..b01afca49 100755 --- a/app/subnets/subnet-details/subnet-details.php +++ b/app/subnets/subnet-details/subnet-details.php @@ -200,7 +200,7 @@ # fetch recursive nameserver details $customer = $Tools->fetch_object("customers", "id", $subnet['customer_id']); if ($customer!==false) { - print $customer->title." "; + print $customer->title." "; } else { print "/"; diff --git a/app/subnets/subnet-slaves-subnets.php b/app/subnets/subnet-slaves-subnets.php index 921c1a239..660402910 100755 --- a/app/subnets/subnet-slaves-subnets.php +++ b/app/subnets/subnet-slaves-subnets.php @@ -113,7 +113,7 @@ print ""; } else { - print "$customer->title "; + print "$customer->title "; } } else { diff --git a/app/subnets/subnet-slaves.php b/app/subnets/subnet-slaves.php index 921c1a239..660402910 100755 --- a/app/subnets/subnet-slaves.php +++ b/app/subnets/subnet-slaves.php @@ -113,7 +113,7 @@ print ""; } else { - print "$customer->title "; + print "$customer->title "; } } else { diff --git a/app/tools/circuits/physical-circuits/all-circuits.php b/app/tools/circuits/physical-circuits/all-circuits.php index 9bf011b1a..1359caf5c 100644 --- a/app/tools/circuits/physical-circuits/all-circuits.php +++ b/app/tools/circuits/physical-circuits/all-circuits.php @@ -101,7 +101,7 @@ // customers if($User->settings->enableCustomers=="1") { $customer = $Tools->fetch_object ("customers", "id", $circuit->customer_id); - print $customer===false ? "" : "".$customer->title." "; + print $customer===false ? "" : "".$customer->title." "; } print " ".$type_hash[$circuit->type].""; print " $circuit->capacity"; diff --git a/app/tools/circuits/physical-circuits/circuit-details-general.php b/app/tools/circuits/physical-circuits/circuit-details-general.php index 3305641fa..1a3187b25 100644 --- a/app/tools/circuits/physical-circuits/circuit-details-general.php +++ b/app/tools/circuits/physical-circuits/circuit-details-general.php @@ -59,7 +59,7 @@ $customer->title = "/"; } print " ". _('Customer').''; -print " $customer->title "; +print " $customer->title "; print ""; } diff --git a/app/tools/customers/all-customers.php b/app/tools/customers/all-customers.php index c5caa5876..3b19571e7 100644 --- a/app/tools/customers/all-customers.php +++ b/app/tools/customers/all-customers.php @@ -70,7 +70,7 @@ foreach ($customers as $customer) { // print details print ''. "\n"; - print " $customer->title"; + print " $customer->title"; print " $customer->address, $customer->postcode $customer->city, $customer->state"; // contact if(!is_blank($customer->contact_person)) @@ -94,7 +94,7 @@ $links = []; if($User->get_module_permissions ("customers")>=User::ACCESS_R) { $links[] = ["type"=>"header", "text"=>_("Show")]; - $links[] = ["type"=>"link", "text"=>_("Show customer"), "href"=>create_link($GET->page, "customers", html_entity_decode($customer->title)), "icon"=>"eye", "visible"=>"dropdown"]; + $links[] = ["type"=>"link", "text"=>_("Show customer"), "href"=>create_link($GET->page, "customers", unescape_input($customer->title)), "icon"=>"eye", "visible"=>"dropdown"]; $links[] = ["type"=>"divider"]; } if($User->get_module_permissions ("customers")>=User::ACCESS_RW) { diff --git a/app/tools/racks/print-racks-list.php b/app/tools/racks/print-racks-list.php index 9edfe8477..c604301ab 100755 --- a/app/tools/racks/print-racks-list.php +++ b/app/tools/racks/print-racks-list.php @@ -107,7 +107,7 @@ print " $r->description"; if($User->settings->enableCustomers=="1") { $customer = $Tools->fetch_object ("customers", "id", $r->customer_id); - print $customer===false ? "" : "{$customer->title} "; + print $customer===false ? "" : "{$customer->title} "; } //custom if(sizeof($custom) > 0) { diff --git a/app/tools/racks/print-single-rack.php b/app/tools/racks/print-single-rack.php index d52b88100..9e9dce6c8 100755 --- a/app/tools/racks/print-single-rack.php +++ b/app/tools/racks/print-single-rack.php @@ -131,7 +131,7 @@ get_module_permissions ("customers")>=User::ACCESS_R) - print $customer->title . " "; + print $customer->title . " "; ?> diff --git a/app/tools/routing/bgp/details-general.php b/app/tools/routing/bgp/details-general.php index 2a3ccc7ee..165ec00ea 100644 --- a/app/tools/routing/bgp/details-general.php +++ b/app/tools/routing/bgp/details-general.php @@ -23,7 +23,7 @@ print " /"; } else { - print " $customer->title "; + print " $customer->title "; } print ""; } diff --git a/app/tools/search/search_results/search-results_customers.php b/app/tools/search/search_results/search-results_customers.php index 606443ca5..07a7826cb 100644 --- a/app/tools/search/search_results/search-results_customers.php +++ b/app/tools/search/search_results/search-results_customers.php @@ -48,7 +48,7 @@ foreach ($result_customers as $customer) { // print details print ''. "\n"; - print " $customer->title"; + print " $customer->title"; print " $customer->address, $customer->postcode $customer->city, $customer->state"; // contact if(!is_blank($customer->contact_person)) @@ -74,7 +74,7 @@ $links = []; if($User->get_module_permissions ("customers")>=User::ACCESS_R) { $links[] = ["type"=>"header", "text"=>_("Show")]; - $links[] = ["type"=>"link", "text"=>_("Show customer"), "href"=>create_link($GET->page, "customers", html_entity_decode($customer->title)), "icon"=>"eye", "visible"=>"dropdown"]; + $links[] = ["type"=>"link", "text"=>_("Show customer"), "href"=>create_link($GET->page, "customers", unescape_input($customer->title)), "icon"=>"eye", "visible"=>"dropdown"]; $links[] = ["type"=>"divider"]; } if($User->get_module_permissions ("customers")>=User::ACCESS_RW) { diff --git a/app/tools/vlan/domain-vlans-all.php b/app/tools/vlan/domain-vlans-all.php index ad9ee0c33..638727d62 100644 --- a/app/tools/vlan/domain-vlans-all.php +++ b/app/tools/vlan/domain-vlans-all.php @@ -117,7 +117,7 @@ print " ".$vlan->domainName.$vlan->domainDescription.""; if($User->settings->enableCustomers=="1" && $User->get_module_permissions ("customers")>=User::ACCESS_R) { $customer = $Tools->fetch_object ("customers", "id", $vlan->customer_id); - print $customer===false ? "" : "{$customer->title} "; + print $customer===false ? "" : "{$customer->title} "; } // custom fields - no subnets if(sizeof(@$custom_fields) > 0) { diff --git a/app/tools/vlan/domain-vlans.php b/app/tools/vlan/domain-vlans.php index 087409128..a486f101c 100755 --- a/app/tools/vlan/domain-vlans.php +++ b/app/tools/vlan/domain-vlans.php @@ -154,7 +154,7 @@ print " ".$vlan[0]->description.""; if($User->settings->enableCustomers=="1" && $User->get_module_permissions ("customers")>=User::ACCESS_R) { $customer = $Tools->fetch_object ("customers", "id", $vlan[0]->customer_id); - print $customer===false ? "" : "{$customer->title} "; + print $customer===false ? "" : "{$customer->title} "; } //custom fields - no subnets if(sizeof(@$custom_fields) > 0) { diff --git a/app/tools/vlan/vlan-details.php b/app/tools/vlan/vlan-details.php index 7595e8378..62c8df34b 100755 --- a/app/tools/vlan/vlan-details.php +++ b/app/tools/vlan/vlan-details.php @@ -69,7 +69,7 @@ - title . " "; ?> + title . " "; ?> diff --git a/app/tools/vrf/all_vrf.php b/app/tools/vrf/all_vrf.php index 4f35a9779..0b7993564 100755 --- a/app/tools/vrf/all_vrf.php +++ b/app/tools/vrf/all_vrf.php @@ -108,7 +108,7 @@ // customer if($User->settings->enableCustomers=="1") { $customer = $Tools->fetch_object ("customers", "id", $vrf['customer_id']); - print $customer===false ? "" : "{$customer->title} "; + print $customer===false ? "" : "{$customer->title} "; } // custom fields diff --git a/app/tools/vrf/vrf-details.php b/app/tools/vrf/vrf-details.php index d4d447ca7..6d9a135bb 100644 --- a/app/tools/vrf/vrf-details.php +++ b/app/tools/vrf/vrf-details.php @@ -93,7 +93,7 @@ print "/"; } else { - print "".$customer->title." "; + print "".$customer->title." "; } print " "; print ""; diff --git a/functions/classes/class.PDO.php b/functions/classes/class.PDO.php index a7d4cfb80..b27b41b0c 100644 --- a/functions/classes/class.PDO.php +++ b/functions/classes/class.PDO.php @@ -723,7 +723,7 @@ public function objectExists($tableName, $query = null, $values = array(), $id = * Anti stored-XSS: Safe by default strategy * * Call htmlentities() on all string data returned from the database to ensure it is safe to pass to print(). - * Areas of code that require unsafe HTML symbols will be updated to explicitly call html_entity_decode(). + * Areas of code that require unsafe HTML symbols will be updated to explicitly call unescape_input(). * * @param string $tableName * @param mixed $data diff --git a/functions/classes/class.Rackspace.php b/functions/classes/class.Rackspace.php index 88236e84d..67e9e7847 100755 --- a/functions/classes/class.Rackspace.php +++ b/functions/classes/class.Rackspace.php @@ -343,7 +343,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false if(!$draw_names) { unset ($rd['name']); } // populate the subrack data if ($c->subrackId) { - $rd['url'] = htmlentities(create_link("tools", "racks", $c->subrackId)); + $rd['url'] = create_link("tools", "racks", $c->subrackId); if ($recursion) $rd['subrack'] = $this->compile_rack_contents ($c->subrackId, $deviceId, !$is_back, $draw_names, false); if (sizeof($rd['subrack']->getContent())==0) unset($rd['subrack']); } @@ -364,7 +364,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false if(!$draw_names) { unset ($rd['name']); } // populate the subrack data if ($c->subrackId) { - $rd['url'] = htmlentities(create_link("tools", "racks", $c->subrackId)); + $rd['url'] = create_link("tools", "racks", $c->subrackId); if ($recursion) $rd['subrack'] = $this->compile_rack_contents ($c->subrackId, $deviceId, $is_back, $draw_names, false); if (sizeof($rd['subrack']->getContent())==0) unset($rd['subrack']); } @@ -390,7 +390,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false // remove name if not permitted if(!$draw_names) { unset ($rd['name']); } if ($c->subrackId) { - $rd['url'] = htmlentities(create_link("tools", "racks", $c->subrackId)); + $rd['url'] = create_link("tools", "racks", $c->subrackId); if ($recursion) $rd['subrack'] = $this->compile_rack_contents ($c->subrackId, $deviceId, $is_back, $draw_names, false); if (sizeof($rd['subrack']->getContent())==0) unset($rd['subrack']); } @@ -410,7 +410,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false // remove name if not permitted if(!$draw_names) { unset ($rd['name']); } if ($c->subrackId) { - $rd['url'] = htmlentities(create_link("tools", "racks", $c->subrackId)); + $rd['url'] = create_link("tools", "racks", $c->subrackId); if ($recursion) $rd['subrack'] = $this->compile_rack_contents ($c->subrackId, $deviceId, !$is_back, $draw_names, false); if (sizeof($rd['subrack']->getContent())==0) unset($rd['subrack']); } @@ -438,7 +438,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false "startLocation"=>$d->rack_start-$rack->size, "size"=>$d->rack_size, "rackName"=>$rack->name, - "url"=>htmlentities(create_link("tools", "devices", $d->id)), + "url"=>create_link("tools", "devices", $d->id), "bgcolor"=>$bg, "fgcolor"=>$fg, ); @@ -458,7 +458,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false "startLocation"=>$d->rack_start, "size"=>$d->rack_size, "rackName"=>$rack->name, - "url"=>htmlentities(create_link("tools", "devices", $d->id)), + "url"=>create_link("tools", "devices", $d->id), "bgcolor"=>$bg, "fgcolor"=>$fg, ); @@ -480,7 +480,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false "startLocation"=>$d->rack_start, "size"=>$d->rack_size, "rackName"=>$rack->name, - "url"=>htmlentities(create_link("tools", "devices", $d->id)), + "url"=>create_link("tools", "devices", $d->id), "bgcolor"=>$bg, "fgcolor"=>$fg, ); @@ -500,7 +500,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false "startLocation"=>$d->rack_start-$rack->size, "size"=>$d->rack_size, "rackName"=>$rack->name, - "url"=>htmlentities(create_link("tools", "devices", $d->id)), + "url"=>create_link("tools", "devices", $d->id), "bgcolor"=>$bg, "fgcolor"=>$fg, ); @@ -1132,7 +1132,7 @@ private function drawNameplate() { $w = $this->imgXSize - ($this->marginSides * 2) - 14; $h = $this->unitYSize - 2; $this->svgData[] = ""; - $this->svgData[] = ""; + $this->svgData[] = ""; $this->svgData[] = ""; $this->svgData[] = "{$this->rack->getName()}"; $this->svgData[] = ""; @@ -1203,6 +1203,17 @@ private function drawContents() { $this->svgData = array_merge($this->svgData,$output); } + /** + * Return SVG HTML entities + * + * @access public + * @return string + */ + private function svg_html_entities() { + // https://github.com/phpipam/phpipam/issues/4595 + return ' '; + } + /** * Draws the rack * @@ -1213,6 +1224,7 @@ private function drawContents() { public function draw(Rack $rack) { $this->rack = $rack; $this->imgYSize = $this->marginTop + $this->marginBottom + $this->marginFeet + ($this->unitYSize * $this->rack->getSpace()); + $this->svgData[] = 'svg_html_entities() .' ]>'; $this->svgData[] = ""; $this->drawDefs(); $this->drawStyles(); diff --git a/functions/classes/class.SubnetsTable.php b/functions/classes/class.SubnetsTable.php index fdc091216..d2528371e 100644 --- a/functions/classes/class.SubnetsTable.php +++ b/functions/classes/class.SubnetsTable.php @@ -150,7 +150,7 @@ private function table_row($subnet) { // customer if ($this->Tools->settings->enableCustomers == 1) { $customer = $this->Tools->fetch_object ("customers", "id", $subnet->customer_id); - $tr['customer'] = $customer===false ? "/" : $customer->title." "; + $tr['customer'] = $customer===false ? "/" : $customer->title." "; } //custom diff --git a/functions/global_functions.php b/functions/global_functions.php index ef8cf827d..fbb8f40c1 100644 --- a/functions/global_functions.php +++ b/functions/global_functions.php @@ -78,7 +78,7 @@ function is_blank($data) { /** * Escape HTML and quotes in user provided input - * @param mixed $data + * @param string $data * @return string */ function escape_input($data) { @@ -88,6 +88,18 @@ function escape_input($data) { return is_string($safe_data) ? $safe_data : ''; } +/** + * Unescape HTML and quotes in user provided input + * @param string $data + * @return string + */ +function unescape_input($data) { + if (is_blank($data)) + return ''; + $safe_data = html_entity_decode($data, ENT_QUOTES, 'UTF-8'); + return is_string($safe_data) ? $safe_data : ''; +} + /** * Check if required php features are missing * @param mixed $required_extensions From c71cc1df31a1a3a326062be183dfa2caad81bada Mon Sep 17 00:00:00 2001 From: Gary Date: Sat, 25 Apr 2026 14:55:13 +0100 Subject: [PATCH 04/28] bugfix: class.Rackspace HTML escape create_url() #4595 --- functions/classes/class.Rackspace.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/classes/class.Rackspace.php b/functions/classes/class.Rackspace.php index 67e9e7847..7686c1742 100755 --- a/functions/classes/class.Rackspace.php +++ b/functions/classes/class.Rackspace.php @@ -343,7 +343,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false if(!$draw_names) { unset ($rd['name']); } // populate the subrack data if ($c->subrackId) { - $rd['url'] = create_link("tools", "racks", $c->subrackId); + $rd['url'] = escape_input(create_link("tools", "racks", $c->subrackId)); if ($recursion) $rd['subrack'] = $this->compile_rack_contents ($c->subrackId, $deviceId, !$is_back, $draw_names, false); if (sizeof($rd['subrack']->getContent())==0) unset($rd['subrack']); } @@ -364,7 +364,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false if(!$draw_names) { unset ($rd['name']); } // populate the subrack data if ($c->subrackId) { - $rd['url'] = create_link("tools", "racks", $c->subrackId); + $rd['url'] = escape_input(create_link("tools", "racks", $c->subrackId)); if ($recursion) $rd['subrack'] = $this->compile_rack_contents ($c->subrackId, $deviceId, $is_back, $draw_names, false); if (sizeof($rd['subrack']->getContent())==0) unset($rd['subrack']); } @@ -390,7 +390,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false // remove name if not permitted if(!$draw_names) { unset ($rd['name']); } if ($c->subrackId) { - $rd['url'] = create_link("tools", "racks", $c->subrackId); + $rd['url'] = escape_input(create_link("tools", "racks", $c->subrackId)); if ($recursion) $rd['subrack'] = $this->compile_rack_contents ($c->subrackId, $deviceId, $is_back, $draw_names, false); if (sizeof($rd['subrack']->getContent())==0) unset($rd['subrack']); } @@ -410,7 +410,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false // remove name if not permitted if(!$draw_names) { unset ($rd['name']); } if ($c->subrackId) { - $rd['url'] = create_link("tools", "racks", $c->subrackId); + $rd['url'] = escape_input(create_link("tools", "racks", $c->subrackId)); if ($recursion) $rd['subrack'] = $this->compile_rack_contents ($c->subrackId, $deviceId, !$is_back, $draw_names, false); if (sizeof($rd['subrack']->getContent())==0) unset($rd['subrack']); } @@ -438,7 +438,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false "startLocation"=>$d->rack_start-$rack->size, "size"=>$d->rack_size, "rackName"=>$rack->name, - "url"=>create_link("tools", "devices", $d->id), + "url"=>escape_input(create_link("tools", "devices", $d->id)), "bgcolor"=>$bg, "fgcolor"=>$fg, ); @@ -458,7 +458,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false "startLocation"=>$d->rack_start, "size"=>$d->rack_size, "rackName"=>$rack->name, - "url"=>create_link("tools", "devices", $d->id), + "url"=>escape_input(create_link("tools", "devices", $d->id)), "bgcolor"=>$bg, "fgcolor"=>$fg, ); @@ -480,7 +480,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false "startLocation"=>$d->rack_start, "size"=>$d->rack_size, "rackName"=>$rack->name, - "url"=>create_link("tools", "devices", $d->id), + "url"=>escape_input(create_link("tools", "devices", $d->id)), "bgcolor"=>$bg, "fgcolor"=>$fg, ); @@ -500,7 +500,7 @@ private function compile_rack_contents ($id, $deviceId = false, $is_back = false "startLocation"=>$d->rack_start-$rack->size, "size"=>$d->rack_size, "rackName"=>$rack->name, - "url"=>create_link("tools", "devices", $d->id), + "url"=>escape_input(create_link("tools", "devices", $d->id)), "bgcolor"=>$bg, "fgcolor"=>$fg, ); @@ -1132,7 +1132,7 @@ private function drawNameplate() { $w = $this->imgXSize - ($this->marginSides * 2) - 14; $h = $this->unitYSize - 2; $this->svgData[] = ""; - $this->svgData[] = ""; + $this->svgData[] = ""; $this->svgData[] = ""; $this->svgData[] = "{$this->rack->getName()}"; $this->svgData[] = ""; From fcacf3bcacae33d9dafaedc8304764d53d99b060 Mon Sep 17 00:00:00 2001 From: Gary Date: Sat, 25 Apr 2026 21:42:29 +0100 Subject: [PATCH 05/28] Update CHANGELOG --- misc/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/misc/CHANGELOG b/misc/CHANGELOG index 6d39131de..a4afda25b 100755 --- a/misc/CHANGELOG +++ b/misc/CHANGELOG @@ -3,6 +3,7 @@ Bugfixes: ---------------------------- + PHP8 compatibility fixes; + + Rack SVG image errors (#4595); == 1.8.0 From f9a5822a296e51fa146c64065c10afdac3ba9118 Mon Sep 17 00:00:00 2001 From: Gary Date: Sat, 25 Apr 2026 21:38:14 +0100 Subject: [PATCH 06/28] Feature: Remove support for mcrypt --- config.dist.php | 4 +-- functions/classes/class.Crypto.php | 48 ++---------------------------- misc/CHANGELOG | 4 +++ 3 files changed, 8 insertions(+), 48 deletions(-) diff --git a/config.dist.php b/config.dist.php index 2e7b4e5b5..3edc27a81 100755 --- a/config.dist.php +++ b/config.dist.php @@ -91,14 +91,14 @@ $debugging = false; /* - * API Crypt security provider. "mcrypt" or "openssl*" + * API Crypt security provider."openssl-*" * Supported methods: * openssl-128-cbc (alias openssl, openssl-128) *default * openssl-256-cbc (alias openssl-256) * * default as of 1.3.2 "openssl-128-cbc" ******************************/ -// $api_crypt_encryption_library = "mcrypt"; +// $api_crypt_encryption_library = "openssl-128-cbc"; /** diff --git a/functions/classes/class.Crypto.php b/functions/classes/class.Crypto.php index 8a2f6b511..6de7a230a 100644 --- a/functions/classes/class.Crypto.php +++ b/functions/classes/class.Crypto.php @@ -4,12 +4,6 @@ * Cryptographic Code */ class Crypto { - /** - * mcrypt cipher mode. - * Change to MCRYPT_RIJNDAEL_128 to use AES-256 compliant RIJNDAEL algorithm (rijndael-128) - * @var mixed - */ - private $legacy_mcrypt_aes_mode = "rijndael-256"; // Use string value as MCRYPT_RIJNDAEL_256 constant may not be defined. /** * Result @@ -77,10 +71,7 @@ private function hash_hmac($algo, $data1, $data2, $raw_output = false) { public function encrypt($rawdata, $password, $method="openssl-128-cbc") { $method = $this->supported_methods($method); - if ($method === 'mcrypt') - return $this->encrypt_using_legacy_mcrypt($rawdata, $password); - else - return $this->encrypt_using_openssl($rawdata, $password, $method); + return $this->encrypt_using_openssl($rawdata, $password, $method); } /** @@ -93,10 +84,7 @@ public function encrypt($rawdata, $password, $method="openssl-128-cbc") { public function decrypt($base64data, $password, $method="openssl-128-cbc") { $method = $this->supported_methods($method); - if ($method === "mcrypt") - return $this->decrypt_using_legacy_mcrypt($base64data, $password); - else - return $this->decrypt_using_openssl($base64data, $password, $method); + return $this->decrypt_using_openssl($base64data, $password, $method); } /** @@ -106,10 +94,6 @@ public function decrypt($base64data, $password, $method="openssl-128-cbc") { */ private function supported_methods($method) { switch ($method) { - case 'mcrypt': - $retval = 'mcrypt'; - break; - case 'openssl': case 'openssl-128': case 'openssl-128-cbc': @@ -125,10 +109,6 @@ private function supported_methods($method) { $this->Result->show("danger", _("Error: "). _("Unsupported encryption method").": ".escape_input($method), true); } - $required_ext = ($retval === 'mcrypt') ? 'mcrypt' : 'openssl'; - if (!in_array($required_ext, get_loaded_extensions())) - $this->Result->show("danger", _("Error: "). _('PHP extension not installed: ').$required_ext, true); - return $retval; } @@ -190,30 +170,6 @@ private function decrypt_using_openssl($base64data, $password, $method) { return openssl_decrypt($ciphertext_raw, $method, $key, OPENSSL_RAW_DATA, $iv); } - // Legacy mcrypt - mcrypt support may be removed in a future release. - - /** - * encrypt data and base64 encode results - * @param string $rawdata - * @param string $password - * @return string|false - */ - private function encrypt_using_legacy_mcrypt($rawdata, $password) { - // Suppress php72 mcrypt deprecation warnings (module is available in PECL). - return base64_encode(@mcrypt_encrypt($this->legacy_mcrypt_aes_mode, $password, $rawdata, MCRYPT_MODE_ECB)); - } - - /** - * decrypt base64 encoded data - * @param string $base64data - * @param string $password - * @return string|false - */ - private function decrypt_using_legacy_mcrypt($base64data, $password) { - // Suppress php72 mcrypt deprecation warnings (module is available in PECL). - return trim(@mcrypt_decrypt($this->legacy_mcrypt_aes_mode, $password, base64_decode($base64data), MCRYPT_MODE_ECB)); - } - /**** Security Tokens ****/ /** diff --git a/misc/CHANGELOG b/misc/CHANGELOG index a4afda25b..61932d462 100755 --- a/misc/CHANGELOG +++ b/misc/CHANGELOG @@ -5,6 +5,10 @@ + PHP8 compatibility fixes; + Rack SVG image errors (#4595); + Enhancements, changes: + ---------------------------- + + Remove support for mcrypt; + == 1.8.0 Bugfixes: From a36d0daf327d92c251d175f75f1317f296136448 Mon Sep 17 00:00:00 2001 From: Gary Date: Sun, 26 Apr 2026 21:27:33 +0100 Subject: [PATCH 07/28] Bugfix: Avoid type warnings: array|string. --- app/subnets/addresses/print-address-table.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/subnets/addresses/print-address-table.php b/app/subnets/addresses/print-address-table.php index cbabcdcaa..f4d0ae24a 100644 --- a/app/subnets/addresses/print-address-table.php +++ b/app/subnets/addresses/print-address-table.php @@ -296,7 +296,7 @@ function unset_array_value(&$array, $value) { $Addresses->ptr_link($addresses[$n]->id, $ptr->id); } else { $Addresses->ptr_link($addresses[$n]->id, 0); } } - unset($dns_records); + $dns_records = []; if (is_array($records) || $ptr!==false) { $dns_records[] = "
"; $dns_records[] = ""; // if none ignore - $dns_records = sizeof($dns_records)==3 ? "" : implode(" ", $dns_records); + $dns_records_txt = sizeof($dns_records)==3 ? "" : implode(" ", $dns_records); } else { - $dns_records = ""; + $dns_records_txt = ""; } // search for IP records $records2 = $PowerDNS->search_records ("content", $addresses[$n]->ip, 'content', true); - unset($dns_records2); + $dns_records2 = []; if (is_array($records2)) { $dns_cname_unique = array(); // unique CNAME records to prevent multiple - unset($cname); + $cname = []; $dns_records2[] = "
"; $dns_records2[] = ""; // if none ignore - $dns_records2 = sizeof($dns_records2)==3 ? "" : implode(" ", $dns_records2); + $dns_records2_txt = sizeof($dns_records2)==3 ? "" : implode(" ", $dns_records2); } else { - $dns_records2 = ""; + $dns_records2_txt = ""; } } // disabled else { - $dns_records = ""; - $dns_records2 = ""; + $dns_records_txt = ""; + $dns_records2_txt = ""; $button = ""; } // add button @@ -379,7 +379,7 @@ function unset_array_value(&$array, $value) { $Addresses->print_nat_link($all_nats, $all_nats_per_object, $subnet, $addresses[$n]); } - print $dns_records2.""; + print $dns_records2_txt.""; # resolve dns name $resolve = $DNS->resolve_address($addresses[$n]->ip_addr, $addresses[$n]->hostname, false, $subnet['nameserverId']); @@ -388,7 +388,7 @@ function unset_array_value(&$array, $value) { $Addresses->update_address_hostname ($addresses[$n]->ip_addr, $addresses[$n]->id, $resolve['name']); $addresses[$n]->hostname = $resolve['name']; } - { print "$resolve[name] $button $dns_records"; } + { print "$resolve[name] $button $dns_records_txt"; } # print firewall address object - mandatory if enabled if($zone) { From be04b7dbe9964784408c16e1b206783199275aa7 Mon Sep 17 00:00:00 2001 From: Gary Date: Sun, 26 Apr 2026 22:00:36 +0100 Subject: [PATCH 08/28] Bugfix: Rector PHP fixes * AddOverrideAttributeToOverriddenMethodsRector * VarToPublicPropertyRector * Php4ConstructorRector * RandomFunctionRector * OrdSingleByteRector * IfIssetToCoalescingRector * AssignArrayToStringRector * ThisCallOnStaticMethodToStaticCallRector * StaticCallOnNonStaticToInstanceCallRector --- api/controllers/Addresses.php | 15 ++- api/controllers/Circuits.php | 15 ++- api/controllers/Common.php | 3 +- api/controllers/Devices.php | 5 + api/controllers/L2domains.php | 15 ++- api/controllers/Nat.php | 6 + api/controllers/Prefix.php | 3 + api/controllers/Search.php | 6 +- api/controllers/Sections.php | 15 ++- api/controllers/Subnets.php | 15 ++- api/controllers/Tools.php | 15 ++- api/controllers/User.php | 15 ++- api/controllers/Vlans.php | 15 ++- api/controllers/Vrfs.php | 15 ++- app/subnets/addresses/print-address-table.php | 8 +- app/subnets/subnet-details/subnet-details.php | 12 +- app/tools/multicast-networks/index.php | 8 +- functions/PEAR/Net/IPv4.php | 32 +++--- functions/PEAR/Net/Ping.php | 30 ++--- functions/PEAR/OLE/ChainedBlockStream.php | 8 +- functions/PEAR/OLE/OLE.php | 18 +-- functions/PEAR/OLE/PPS.php | 26 ++--- functions/PEAR/OLE/PPS/File.php | 2 +- functions/PEAR/OLE/PPS/Root.php | 2 +- .../Spreadsheet/Excel/Writer/BIFFwriter.php | 12 +- .../PEAR/Spreadsheet/Excel/Writer/Format.php | 66 +++++------ .../PEAR/Spreadsheet/Excel/Writer/Parser.php | 18 +-- .../Spreadsheet/Excel/Writer/Validator.php | 30 ++--- .../Spreadsheet/Excel/Writer/Workbook.php | 38 +++---- .../Spreadsheet/Excel/Writer/Worksheet.php | 103 +++++++++--------- functions/adLDAP/src/classes/adLDAPGroups.php | 6 +- functions/classes/class.LockForUpdate.php | 4 +- functions/classes/class.Mail.php | 3 +- functions/classes/class.PDO.php | 8 +- functions/classes/class.Params.php | 6 +- functions/classes/class.PowerDNS.php | 2 +- functions/classes/class.Radius.php | 84 +++++++------- functions/classes/class.User.php | 2 +- functions/php-excel-reader/excel_reader2.php | 50 ++++----- 39 files changed, 401 insertions(+), 335 deletions(-) diff --git a/api/controllers/Addresses.php b/api/controllers/Addresses.php index 5c466e78c..e109a9a55 100644 --- a/api/controllers/Addresses.php +++ b/api/controllers/Addresses.php @@ -55,7 +55,8 @@ public function __construct($Database, $Tools, $params, $Response) { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -99,7 +100,8 @@ public function OPTIONS () { * @access public * @return void */ - public function GET () { + #[\Override] + public function GET () { // all if (!isset($this->_params->id) || $this->_params->id == "all") { // fetch all @@ -295,7 +297,8 @@ public function GET () { * @access public * @return void */ - public function POST () { + #[\Override] + public function POST () { // remap keys $this->remap_keys (); @@ -359,7 +362,8 @@ public function POST () { * @access public * @return void */ - public function PATCH () { + #[\Override] + public function PATCH () { // remap keys $this->remap_keys (); @@ -420,7 +424,8 @@ public function PATCH () { * @access public * @return void */ - public function DELETE () { + #[\Override] + public function DELETE () { // delete by ip if ($this->Tools->validate_ip ($this->_params->id)!==false && isset($this->_params->id2)) { // find diff --git a/api/controllers/Circuits.php b/api/controllers/Circuits.php index 62a153816..53f390dc5 100644 --- a/api/controllers/Circuits.php +++ b/api/controllers/Circuits.php @@ -89,7 +89,8 @@ private function rewrite_controller_params ($params) { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -133,7 +134,8 @@ public function OPTIONS () { * @access public * @return void|array */ - public function GET () { + #[\Override] + public function GET () { // all if (!isset($this->_params->id) || $this->_params->id == "all") { $result = $this->Tools->fetch_all_objects ($this->type, 'id'); @@ -185,7 +187,8 @@ public function GET () { * @access public * @return void */ - public function POST () { + #[\Override] + public function POST () { # remap keys $this->remap_keys (); # validate id @@ -225,7 +228,8 @@ public function POST () { * * @return void|array */ - public function PATCH () { + #[\Override] + public function PATCH () { # remap keys $this->remap_keys (); # validate id @@ -261,7 +265,8 @@ public function PATCH () { * * @return void|array */ - public function DELETE () { + #[\Override] + public function DELETE () { # verify $this->validate_id ("delete"); diff --git a/api/controllers/Common.php b/api/controllers/Common.php index 7f9468464..54237fe48 100644 --- a/api/controllers/Common.php +++ b/api/controllers/Common.php @@ -13,7 +13,8 @@ class API_params extends Params { * @param bool $html_escape * @return void */ - public function read($args, $strip_tags = false, $html_escape = false) { + #[\Override] + public function read($args, $strip_tags = false, $html_escape = false) { if (is_array($args) && isset($args['controller'])) { $args['controller'] = strtolower($args['controller']); } diff --git a/api/controllers/Devices.php b/api/controllers/Devices.php index 5e5c99954..ec157c6ab 100644 --- a/api/controllers/Devices.php +++ b/api/controllers/Devices.php @@ -48,6 +48,7 @@ public function __construct($Database, $Tools, $params, $Response) { * @access public * @return void */ + #[\Override] public function OPTIONS () { // validate $this->validate_options_request(); @@ -88,6 +89,7 @@ public function OPTIONS () { * @access public * @return void */ + #[\Override] public function GET () { // all objects if (!isset($this->_params->id) || $this->_params->id == "all") { @@ -180,6 +182,7 @@ function ($k) { * * @method POST */ + #[\Override] public function POST () { # Put incoming keys in order $this->remap_keys (); @@ -219,6 +222,7 @@ public function POST () { * * @method PATCH */ + #[\Override] public function PATCH (){ # Put incoming keys back in order $this->remap_keys(); @@ -252,6 +256,7 @@ public function PATCH (){ * * @method DELETE */ + #[\Override] public function DELETE () { # validations $this->validate_device_edit(); diff --git a/api/controllers/L2domains.php b/api/controllers/L2domains.php index 5252931a7..8127db05b 100644 --- a/api/controllers/L2domains.php +++ b/api/controllers/L2domains.php @@ -40,7 +40,8 @@ public function __construct($Database, $Tools, $params, $Response) { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -74,7 +75,8 @@ public function OPTIONS () { * @access public * @return void */ - public function GET () { + #[\Override] + public function GET () { // all domains if(!isset($this->_params->id) || $this->_params->id == "all") { $result = $this->Tools->fetch_all_objects ("vlanDomains", 'id', true); @@ -124,7 +126,8 @@ public function GET () { * @access public * @return void */ - public function POST () { + #[\Override] + public function POST () { # remap keys $this->remap_keys (); @@ -153,7 +156,8 @@ public function POST () { * @access public * @return void */ - public function PATCH () { + #[\Override] + public function PATCH () { # remap keys $this->remap_keys (); @@ -186,7 +190,8 @@ public function PATCH () { * @access public * @return void */ - public function DELETE () { + #[\Override] + public function DELETE () { # check that domain exists $this->validate_domain_edit (); diff --git a/api/controllers/Nat.php b/api/controllers/Nat.php index 389c56234..cd9b96f5a 100644 --- a/api/controllers/Nat.php +++ b/api/controllers/Nat.php @@ -111,6 +111,7 @@ public function __construct($Database, $Tools, $params, $Response) { * @access public * @return void */ + #[\Override] public function OPTIONS () { // validate $this->validate_options_request (); @@ -139,6 +140,7 @@ public function OPTIONS () { * @access public * @return void */ + #[\Override] public function GET () { # Get all NATs from DB if (!isset($this->_params->id) || $this->_params->id == "all") { @@ -191,6 +193,7 @@ private function convert_from_DB($results) { * @access public * @return void */ + #[\Override] public function HEAD () { return $this->GET (); } @@ -201,6 +204,7 @@ public function HEAD () { * @access public * @return void */ + #[\Override] public function POST () { # check for valid keys $values = $this->validate_keys (); @@ -222,6 +226,7 @@ public function POST () { * @access public * @return void */ + #[\Override] public function PATCH () { # check for valid keys $values = $this->validate_keys (); @@ -349,6 +354,7 @@ private function verify_src_dst($k) { * @access public * @return void */ + #[\Override] public function DELETE () { $values = $this->validate_keys(); $this->validate_nat_edit(); diff --git a/api/controllers/Prefix.php b/api/controllers/Prefix.php index c384e629f..4d4e9bbfd 100644 --- a/api/controllers/Prefix.php +++ b/api/controllers/Prefix.php @@ -347,6 +347,7 @@ private function override_custom_fields () { * @access public * @return array */ + #[\Override] public function OPTIONS () { // validate $this->validate_options_request (); @@ -377,6 +378,7 @@ public function OPTIONS () { * @access public * @return array */ + #[\Override] public function GET () { // external identifier if($this->_params->id == "external_id") { @@ -467,6 +469,7 @@ public function GET () { * @access public * @return array */ + #[\Override] public function POST () { // validate parameters $this->validate_all_request_parameters (); diff --git a/api/controllers/Search.php b/api/controllers/Search.php index 16bb54a23..6090f02d7 100755 --- a/api/controllers/Search.php +++ b/api/controllers/Search.php @@ -63,7 +63,8 @@ private function define_search_items () { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -96,7 +97,8 @@ public function OPTIONS () { * @access public * @return void */ - public function GET () { + #[\Override] + public function GET () { // start search if(isset($this->_params->id)) { // set result array diff --git a/api/controllers/Sections.php b/api/controllers/Sections.php index 52331e307..dc65e6b84 100755 --- a/api/controllers/Sections.php +++ b/api/controllers/Sections.php @@ -38,7 +38,8 @@ public function __construct($Database, $Tools, $params, $Response) { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -75,7 +76,8 @@ public function OPTIONS () { * @access public * @return void */ - public function GET () { + #[\Override] + public function GET () { // fetch subnets in section if(@$this->_params->id2=="subnets" && is_numeric($this->_params->id)) { // we don't need id2 anymore @@ -165,7 +167,8 @@ public function GET () { * @access public * @return void */ - public function POST () { + #[\Override] + public function POST () { # check for valid keys $values = $this->validate_keys (); @@ -202,7 +205,8 @@ public function POST () { * @access public * @return void */ - public function PATCH () { + #[\Override] + public function PATCH () { # Check for id if(!isset($this->_params->id)) { $this->Response->throw_exception(400, "Section Id required"); } # check that section exists @@ -231,7 +235,8 @@ public function PATCH () { * @access public * @return void */ - public function DELETE () { + #[\Override] + public function DELETE () { # Check for id if(!isset($this->_params->id)) { $this->Response->throw_exception(400, "Section Id required"); } # check that section exists diff --git a/api/controllers/Subnets.php b/api/controllers/Subnets.php index 537dab5f8..33e89fb36 100644 --- a/api/controllers/Subnets.php +++ b/api/controllers/Subnets.php @@ -48,7 +48,8 @@ public function __construct($Database, $Tools, $params, $Response) { * @access public * @return array */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -80,7 +81,8 @@ public function OPTIONS () { * @access public * @return array */ - public function POST () { + #[\Override] + public function POST () { # add required parameters if(!isset($this->_params->isFolder)) { $this->_params->isFolder = "0"; } elseif($this->_params->isFolder==1) { unset($this->_params->subnet, $this->_params->mask); } @@ -160,7 +162,8 @@ private function post_find_free_subnet($direction = Subnets::SEARCH_FIND_FIRST) * @access public * @return array */ - public function GET () { + #[\Override] + public function GET () { // all if (!isset($this->_params->id) || $this->_params->id == "all") { $result = $this->read_all_subnets(); @@ -274,7 +277,8 @@ public function GET () { * @access public * @return array */ - public function PATCH () { + #[\Override] + public function PATCH () { // Check for id $this->validate_subnet_id (); @@ -332,7 +336,8 @@ public function PATCH () { * @access public * @return array */ - public function DELETE () { + #[\Override] + public function DELETE () { // Check for id $this->validate_subnet_id (); diff --git a/api/controllers/Tools.php b/api/controllers/Tools.php index 6bc3d2149..558305767 100644 --- a/api/controllers/Tools.php +++ b/api/controllers/Tools.php @@ -140,7 +140,8 @@ private function define_sort_key () { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -203,7 +204,8 @@ public function OPTIONS () { * @access public * @return void */ - public function GET () { + #[\Override] + public function GET () { # validate identifiers $this->validate_subcontroller_identifier (); @@ -338,7 +340,8 @@ public function GET () { * @access public * @return void */ - public function POST () { + #[\Override] + public function POST () { # rewrite tool controller _params $table_name = $this->rewrite_tool_input_params (); @@ -374,7 +377,8 @@ public function POST () { * @access public * @return void */ - public function PATCH () { + #[\Override] + public function PATCH () { # rewrite tool controller _params $table_name = $this->rewrite_tool_input_params(); @@ -413,7 +417,8 @@ public function PATCH () { * @access public * @return void */ - public function DELETE () { + #[\Override] + public function DELETE () { # rewrite tool controller _params $table_name = $this->rewrite_tool_input_params(); diff --git a/api/controllers/User.php b/api/controllers/User.php index ad9165950..e933f80e5 100644 --- a/api/controllers/User.php +++ b/api/controllers/User.php @@ -100,7 +100,8 @@ public function __construct ($Database, $Tools, $params, $Response) { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -132,7 +133,8 @@ public function OPTIONS () { * - /all/ // returns all phpipam users * - /admins/ // returns ipam admins */ - public function GET () { + #[\Override] + public function GET () { // token_expires if ($this->_params->id=="token_expires" || $this->_params->id=="token" || !isset($this->_params->id) || $this->_params->id=="all" || $this->_params->id=="admins") { // block IP @@ -178,7 +180,8 @@ public function GET () { * @access public * @return void */ - public function POST () { + #[\Override] + public function POST () { // block IP $this->validate_block (); // authenticate user and provide token @@ -195,7 +198,8 @@ public function POST () { * @access public * @return void */ - public function PATCH () { + #[\Override] + public function PATCH () { // block IP $this->validate_block (); // validate token @@ -217,7 +221,8 @@ public function PATCH () { * @access public * @return void */ - public function DELETE () { + #[\Override] + public function DELETE () { // block IP $this->validate_block (); // validate token diff --git a/api/controllers/Vlans.php b/api/controllers/Vlans.php index 10a95e9a3..a697f06d4 100755 --- a/api/controllers/Vlans.php +++ b/api/controllers/Vlans.php @@ -49,7 +49,8 @@ public function __construct($Database, $Tools, $params, $Response) { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -84,7 +85,8 @@ public function OPTIONS () { * @access public * @return void */ - public function GET () { + #[\Override] + public function GET () { // all if (!isset($this->_params->id) || $this->_params->id == "all") { $result = $this->Tools->fetch_all_objects ("vlans", 'vlanId'); @@ -159,7 +161,8 @@ public function GET () { * @access public * @return void */ - public function POST () { + #[\Override] + public function POST () { # check for valid keys $values = $this->validate_keys (); @@ -188,7 +191,8 @@ public function POST () { * @access public * @return void */ - public function PATCH () { + #[\Override] + public function PATCH () { # verify $this->validate_vlan_edit (); # check that it exists @@ -222,7 +226,8 @@ public function PATCH () { * @access public * @return void */ - public function DELETE () { + #[\Override] + public function DELETE () { # verify $this->validate_vlan (); diff --git a/api/controllers/Vrfs.php b/api/controllers/Vrfs.php index cd070649a..fd0f2a2b1 100755 --- a/api/controllers/Vrfs.php +++ b/api/controllers/Vrfs.php @@ -40,7 +40,8 @@ public function __construct($Database, $Tools, $params, $Response) { * @access public * @return void */ - public function OPTIONS () { + #[\Override] + public function OPTIONS () { // validate $this->validate_options_request (); @@ -75,7 +76,8 @@ public function OPTIONS () { * @access public * @return void */ - public function GET () { + #[\Override] + public function GET () { // all if (!isset($this->_params->id) || $this->_params->id == "all") { $result = $this->Tools->fetch_all_objects ("vrf", 'vrfId'); @@ -141,7 +143,8 @@ public function GET () { * @access public * @return void */ - public function POST () { + #[\Override] + public function POST () { # check for valid keys $values = $this->validate_keys (); @@ -167,7 +170,8 @@ public function POST () { * @access public * @return void */ - public function PATCH () { + #[\Override] + public function PATCH () { # verify $this->validate_vrf (); # check that it exists @@ -200,7 +204,8 @@ public function PATCH () { * @access public * @return void */ - public function DELETE () { + #[\Override] + public function DELETE () { # check that vrf exists $this->validate_vrf (); diff --git a/app/subnets/addresses/print-address-table.php b/app/subnets/addresses/print-address-table.php index f4d0ae24a..d2d81af63 100644 --- a/app/subnets/addresses/print-address-table.php +++ b/app/subnets/addresses/print-address-table.php @@ -425,20 +425,20 @@ function unset_array_value(&$array, $value) { $type = $d->isFolder==1 ? "folder" : "subnets"; $mobjects[] = "
  • $d->name / $d->description: ".$Subnets->transform_address($d->ip_addr, "dotted")."
    "; } - $mobjects = implode("\n", $mobjects); + $mobjects_txt = implode("\n", $mobjects); } else { - $mobjects = ""; + $mobjects_txt = ""; } } else { $mclass = ""; $minfo = ""; - $mobjects = ""; + $mobjects_txt = ""; } } // multicast ? - if ($User->settings->enableMulticast=="1" && $Subnets->is_multicast ($addresses[$n]->ip_addr)) { print "".$addresses[$n]->mac." $minfo $mobjects"; } + if ($User->settings->enableMulticast=="1" && $Subnets->is_multicast ($addresses[$n]->ip_addr)) { print "".$addresses[$n]->mac." $minfo $mobjects_txt"; } elseif(!empty($addresses[$n]->mac)) { print ""; } else { print ""; } } diff --git a/app/subnets/subnet-details/subnet-details.php b/app/subnets/subnet-details/subnet-details.php index b01afca49..3070e1d6e 100755 --- a/app/subnets/subnet-details/subnet-details.php +++ b/app/subnets/subnet-details/subnet-details.php @@ -445,6 +445,7 @@ $zone = $PowerDNS->get_ptr_zone_name ($subnet['ip'], $subnet['mask']); // fetch domain $domain = $PowerDNS->fetch_domain_by_name ($zone); + $btns = []; // count PTR records if ($domain!==false) { if ($User->check_module_permissions ("pdns", User::ACCESS_RWA, false, false)) { @@ -457,10 +458,10 @@ } $btns[] = " "; $btns[] = ""; - $btns = implode("\n", $btns); + $btns_txt = implode("\n", $btns); } else { - $btns = ""; + $btns_txt = ""; } $zone = "(domain $zone) ".$PowerDNS->count_domain_records_by_type ($domain->id, "PTR")." records"; @@ -470,7 +471,10 @@ $btns[] = "
    "; $btns[] = " "; $btns[] = "
    "; - $btns = implode("\n", $btns); + $btns_txt = implode("\n", $btns); + } + else { + $btns_txt = ""; } $zone = "Zone $zone missing"; @@ -487,7 +491,7 @@ print ""; print " "._('Autocreate reverse records').""; - if($subnet['DNSrecursive'] == 1) { print " "._('enabled')." $btns $zone"; } # yes + if($subnet['DNSrecursive'] == 1) { print " "._('enabled')." $btns_txt $zone"; } # yes else { print " "._('disabled')."";} # no print ""; print ""; diff --git a/app/tools/multicast-networks/index.php b/app/tools/multicast-networks/index.php index 171bd2cb0..71596ee33 100644 --- a/app/tools/multicast-networks/index.php +++ b/app/tools/multicast-networks/index.php @@ -177,20 +177,20 @@ $type = $d->isFolder==1 ? "folder" : "subnets"; $mobjects[] = "
  • $d->name / $d->description: ".$Subnets->transform_address($d->ip_addr, "dotted")."
    "; } - $mobjects = implode("\n", $mobjects); + $mobjects_txt = implode("\n", $mobjects); } else { - $mobjects = ""; + $mobjects_txt = ""; } } else { $mclass = ""; $minfo = ""; - $mobjects = ""; + $mobjects_txt = ""; } } // multicast ? - if ($User->settings->enableMulticast=="1" && $Subnets->is_multicast ($address->ip_addr)) { print "".$address->mac." $minfo $mobjects"; } + if ($User->settings->enableMulticast=="1" && $Subnets->is_multicast ($address->ip_addr)) { print "".$address->mac." $minfo $mobjects_txt"; } elseif(!empty($address->mac)) { print "mac."'>"; } else { print ""; } } diff --git a/functions/PEAR/Net/IPv4.php b/functions/PEAR/Net/IPv4.php index f5f6a4432..752bf8f26 100755 --- a/functions/PEAR/Net/IPv4.php +++ b/functions/PEAR/Net/IPv4.php @@ -90,12 +90,12 @@ class Net_IPv4 { // {{{ properties - var $ip = ""; - var $bitmask = false; - var $netmask = ""; - var $network = ""; - var $broadcast = ""; - var $long = 0; + public $ip = ""; + public $bitmask = false; + public $netmask = ""; + public $network = ""; + public $broadcast = ""; + public $long = 0; //pear public $pear; @@ -326,7 +326,7 @@ function calculate() function getNetmask($length) { - if (! PEAR::isError($ipobj = Net_IPv4::parseAddress("0.0.0.0/" . $length))) { + if (! PEAR::isError($ipobj = $this->parseAddress("0.0.0.0/" . $length))) { $mask = $ipobj->netmask; unset($ipobj); return $mask; @@ -339,7 +339,7 @@ function getNetmask($length) function getNetLength($netmask) { - if (! PEAR::isError($ipobj = Net_IPv4::parseAddress("0.0.0.0/" . $netmask))) { + if (! PEAR::isError($ipobj = $this->parseAddress("0.0.0.0/" . $netmask))) { $bitmask = $ipobj->bitmask; unset($ipobj); return $bitmask; @@ -352,7 +352,7 @@ function getNetLength($netmask) function getSubnet($ip, $netmask) { - if (! PEAR::isError($ipobj = Net_IPv4::parseAddress($ip . "/" . $netmask))) { + if (! PEAR::isError($ipobj = $this->parseAddress($ip . "/" . $netmask))) { $net = $ipobj->network; unset($ipobj); return $net; @@ -366,13 +366,13 @@ function getSubnet($ip, $netmask) function inSameSubnet($ip1, $ip2) { if (! is_object($ip1) || strcasecmp(get_class($ip1), 'net_ipv4') <> 0) { - $ipobj1 = Net_IPv4::parseAddress($ip1); + $ipobj1 = $this->parseAddress($ip1); if (PEAR::isError($ipobj1)) { return $this->pear->raiseError("IP addresses must be an understood format or a Net_IPv4 object"); } } if (! is_object($ip2) || strcasecmp(get_class($ip2), 'net_ipv4') <> 0) { - $ipobj2 = Net_IPv4::parseAddress($ip2); + $ipobj2 = $this->parseAddress($ip2); if (PEAR::isError($ipobj2)) { return $this->pear->raiseError("IP addresses must be an understood format or a Net_IPv4 object"); } @@ -394,7 +394,7 @@ function inSameSubnet($ip1, $ip2) */ function atoh($addr) { - if (! Net_IPv4::validateIP($addr)) { + if (! $this->validateIP($addr)) { return false; } $ap = explode(".", $addr); @@ -451,14 +451,14 @@ function ip2double($ip) function ipInNetwork($ip, $network) { if (! is_object($network) || strcasecmp(get_class($network), 'net_ipv4') <> 0) { - $network = Net_IPv4::parseAddress($network); + $network = $this->parseAddress($network); } if (strcasecmp(get_class($network), 'pear_error') === 0) { return false; } - $net = Net_IPv4::ip2double($network->network); - $bcast = Net_IPv4::ip2double($network->broadcast); - $ip = Net_IPv4::ip2double($ip); + $net = $this->ip2double($network->network); + $bcast = $this->ip2double($network->broadcast); + $ip = $this->ip2double($ip); unset($network); if ($ip >= $net && $ip <= $bcast) { return true; diff --git a/functions/PEAR/Net/Ping.php b/functions/PEAR/Net/Ping.php index 4c2270a40..8110df358 100644 --- a/functions/PEAR/Net/Ping.php +++ b/functions/PEAR/Net/Ping.php @@ -67,7 +67,7 @@ class Net_Ping * @var string * @access private */ - var $_ping_path = ""; + public $_ping_path = ""; /** * Array with the result from the ping execution @@ -75,7 +75,7 @@ class Net_Ping * @var array * @access private */ - var $_result = array(); + public $_result = array(); /** * OS_Guess instance @@ -83,7 +83,7 @@ class Net_Ping * @var object * @access private */ - var $_OS_Guess = ""; + public $_OS_Guess = ""; /** * OS_Guess->getSysname result @@ -91,7 +91,7 @@ class Net_Ping * @var string * @access private */ - var $_sysname = ""; + public $_sysname = ""; /** * Ping command arguments @@ -99,7 +99,7 @@ class Net_Ping * @var array * @access private */ - var $_args = array(); + public $_args = array(); /** * Indicates if an empty array was given to setArgs @@ -107,7 +107,7 @@ class Net_Ping * @var boolean * @access private */ - var $_noArgs = true; + public $_noArgs = true; /** * Contains the argument->option relation @@ -115,7 +115,7 @@ class Net_Ping * @var array * @access private */ - var $_argRelation = array(); + public $_argRelation = array(); //pear public $pear; @@ -597,7 +597,7 @@ class Net_Ping_Result * @var array * @access private */ - var $_icmp_sequence = array(); /* array($sequence_number => $time ) */ + public $_icmp_sequence = array(); /* array($sequence_number => $time ) */ /** * The target's IP Address @@ -605,7 +605,7 @@ class Net_Ping_Result * @var string * @access private */ - var $_target_ip; + public $_target_ip; /** * Number of bytes that are sent with each ICMP request @@ -613,7 +613,7 @@ class Net_Ping_Result * @var int * @access private */ - var $_bytes_per_request; + public $_bytes_per_request; /** * The total number of bytes that are sent with all ICMP requests @@ -621,7 +621,7 @@ class Net_Ping_Result * @var int * @access private */ - var $_bytes_total; + public $_bytes_total; /** * The ICMP request's TTL @@ -629,7 +629,7 @@ class Net_Ping_Result * @var int * @access private */ - var $_ttl; + public $_ttl; /** * The raw Net_Ping::result @@ -637,7 +637,7 @@ class Net_Ping_Result * @var array * @access private */ - var $_raw_data = array(); + public $_raw_data = array(); /** * The Net_Ping::_sysname @@ -645,7 +645,7 @@ class Net_Ping_Result * @var int * @access private */ - var $_sysname; + public $_sysname; /** * Statistical information about the ping @@ -653,7 +653,7 @@ class Net_Ping_Result * @var int * @access private */ - var $_round_trip = array(); /* array('min' => xxx, 'avg' => yyy, 'max' => zzz) */ + public $_round_trip = array(); /* array('min' => xxx, 'avg' => yyy, 'max' => zzz) */ /** diff --git a/functions/PEAR/OLE/ChainedBlockStream.php b/functions/PEAR/OLE/ChainedBlockStream.php index 87481c05d..57196aab2 100755 --- a/functions/PEAR/OLE/ChainedBlockStream.php +++ b/functions/PEAR/OLE/ChainedBlockStream.php @@ -45,25 +45,25 @@ class OLE_ChainedBlockStream extends PEAR * The OLE container of the file that is being read. * @var OLE */ - var $ole; + public $ole; /** * Parameters specified by fopen(). * @var array */ - var $params; + public $params; /** * The binary data of the file. * @var string */ - var $data; + public $data; /** * The file pointer. * @var int byte offset */ - var $pos; + public $pos; /** * Implements support for fopen(). diff --git a/functions/PEAR/OLE/OLE.php b/functions/PEAR/OLE/OLE.php index 2d4e43f96..b6dacb3c1 100755 --- a/functions/PEAR/OLE/OLE.php +++ b/functions/PEAR/OLE/OLE.php @@ -55,43 +55,43 @@ class OLE extends PEAR * The file handle for reading an OLE container * @var resource */ - var $_file_handle; + public $_file_handle; /** * Array of PPS's found on the OLE container * @var array */ - var $_list; + public $_list; /** * Root directory of OLE container * @var OLE_PPS_Root */ - var $root; + public $root; /** * Big Block Allocation Table * @var array (blockId => nextBlockId) */ - var $bbat; + public $bbat; /** * Short Block Allocation Table * @var array (blockId => nextBlockId) */ - var $sbat; + public $sbat; /** * Size of big blocks. This is usually 512. * @var int number of octets per block. */ - var $bigBlockSize; + public $bigBlockSize; /** * Size of small blocks. This is usually 64. * @var int number of octets per block */ - var $smallBlockSize; + public $smallBlockSize; /** @@ -335,8 +335,8 @@ function _readPpsWks($blockId) $pps->NextPps = $this->_readInt4($fh); $pps->DirPps = $this->_readInt4($fh); fseek($fh, 20, SEEK_CUR); - $pps->Time1st = OLE::OLE2LocalDate(fread($fh, 8)); - $pps->Time2nd = OLE::OLE2LocalDate(fread($fh, 8)); + $pps->Time1st = $this->OLE2LocalDate(fread($fh, 8)); + $pps->Time2nd = $this->OLE2LocalDate(fread($fh, 8)); $pps->_StartBlock = $this->_readInt4($fh); $pps->Size = $this->_readInt4($fh); $pps->No = count($this->_list); diff --git a/functions/PEAR/OLE/PPS.php b/functions/PEAR/OLE/PPS.php index 9b9dcc421..436d47de2 100755 --- a/functions/PEAR/OLE/PPS.php +++ b/functions/PEAR/OLE/PPS.php @@ -37,79 +37,79 @@ class OLE_PPS extends PEAR * The PPS index * @var integer */ - var $No; + public $No; /** * The PPS name (in Unicode) * @var string */ - var $Name; + public $Name; /** * The PPS type. Dir, Root or File * @var integer */ - var $Type; + public $Type; /** * The index of the previous PPS * @var integer */ - var $PrevPps; + public $PrevPps; /** * The index of the next PPS * @var integer */ - var $NextPps; + public $NextPps; /** * The index of it's first child if this is a Dir or Root PPS * @var integer */ - var $DirPps; + public $DirPps; /** * A timestamp * @var integer */ - var $Time1st; + public $Time1st; /** * A timestamp * @var integer */ - var $Time2nd; + public $Time2nd; /** * Starting block (small or big) for this PPS's data inside the container * @var integer */ - var $_StartBlock; + public $_StartBlock; /** * The size of the PPS's data (in bytes) * @var integer */ - var $Size; + public $Size; /** * The PPS's data (only used if it's not using a temporary file) * @var string */ - var $_data; + public $_data; /** * Array of child PPS's (only used by Root and Dir PPS's) * @var array */ - var $children = array(); + public $children = array(); /** * Pointer to OLE container * @var OLE */ - var $ole; + public $ole; /** * The constructor diff --git a/functions/PEAR/OLE/PPS/File.php b/functions/PEAR/OLE/PPS/File.php index 998c2eeb4..a07786eb7 100755 --- a/functions/PEAR/OLE/PPS/File.php +++ b/functions/PEAR/OLE/PPS/File.php @@ -36,7 +36,7 @@ class OLE_PPS_File extends OLE_PPS * The temporary dir for storing the OLE file * @var string */ - var $_tmp_dir; + public $_tmp_dir; /** * The constructor diff --git a/functions/PEAR/OLE/PPS/Root.php b/functions/PEAR/OLE/PPS/Root.php index 803b7630d..a2017cb9c 100755 --- a/functions/PEAR/OLE/PPS/Root.php +++ b/functions/PEAR/OLE/PPS/Root.php @@ -36,7 +36,7 @@ class OLE_PPS_Root extends OLE_PPS * The temporary dir for storing the OLE file * @var string */ - var $_tmp_dir; + public $_tmp_dir; /** * Constructor diff --git a/functions/PEAR/Spreadsheet/Excel/Writer/BIFFwriter.php b/functions/PEAR/Spreadsheet/Excel/Writer/BIFFwriter.php index a33f541cc..24460f616 100755 --- a/functions/PEAR/Spreadsheet/Excel/Writer/BIFFwriter.php +++ b/functions/PEAR/Spreadsheet/Excel/Writer/BIFFwriter.php @@ -57,38 +57,38 @@ class Spreadsheet_Excel_Writer_BIFFwriter extends PEAR * The BIFF/Excel version (5). * @var integer */ - var $_BIFF_version = 0x0500; + public $_BIFF_version = 0x0500; /** * The byte order of this architecture. 0 => little endian, 1 => big endian * @var integer */ - var $_byte_order; + public $_byte_order; /** * The string containing the data of the BIFF stream * @var string */ - var $_data; + public $_data; /** * The size of the data in bytes. Should be the same as strlen($this->_data) * @var integer */ - var $_datasize; + public $_datasize; /** * The maximum length for a BIFF record. See _addContinue() * @var integer * @see _addContinue() */ - var $_limit; + public $_limit; /** * The temporary dir for storing the OLE file * @var string */ - var $_tmp_dir; + public $_tmp_dir; /** * Constructor diff --git a/functions/PEAR/Spreadsheet/Excel/Writer/Format.php b/functions/PEAR/Spreadsheet/Excel/Writer/Format.php index 8403af5d7..6cf8b9ea4 100755 --- a/functions/PEAR/Spreadsheet/Excel/Writer/Format.php +++ b/functions/PEAR/Spreadsheet/Excel/Writer/Format.php @@ -49,199 +49,199 @@ class Spreadsheet_Excel_Writer_Format extends PEAR * The index given by the workbook when creating a new format. * @var integer */ - var $_xf_index; + public $_xf_index; /** * Index to the FONT record. * @var integer */ - var $font_index; + public $font_index; /** * The font name (ASCII). * @var string */ - var $_font_name; + public $_font_name; /** * Height of font (1/20 of a point) * @var integer */ - var $_size; + public $_size; /** * Bold style * @var integer */ - var $_bold; + public $_bold; /** * Bit specifiying if the font is italic. * @var integer */ - var $_italic; + public $_italic; /** * Index to the cell's color * @var integer */ - var $_color; + public $_color; /** * The text underline property * @var integer */ - var $_underline; + public $_underline; /** * Bit specifiying if the font has strikeout. * @var integer */ - var $_font_strikeout; + public $_font_strikeout; /** * Bit specifiying if the font has outline. * @var integer */ - var $_font_outline; + public $_font_outline; /** * Bit specifiying if the font has shadow. * @var integer */ - var $_font_shadow; + public $_font_shadow; /** * 2 bytes specifiying the script type for the font. * @var integer */ - var $_font_script; + public $_font_script; /** * Byte specifiying the font family. * @var integer */ - var $_font_family; + public $_font_family; /** * Byte specifiying the font charset. * @var integer */ - var $_font_charset; + public $_font_charset; /** * An index (2 bytes) to a FORMAT record (number format). * @var integer */ - var $_num_format; + public $_num_format; /** * Bit specifying if formulas are hidden. * @var integer */ - var $_hidden; + public $_hidden; /** * Bit specifying if the cell is locked. * @var integer */ - var $_locked; + public $_locked; /** * The three bits specifying the text horizontal alignment. * @var integer */ - var $_text_h_align; + public $_text_h_align; /** * Bit specifying if the text is wrapped at the right border. * @var integer */ - var $_text_wrap; + public $_text_wrap; /** * The three bits specifying the text vertical alignment. * @var integer */ - var $_text_v_align; + public $_text_v_align; /** * 1 bit, apparently not used. * @var integer */ - var $_text_justlast; + public $_text_justlast; /** * The two bits specifying the text rotation. * @var integer */ - var $_rotation; + public $_rotation; /** * The cell's foreground color. * @var integer */ - var $_fg_color; + public $_fg_color; /** * The cell's background color. * @var integer */ - var $_bg_color; + public $_bg_color; /** * The cell's background fill pattern. * @var integer */ - var $_pattern; + public $_pattern; /** * Style of the bottom border of the cell * @var integer */ - var $_bottom; + public $_bottom; /** * Color of the bottom border of the cell. * @var integer */ - var $_bottom_color; + public $_bottom_color; /** * Style of the top border of the cell * @var integer */ - var $_top; + public $_top; /** * Color of the top border of the cell. * @var integer */ - var $_top_color; + public $_top_color; /** * Style of the left border of the cell * @var integer */ - var $_left; + public $_left; /** * Color of the left border of the cell. * @var integer */ - var $_left_color; + public $_left_color; /** * Style of the right border of the cell * @var integer */ - var $_right; + public $_right; /** * Color of the right border of the cell. * @var integer */ - var $_right_color; + public $_right_color; /** * Constructor diff --git a/functions/PEAR/Spreadsheet/Excel/Writer/Parser.php b/functions/PEAR/Spreadsheet/Excel/Writer/Parser.php index 9254a9634..0c22b9d77 100755 --- a/functions/PEAR/Spreadsheet/Excel/Writer/Parser.php +++ b/functions/PEAR/Spreadsheet/Excel/Writer/Parser.php @@ -114,55 +114,55 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR * The index of the character we are currently looking at * @var integer */ - var $_current_char; + public $_current_char; /** * The token we are working on. * @var string */ - var $_current_token; + public $_current_token; /** * The formula to parse * @var string */ - var $_formula; + public $_formula; /** * The character ahead of the current char * @var string */ - var $_lookahead; + public $_lookahead; /** * The parse tree to be generated * @var string */ - var $_parse_tree; + public $_parse_tree; /** * The byte order. 1 => big endian, 0 => little endian. * @var integer */ - var $_byte_order; + public $_byte_order; /** * Array of external sheets * @var array */ - var $_ext_sheets; + public $_ext_sheets; /** * Array of sheet references in the form of REF structures * @var array */ - var $_references; + public $_references; /** * The BIFF version for the workbook * @var integer */ - var $_BIFF_version; + public $_BIFF_version; /** * The class constructor diff --git a/functions/PEAR/Spreadsheet/Excel/Writer/Validator.php b/functions/PEAR/Spreadsheet/Excel/Writer/Validator.php index 107997cc8..25226db56 100755 --- a/functions/PEAR/Spreadsheet/Excel/Writer/Validator.php +++ b/functions/PEAR/Spreadsheet/Excel/Writer/Validator.php @@ -47,25 +47,25 @@ */ class Spreadsheet_Excel_Writer_Validator { - var $_type; - var $_style; - var $_fixedList; - var $_blank; - var $_incell; - var $_showprompt; - var $_showerror; - var $_title_prompt; - var $_descr_prompt; - var $_title_error; - var $_descr_error; - var $_operator; - var $_formula1; - var $_formula2; + public $_type; + public $_style; + public $_fixedList; + public $_blank; + public $_incell; + public $_showprompt; + public $_showerror; + public $_title_prompt; + public $_descr_prompt; + public $_title_error; + public $_descr_error; + public $_operator; + public $_formula1; + public $_formula2; /** * The parser from the workbook. Used to parse validation formulas also * @var Spreadsheet_Excel_Writer_Parser */ - var $_parser; + public $_parser; function __construct(&$parser) { diff --git a/functions/PEAR/Spreadsheet/Excel/Writer/Workbook.php b/functions/PEAR/Spreadsheet/Excel/Writer/Workbook.php index 6cd72019a..5820a92c9 100755 --- a/functions/PEAR/Spreadsheet/Excel/Writer/Workbook.php +++ b/functions/PEAR/Spreadsheet/Excel/Writer/Workbook.php @@ -53,117 +53,117 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri * Filename for the Workbook * @var string */ - var $_filename; + public $_filename; /** * Formula parser * @var object Parser */ - var $_parser; + public $_parser; /** * Flag for 1904 date system (0 => base date is 1900, 1 => base date is 1904) * @var integer */ - var $_1904; + public $_1904; /** * The active worksheet of the workbook (0 indexed) * @var integer */ - var $_activesheet; + public $_activesheet; /** * 1st displayed worksheet in the workbook (0 indexed) * @var integer */ - var $_firstsheet; + public $_firstsheet; /** * Number of workbook tabs selected * @var integer */ - var $_selected; + public $_selected; /** * Index for creating adding new formats to the workbook * @var integer */ - var $_xf_index; + public $_xf_index; /** * Flag for preventing close from being called twice. * @var integer * @see close() */ - var $_fileclosed; + public $_fileclosed; /** * The BIFF file size for the workbook. * @var integer * @see _calcSheetOffsets() */ - var $_biffsize; + public $_biffsize; /** * The default sheetname for all sheets created. * @var string */ - var $_sheetname; + public $_sheetname; /** * The default XF format. * @var object Format */ - var $_tmp_format; + public $_tmp_format; /** * Array containing references to all of this workbook's worksheets * @var array */ - var $_worksheets; + public $_worksheets; /** * Array of sheetnames for creating the EXTERNSHEET records * @var array */ - var $_sheetnames; + public $_sheetnames; /** * Array containing references to all of this workbook's formats * @var array */ - var $_formats; + public $_formats; /** * Array containing the colour palette * @var array */ - var $_palette; + public $_palette; /** * The default format for URLs. * @var object Format */ - var $_url_format; + public $_url_format; /** * The codepage indicates the text encoding used for strings * @var integer */ - var $_codepage; + public $_codepage; /** * The country code used for localization * @var integer */ - var $_country_code; + public $_country_code; /** * number of bytes for sizeinfo of strings * @var integer */ - var $_string_sizeinfo_size; + public $_string_sizeinfo_size; /** * Class constructor diff --git a/functions/PEAR/Spreadsheet/Excel/Writer/Worksheet.php b/functions/PEAR/Spreadsheet/Excel/Writer/Worksheet.php index 31bb991a5..26483759b 100755 --- a/functions/PEAR/Spreadsheet/Excel/Writer/Worksheet.php +++ b/functions/PEAR/Spreadsheet/Excel/Writer/Worksheet.php @@ -49,311 +49,311 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr * Name of the Worksheet * @var string */ - var $name; + public $name; /** * Index for the Worksheet * @var integer */ - var $index; + public $index; /** * Reference to the (default) Format object for URLs * @var object Format */ - var $_url_format; + public $_url_format; /** * Reference to the parser used for parsing formulas * @var object Format */ - var $_parser; + public $_parser; /** * Filehandle to the temporary file for storing data * @var resource */ - var $_filehandle; + public $_filehandle; /** * Boolean indicating if we are using a temporary file for storing data * @var bool */ - var $_using_tmpfile; + public $_using_tmpfile; /** * Maximum number of rows for an Excel spreadsheet (BIFF5) * @var integer */ - var $_xls_rowmax; + public $_xls_rowmax; /** * Maximum number of columns for an Excel spreadsheet (BIFF5) * @var integer */ - var $_xls_colmax; + public $_xls_colmax; /** * Maximum number of characters for a string (LABEL record in BIFF5) * @var integer */ - var $_xls_strmax; + public $_xls_strmax; /** * First row for the DIMENSIONS record * @var integer * @see _storeDimensions() */ - var $_dim_rowmin; + public $_dim_rowmin; /** * Last row for the DIMENSIONS record * @var integer * @see _storeDimensions() */ - var $_dim_rowmax; + public $_dim_rowmax; /** * First column for the DIMENSIONS record * @var integer * @see _storeDimensions() */ - var $_dim_colmin; + public $_dim_colmin; /** * Last column for the DIMENSIONS record * @var integer * @see _storeDimensions() */ - var $_dim_colmax; + public $_dim_colmax; /** * Array containing format information for columns * @var array */ - var $_colinfo; + public $_colinfo; /** * Array containing the selected area for the worksheet * @var array */ - var $_selection; + public $_selection; /** * Array containing the panes for the worksheet * @var array */ - var $_panes; + public $_panes; /** * The active pane for the worksheet * @var integer */ - var $_active_pane; + public $_active_pane; /** * Bit specifying if panes are frozen * @var integer */ - var $_frozen; + public $_frozen; /** * Bit specifying if the worksheet is selected * @var integer */ - var $selected; + public $selected; /** * The paper size (for printing) (DOCUMENT!!!) * @var integer */ - var $_paper_size; + public $_paper_size; /** * Bit specifying paper orientation (for printing). 0 => landscape, 1 => portrait * @var integer */ - var $_orientation; + public $_orientation; /** * The page header caption * @var string */ - var $_header; + public $_header; /** * The page footer caption * @var string */ - var $_footer; + public $_footer; /** * The horizontal centering value for the page * @var integer */ - var $_hcenter; + public $_hcenter; /** * The vertical centering value for the page * @var integer */ - var $_vcenter; + public $_vcenter; /** * The margin for the header * @var float */ - var $_margin_head; + public $_margin_head; /** * The margin for the footer * @var float */ - var $_margin_foot; + public $_margin_foot; /** * The left margin for the worksheet in inches * @var float */ - var $_margin_left; + public $_margin_left; /** * The right margin for the worksheet in inches * @var float */ - var $_margin_right; + public $_margin_right; /** * The top margin for the worksheet in inches * @var float */ - var $_margin_top; + public $_margin_top; /** * The bottom margin for the worksheet in inches * @var float */ - var $_margin_bottom; + public $_margin_bottom; /** * First row to reapeat on each printed page * @var integer */ - var $title_rowmin; + public $title_rowmin; /** * Last row to reapeat on each printed page * @var integer */ - var $title_rowmax; + public $title_rowmax; /** * First column to reapeat on each printed page * @var integer */ - var $title_colmin; + public $title_colmin; /** * First row of the area to print * @var integer */ - var $print_rowmin; + public $print_rowmin; /** * Last row to of the area to print * @var integer */ - var $print_rowmax; + public $print_rowmax; /** * First column of the area to print * @var integer */ - var $print_colmin; + public $print_colmin; /** * Last column of the area to print * @var integer */ - var $print_colmax; + public $print_colmax; /** * Whether to use outline. * @var integer */ - var $_outline_on; + public $_outline_on; /** * Auto outline styles. * @var bool */ - var $_outline_style; + public $_outline_style; /** * Whether to have outline summary below. * @var bool */ - var $_outline_below; + public $_outline_below; /** * Whether to have outline summary at the right. * @var bool */ - var $_outline_right; + public $_outline_right; /** * Outline row level. * @var integer */ - var $_outline_row_level; + public $_outline_row_level; /** * Whether to fit to page when printing or not. * @var bool */ - var $_fit_page; + public $_fit_page; /** * Number of pages to fit wide * @var integer */ - var $_fit_width; + public $_fit_width; /** * Number of pages to fit high * @var integer */ - var $_fit_height; + public $_fit_height; /** * Reference to the total number of strings in the workbook * @var integer */ - var $_str_total; + public $_str_total; /** * Reference to the number of unique strings in the workbook * @var integer */ - var $_str_unique; + public $_str_unique; /** * Reference to the array containing all the unique strings in the workbook * @var array */ - var $_str_table; + public $_str_table; /** * Merged cell ranges * @var array */ - var $_merged_ranges; + public $_merged_ranges; /** * Charset encoding currently used when calling writeString() * @var string */ - var $_input_encoding; + public $_input_encoding; /** * Constructor @@ -1284,6 +1284,7 @@ function _XF(&$format) * @access private * @param string $data The binary data to append */ + #[\Override] function _append($data) { if ($this->_using_tmpfile) { diff --git a/functions/adLDAP/src/classes/adLDAPGroups.php b/functions/adLDAP/src/classes/adLDAPGroups.php index 78d0fa957..18f4f4b6b 100755 --- a/functions/adLDAP/src/classes/adLDAPGroups.php +++ b/functions/adLDAP/src/classes/adLDAPGroups.php @@ -589,11 +589,7 @@ public function getPrimaryGroup($gid, $usersid) $fields = array("samaccountname","distinguishedname"); $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields); $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr); - - if (isset($entries[0]['distinguishedname'][0])) { - return $entries[0]['distinguishedname'][0]; - } - return false; + return $entries[0]['distinguishedname'][0] ?? false; } /** diff --git a/functions/classes/class.LockForUpdate.php b/functions/classes/class.LockForUpdate.php index e085319b1..fc90366e9 100644 --- a/functions/classes/class.LockForUpdate.php +++ b/functions/classes/class.LockForUpdate.php @@ -73,7 +73,7 @@ public function obtain_lock($timeout_seconds) { do { $locked = flock($this->locked_res, LOCK_EX | LOCK_NB); if (!$locked) { - usleep(rand(2000, 5000)); + usleep(random_int(2000, 5000)); } } while (!$locked && ((microtime(true) - $start_time) < $timeout)); @@ -88,6 +88,7 @@ public function obtain_lock($timeout_seconds) { * * @return void */ + #[\Override] public function release_lock() { if ($this->locked_res) { $res = $this->locked_res; @@ -195,6 +196,7 @@ public function obtain_lock($timeout_seconds) { * * @return void */ + #[\Override] public function release_lock() { $this->locked_res = false; $this->Database->commit(); diff --git a/functions/classes/class.Mail.php b/functions/classes/class.Mail.php index 86d522e39..9e70613c0 100644 --- a/functions/classes/class.Mail.php +++ b/functions/classes/class.Mail.php @@ -134,7 +134,8 @@ public function override_settings($override_settings) { * @param int $level (default: 2) * @return void */ - public function set_debugging ($level = 2) { + #[\Override] + public function set_debugging ($level = 2) { $this->Php_mailer->SMTPDebug = $level == 1 ? 1 : 2; // output $this->Php_mailer->Debugoutput = 'html'; diff --git a/functions/classes/class.PDO.php b/functions/classes/class.PDO.php index b27b41b0c..e4a8718ce 100644 --- a/functions/classes/class.PDO.php +++ b/functions/classes/class.PDO.php @@ -507,7 +507,7 @@ public function escape($str) { // SQL Injection - strip backquote character $str = str_replace('`', '', $str); - return $this->unquote_outer($this->pdo->quote($str)); + return static::unquote_outer($this->pdo->quote($str)); } /** @@ -1220,7 +1220,8 @@ private function set_db_params () { * @access public * @return void */ - public function connect() { + #[\Override] + public function connect() { parent::connect(); //@$this->pdo->query('SET NAMES \'' . $this->charset . '\';'); } @@ -1231,7 +1232,8 @@ public function connect() { * @access protected * @return string */ - protected function makeDsn() { + #[\Override] + protected function makeDsn() { # for installation if($this->install) { return 'mysql:host=' . $this->host . ';port=' . $this->port . ';charset=' . $this->charset; } else { return 'mysql:host=' . $this->host . ';port=' . $this->port . ';dbname=' . $this->dbname . ';charset=' . $this->charset; } diff --git a/functions/classes/class.Params.php b/functions/classes/class.Params.php index 97e1af382..4886047b9 100644 --- a/functions/classes/class.Params.php +++ b/functions/classes/class.Params.php @@ -43,6 +43,7 @@ public function __construct($args = [], $default = null, $strip_tags = false, $h * * @return int */ + #[\Override] public function count() : int { return count($this->as_array()); } @@ -65,10 +66,7 @@ public function as_array() { * @return mixed */ public function __get($name) { - if (isset($this->{$name})) - return $this->{$name}; - - return $this->____default; + return $this->{$name} ?? $this->____default; } /** diff --git a/functions/classes/class.PowerDNS.php b/functions/classes/class.PowerDNS.php index 05bdc75a3..6e7c95b67 100644 --- a/functions/classes/class.PowerDNS.php +++ b/functions/classes/class.PowerDNS.php @@ -1489,7 +1489,7 @@ public function get_ptr_zone_name_v6 ($ip, $mask) { $networkp = $ipp & $maskp; $ipt = ''; - foreach(str_split($networkp) as $char) $ipt .= str_pad(dechex(ord($char)), 2, '0', STR_PAD_LEFT); + foreach(str_split($networkp) as $char) $ipt .= str_pad(dechex(ord($char[0])), 2, '0', STR_PAD_LEFT); $prefixnibbles = floor($mask / 4); $network = substr($ipt, 0, $prefixnibbles); $zone = array_reverse(str_split($network)); diff --git a/functions/classes/class.Radius.php b/functions/classes/class.Radius.php index 49cf4d183..3b7b5a728 100644 --- a/functions/classes/class.Radius.php +++ b/functions/classes/class.Radius.php @@ -185,33 +185,33 @@ *********************************************************************/ class Radius { - var $_ip_radius_server; // Radius server IP address - var $_shared_secret; // Shared secret with the radius server - var $_radius_suffix; // Radius suffix (default is ''); - var $_udp_timeout; // Timeout of the UDP connection in seconds (default value is 5) - var $_authentication_port; // Authentication port (default value is 1812) - var $_accounting_port; // Accounting port (default value is 1813) - var $_nas_ip_address; // NAS IP address - var $_nas_port; // NAS port - var $_encrypted_password; // Encrypted password, as described in the RFC 2865 - var $_user_ip_address; // Remote IP address of the user - var $_request_authenticator; // Request-Authenticator, 16 octets random number - var $_response_authenticator; // Request-Authenticator, 16 octets random number - var $_username; // Username to sent to the Radius server - var $_password; // Password to sent to the Radius server (clear password, must be encrypted) - var $_identifier_to_send; // Identifier field for the packet to be sent - var $_identifier_received; // Identifier field for the received packet - var $_radius_packet_to_send; // Radius packet code (1=Access-Request, 2=Access-Accept, 3=Access-Reject, 4=Accounting-Request, 5=Accounting-Response, 11=Access-Challenge, 12=Status-Server (experimental), 13=Status-Client (experimental), 255=Reserved - var $_radius_packet_received; // Radius packet code (1=Access-Request, 2=Access-Accept, 3=Access-Reject, 4=Accounting-Request, 5=Accounting-Response, 11=Access-Challenge, 12=Status-Server (experimental), 13=Status-Client (experimental), 255=Reserved - var $_attributes_to_send; // Radius attributes to send - var $_attributes_received; // Radius attributes received - var $_socket_to_server; // Socket connection - var $_debug_mode; // Debug mode flag - var $debug_text = []; // Debug messages - var $_attributes_info; // Attributes info array - var $_radius_packet_info; // Radius packet codes info array - var $_last_error_code; // Last error code - var $_last_error_message; // Last error message + public $_ip_radius_server; // Radius server IP address + public $_shared_secret; // Shared secret with the radius server + public $_radius_suffix; // Radius suffix (default is ''); + public $_udp_timeout; // Timeout of the UDP connection in seconds (default value is 5) + public $_authentication_port; // Authentication port (default value is 1812) + public $_accounting_port; // Accounting port (default value is 1813) + public $_nas_ip_address; // NAS IP address + public $_nas_port; // NAS port + public $_encrypted_password; // Encrypted password, as described in the RFC 2865 + public $_user_ip_address; // Remote IP address of the user + public $_request_authenticator; // Request-Authenticator, 16 octets random number + public $_response_authenticator; // Request-Authenticator, 16 octets random number + public $_username; // Username to sent to the Radius server + public $_password; // Password to sent to the Radius server (clear password, must be encrypted) + public $_identifier_to_send; // Identifier field for the packet to be sent + public $_identifier_received; // Identifier field for the received packet + public $_radius_packet_to_send; // Radius packet code (1=Access-Request, 2=Access-Accept, 3=Access-Reject, 4=Accounting-Request, 5=Accounting-Response, 11=Access-Challenge, 12=Status-Server (experimental), 13=Status-Client (experimental), 255=Reserved + public $_radius_packet_received; // Radius packet code (1=Access-Request, 2=Access-Accept, 3=Access-Reject, 4=Accounting-Request, 5=Accounting-Response, 11=Access-Challenge, 12=Status-Server (experimental), 13=Status-Client (experimental), 255=Reserved + public $_attributes_to_send; // Radius attributes to send + public $_attributes_received; // Radius attributes received + public $_socket_to_server; // Socket connection + public $_debug_mode; // Debug mode flag + public $debug_text = []; // Debug messages + public $_attributes_info; // Attributes info array + public $_radius_packet_info; // Radius packet codes info array + public $_last_error_code; // Last error code + public $_last_error_message; // Last error message /********************************************************************* @@ -322,7 +322,7 @@ function GenerateRequestAuthenticator() $this->_request_authenticator = ''; for ($ra_loop = 0; $ra_loop <= 15; $ra_loop++) { - $this->_request_authenticator .= chr(rand(1, 255)); + $this->_request_authenticator .= chr(random_int(1, 255)); } } @@ -422,7 +422,7 @@ function SetPassword($password = '') $previous_result = ''; for ($xor_loop = 0; $xor_loop <= 15; $xor_loop++) { - $value1 = ord(substr($padded_password, ($full_loop * 16) + $xor_loop, 1)); + $value1 = ord(substr($padded_password, ($full_loop * 16) + $xor_loop, 1)[0]); $value2 = hexdec(substr($xor_value, 2 * $xor_loop, 2)); $xor_result = $value1^$value2; $previous_result .= chr($xor_result); @@ -583,7 +583,7 @@ function SetAttribute($type, $value) $attribute_count = count((array)$this->_attributes_to_send); for ($attributes_loop = 0; $attributes_loop < $attribute_count; $attributes_loop++) { - if ($type == ord(substr($this->_attributes_to_send[$attributes_loop], 0, 1))) + if ($type == ord(substr($this->_attributes_to_send[$attributes_loop], 0, 1)[0])) { $attribute_index = $attributes_loop; break; @@ -646,10 +646,10 @@ function DecodeAttribute($attribute_raw_value, $attribute_format) $attribute_value = $attribute_raw_value; break; case 'A': // Address, 32 bit value, most significant octet first. - $attribute_value = ord(substr($attribute_raw_value, 0, 1)).'.'.ord(substr($attribute_raw_value, 1, 1)).'.'.ord(substr($attribute_raw_value, 2, 1)).'.'.ord(substr($attribute_raw_value, 3, 1)); + $attribute_value = ord(substr($attribute_raw_value, 0, 1)[0]).'.'.ord(substr($attribute_raw_value, 1, 1)[0]).'.'.ord(substr($attribute_raw_value, 2, 1)[0]).'.'.ord(substr($attribute_raw_value, 3, 1)[0]); break; case 'I': // Integer, 32 bit unsigned value, most significant octet first. - $attribute_value = (ord(substr($attribute_raw_value, 0, 1)) * 256 * 256 * 256) + (ord(substr($attribute_raw_value, 1, 1)) * 256 * 256) + (ord(substr($attribute_raw_value, 2, 1)) * 256) + ord(substr($attribute_raw_value, 3, 1)); + $attribute_value = (ord(substr($attribute_raw_value, 0, 1)[0]) * 256 * 256 * 256) + (ord(substr($attribute_raw_value, 1, 1)[0]) * 256 * 256) + (ord(substr($attribute_raw_value, 2, 1)[0]) * 256) + ord(substr($attribute_raw_value, 3, 1)[0]); break; case 'D': // Time, 32 bit unsigned value, most significant octet first -- seconds since 00:00:00 UTC, January 1, 1970. (not used in this RFC) $attribute_value = NULL; @@ -669,12 +669,12 @@ function DecodeVendorSpecificContent($vendor_specific_raw_value) { $result = array(); $offset_in_raw = 0; - $vendor_id = (ord(substr($vendor_specific_raw_value, 0, 1)) * 256 * 256 * 256) + (ord(substr($vendor_specific_raw_value, 1, 1)) * 256 * 256) + (ord(substr($vendor_specific_raw_value, 2, 1)) * 256) + ord(substr($vendor_specific_raw_value, 3, 1)); + $vendor_id = (ord(substr($vendor_specific_raw_value, 0, 1)[0]) * 256 * 256 * 256) + (ord(substr($vendor_specific_raw_value, 1, 1)[0]) * 256 * 256) + (ord(substr($vendor_specific_raw_value, 2, 1)[0]) * 256) + ord(substr($vendor_specific_raw_value, 3, 1)[0]); $offset_in_raw += 4; while ($offset_in_raw < strlen($vendor_specific_raw_value)) { - $vendor_type = (ord(substr($vendor_specific_raw_value, 0 + $offset_in_raw, 1))); - $vendor_length = (ord(substr($vendor_specific_raw_value, 1 + $offset_in_raw, 1))); + $vendor_type = (ord(substr($vendor_specific_raw_value, 0 + $offset_in_raw, 1)[0])); + $vendor_length = (ord(substr($vendor_specific_raw_value, 1 + $offset_in_raw, 1)[0])); $attribute_specific = substr($vendor_specific_raw_value, 2 + $offset_in_raw, $vendor_length); $result[] = array($vendor_id, $vendor_type, $attribute_specific); $offset_in_raw += ($vendor_length); @@ -759,8 +759,8 @@ function AccessRequest($username = '', $password = '', $udp_timeout = 0, $state $readable_attributes = ''; foreach ($this->_attributes_to_send as $one_attribute_to_send) { - $attribute_info = $this->GetAttributesInfo(ord(substr($one_attribute_to_send, 0, 1))); - $this->DebugInfo('Attribute '.ord(substr($one_attribute_to_send, 0, 1)).' ('.$attribute_info[0].'), length '.(ord(substr($one_attribute_to_send, 1, 1)) - 2).', format '.$attribute_info[1].', value '.$this->DecodeAttribute(substr($one_attribute_to_send, 2), ord(substr($one_attribute_to_send, 0, 1))).''); + $attribute_info = $this->GetAttributesInfo(ord(substr($one_attribute_to_send, 0, 1)[0])); + $this->DebugInfo('Attribute '.ord(substr($one_attribute_to_send, 0, 1)[0]).' ('.$attribute_info[0].'), length '.(ord(substr($one_attribute_to_send, 1, 1)[0]) - 2).', format '.$attribute_info[1].', value '.$this->DecodeAttribute(substr($one_attribute_to_send, 2), ord(substr($one_attribute_to_send, 0, 1)[0])).''); } } $read_socket_array = array($_socket_to_server); @@ -791,20 +791,20 @@ function AccessRequest($username = '', $password = '', $udp_timeout = 0, $state } } - $this->_radius_packet_received = intval(ord(substr($received_packet, 0, 1))); + $this->_radius_packet_received = intval(ord(substr($received_packet, 0, 1)[0])); $this->DebugInfo('Packet type '.$this->_radius_packet_received.' ('.$this->GetRadiusPacketInfo($this->_radius_packet_received).')'.' received'); if ($this->_radius_packet_received > 0) { - $this->_identifier_received = intval(ord(substr($received_packet, 1, 1))); - $packet_length = (intval(ord(substr($received_packet, 2, 1))) * 256) + (intval(ord(substr($received_packet, 3, 1)))); + $this->_identifier_received = intval(ord(substr($received_packet, 1, 1)[0])); + $packet_length = (intval(ord(substr($received_packet, 2, 1)[0])) * 256) + (intval(ord(substr($received_packet, 3, 1)[0]))); $this->_response_authenticator = substr($received_packet, 4, 16); $attributes_content = substr($received_packet, 20, ($packet_length - 4 - 16)); while (strlen($attributes_content) > 2) { - $attribute_type = intval(ord(substr($attributes_content, 0, 1))); - $attribute_length = intval(ord(substr($attributes_content, 1, 1))); + $attribute_type = intval(ord(substr($attributes_content, 0, 1)[0])); + $attribute_length = intval(ord(substr($attributes_content, 1, 1)[0])); $attribute_raw_value = substr($attributes_content, 2, $attribute_length - 2); $attributes_content = substr($attributes_content, $attribute_length); diff --git a/functions/classes/class.User.php b/functions/classes/class.User.php index d3382a277..3ffec9906 100644 --- a/functions/classes/class.User.php +++ b/functions/classes/class.User.php @@ -1618,7 +1618,7 @@ public function crypt_user_pass ($input) { private function detect_crypt_type () { if(CRYPT_SHA512 == 1) { return '$6$rounds=3000$'; } elseif(CRYPT_SHA256 == 1) { return '$5$rounds=3000$'; } - elseif(CRYPT_BLOWFISH == 1) { return '$2y$'.str_pad(rand(4,31),2,0, STR_PAD_LEFT).'$'; } + elseif(CRYPT_BLOWFISH == 1) { return '$2y$'.str_pad(random_int(4,31),2,0, STR_PAD_LEFT).'$'; } elseif(CRYPT_MD5 == 1) { return '$5$rounds=3000$'; } else { $this->Result->show("danger", _("No crypt types supported"), true); } } diff --git a/functions/php-excel-reader/excel_reader2.php b/functions/php-excel-reader/excel_reader2.php index eb50e9b48..29c5f6cae 100755 --- a/functions/php-excel-reader/excel_reader2.php +++ b/functions/php-excel-reader/excel_reader2.php @@ -94,7 +94,7 @@ function v($data,$pos) { #[AllowDynamicProperties] class OLERead extends stdClass { - var $data = ''; + public $data = ''; function __construct(){ } function read($sFileName){ @@ -314,10 +314,10 @@ function getWorkBook(){ class Spreadsheet_Excel_Reader extends stdClass { // MK: Added to make data retrieval easier - var $colnames = array(); - var $colindexes = array(); - var $standardColWidth = 0; - var $defaultColWidth = 0; + public $colnames = array(); + public $colindexes = array(); + public $standardColWidth = 0; + public $defaultColWidth = 0; function myHex($d) { if ($d < 16) return "0" . dechex($d); @@ -654,28 +654,28 @@ function dump($row_numbers=false,$col_letters=false,$sheet=0,$table_class='excel // END PUBLIC API - var $boundsheets = array(); - var $formatRecords = array(); - var $fontRecords = array(); - var $xfRecords = array(); - var $colInfo = array(); - var $rowInfo = array(); + public $boundsheets = array(); + public $formatRecords = array(); + public $fontRecords = array(); + public $xfRecords = array(); + public $colInfo = array(); + public $rowInfo = array(); - var $sst = array(); - var $sheets = array(); + public $sst = array(); + public $sheets = array(); - var $data; - var $_ole; - var $_defaultEncoding = "UTF-8"; - var $_defaultFormat = SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT; - var $_columnsFormat = array(); - var $_rowoffset = 1; - var $_coloffset = 1; + public $data; + public $_ole; + public $_defaultEncoding = "UTF-8"; + public $_defaultFormat = SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT; + public $_columnsFormat = array(); + public $_rowoffset = 1; + public $_coloffset = 1; /** * List of default date formats used by Excel */ - var $dateFormats = array ( + public $dateFormats = array ( 0xe => "m/d/Y", 0xf => "M-d-Y", 0x10 => "d-M", @@ -693,7 +693,7 @@ function dump($row_numbers=false,$col_letters=false,$sheet=0,$table_class='excel /** * Default number formats used by Excel */ - var $numberFormats = array( + public $numberFormats = array( 0x1 => "0", 0x2 => "0.00", 0x3 => "#,##0", @@ -716,7 +716,7 @@ function dump($row_numbers=false,$col_letters=false,$sheet=0,$table_class='excel 0x30 => "##0.0E+0" ); - var $colors = Array( + public $colors = Array( 0x00 => "#000000", 0x01 => "#FFFFFF", 0x02 => "#FF0000", @@ -794,7 +794,7 @@ function dump($row_numbers=false,$col_letters=false,$sheet=0,$table_class='excel 0x7FFF => "#000000" ); - var $lineStyles = array( + public $lineStyles = array( 0x00 => "", 0x01 => "Thin", 0x02 => "Medium", @@ -811,7 +811,7 @@ function dump($row_numbers=false,$col_letters=false,$sheet=0,$table_class='excel 0x0D => "Slanted medium dash-dotted" ); - var $lineStylesCss = array( + public $lineStylesCss = array( "Thin" => "1px solid", "Medium" => "2px solid", "Dashed" => "1px dashed", From e543679f1871697fb027a3ebb0ec4b54017eacf7 Mon Sep 17 00:00:00 2001 From: Gary Date: Sun, 26 Apr 2026 22:13:29 +0100 Subject: [PATCH 09/28] Bugfix: Rector PHP fixes * NullToStrictStringFuncCallArgRector * ArrayKeyExistsNullToEmptyStringRector * StringifyStrNeedlesRector was applied --- .gitmodules | 1 + api/controllers/Addresses.php | 4 +- api/controllers/Common.php | 12 +-- api/controllers/Prefix.php | 4 +- api/controllers/Responses.php | 4 +- api/controllers/Search.php | 2 +- api/controllers/Sections.php | 4 +- api/controllers/Subnets.php | 4 +- api/controllers/User.php | 4 +- api/index.php | 16 ++-- app/admin/2fa/save.php | 2 +- app/admin/api/edit-result.php | 4 +- app/admin/api/index.php | 2 +- app/admin/circuits/edit-circuit-submit.php | 4 +- app/admin/custom-fields/edit-result.php | 4 +- app/admin/custom-fields/index.php | 4 +- app/admin/customers/edit-submit.php | 8 +- app/admin/customers/edit.php | 2 +- app/admin/customers/unlink.php | 2 +- app/admin/device-types/edit-result.php | 4 +- app/admin/devices/edit-result.php | 2 +- app/admin/devices/edit-snmp-result.php | 2 +- app/admin/devices/edit-snmp-test.php | 4 +- app/admin/filter-fields/index.php | 2 +- app/admin/firewall-zones/ajax.php | 12 +-- .../firewall-zones/mapping-edit-result.php | 14 +-- app/admin/firewall-zones/mapping-edit.php | 2 +- app/admin/firewall-zones/settings-save.php | 16 ++-- .../firewall-zones/subnet-to-zone-save.php | 10 +-- app/admin/firewall-zones/subnet-to-zone.php | 2 +- .../zones-edit-network-result.php | 6 +- .../firewall-zones/zones-edit-network.php | 4 +- .../firewall-zones/zones-edit-result.php | 12 +-- app/admin/firewall-zones/zones-edit.php | 2 +- app/admin/groups/ad-search-group-result.php | 2 +- app/admin/groups/add-users-result.php | 4 +- app/admin/groups/edit-group-result.php | 2 +- app/admin/groups/remove-users-result.php | 4 +- .../export-ipaddr-field-select.php | 4 +- app/admin/import-export/export-ipaddr.php | 4 +- .../export-subnets-field-select.php | 2 +- app/admin/import-export/export-subnets.php | 4 +- app/admin/import-export/generate-hosts.php | 2 +- app/admin/import-export/generate-mysql.php | 2 +- .../import-export/import-devices-check.php | 26 +++--- .../import-export/import-devices-select.php | 4 +- .../import-export/import-devtype-select.php | 2 +- .../import-export/import-ipaddr-check.php | 26 +++--- .../import-export/import-ipaddr-select.php | 4 +- .../import-export/import-l2dom-check.php | 4 +- .../import-export/import-l2dom-select.php | 2 +- app/admin/import-export/import-load-data.php | 10 +-- .../import-export/import-recompute-logic.php | 2 +- .../import-export/import-subnets-check.php | 20 ++--- .../import-export/import-subnets-select.php | 4 +- app/admin/import-export/import-vlan-check.php | 8 +- .../import-export/import-vlan-select.php | 4 +- app/admin/import-export/import-vrf-check.php | 6 +- app/admin/import-export/import-vrf-select.php | 4 +- app/admin/languages/edit-result.php | 4 +- app/admin/locations/edit-result.php | 4 +- app/admin/nameservers/edit-result.php | 8 +- app/admin/nat/edit-map.php | 4 +- app/admin/nat/edit-result.php | 2 +- app/admin/nat/item-add-search.php | 2 +- app/admin/powerDNS/domain-edit-result.php | 4 +- app/admin/powerDNS/record-edit-result.php | 6 +- app/admin/powerDNS/record-edit.php | 2 +- app/admin/powerDNS/settings.php | 4 +- app/admin/requests/index.php | 2 +- app/admin/required-fields/index.php | 2 +- app/admin/ripe-import/import-subnets.php | 2 +- app/admin/ripe-import/ripe-telnet.php | 6 +- app/admin/scan-agents/edit-result.php | 2 +- app/admin/scan-agents/index.php | 4 +- app/admin/sections/index.php | 2 +- app/admin/settings/logo/import-verify.php | 2 +- app/admin/settings/settings-save.php | 2 +- app/admin/subnets/edit-folder-result.php | 2 +- app/admin/subnets/edit-result.php | 8 +- app/admin/subnets/edit.php | 4 +- app/admin/subnets/permissions-show.php | 2 +- app/admin/subnets/ripe-query.php | 6 +- app/admin/tags/edit-result.php | 6 +- app/admin/users/ad-search-result.php | 2 +- app/admin/users/edit-notify.php | 2 +- app/admin/users/edit-result.php | 2 +- app/admin/users/edit.php | 2 +- app/admin/users/print_module_permissions.php | 4 +- .../vaults/download-certificate-execute.php | 4 +- app/admin/vaults/download-certificate.php | 2 +- .../vaults/edit-item-certificate-result.php | 4 +- .../vaults/edit-item-password-result.php | 6 +- app/admin/vaults/edit-result.php | 4 +- .../vaults/import-certificate-file-verify.php | 2 +- app/admin/version-check/index.php | 2 +- app/admin/vlans/edit-domain-result.php | 2 +- app/admin/vlans/vlans-scan-execute.php | 2 +- app/admin/vlans/vlans-scan-result.php | 12 +-- app/admin/vrf/edit-result.php | 2 +- app/admin/vrf/vrf-scan-execute.php | 2 +- app/admin/vrf/vrf-scan-result.php | 10 +-- app/admin/widgets/edit-result.php | 2 +- app/dashboard/index.php | 2 +- app/dashboard/widgets/index.php | 2 +- app/dashboard/widgets/ipcalc-result.php | 2 +- app/dashboard/widgets/top10_hosts_lib.php | 6 +- app/error.php | 2 +- app/install/postinstall_submit.php | 4 +- app/login/2fa/2fa_create.php | 4 +- app/login/2fa/2fa_validate.php | 2 +- app/login/login_check.php | 2 +- app/login/request_ip_form.php | 2 +- app/saml2/index.php | 2 +- app/sections/all-sections.php | 2 +- app/sections/menu/menu-tools-admin.php | 2 +- app/sections/section-changelog.php | 2 +- app/sections/user-menu.php | 4 +- .../address-details/address-changelog.php | 2 +- .../address-details-permissions.php | 2 +- .../address-details/address-details.php | 6 +- .../addresses/address-modify-submit.php | 6 +- app/subnets/addresses/address-modify.php | 4 +- app/subnets/addresses/export-subnet.php | 2 +- app/subnets/addresses/print-address-table.php | 2 +- app/subnets/import-subnet/import-verify.php | 4 +- .../scan/subnet-scan-execute-scan-icmp.php | 2 +- .../scan/subnet-scan-execute-scan-telnet.php | 2 +- .../scan/subnet-scan-execute-snmp-mac.php | 2 +- .../subnet-scan-execute-update-snmp-arp.php | 2 +- .../scan/subnet-scan-result-scan-icmp.php | 12 +-- .../scan/subnet-scan-result-scan-snmp-arp.php | 18 ++-- .../scan/subnet-scan-result-snmp-mac.php | 18 ++-- .../subnet-scan-result-snmp-route-all.php | 2 +- .../subnet-details/subnet-changelog.php | 2 +- app/subnets/subnet-details/subnet-details.php | 4 +- .../subnet-details/subnet-map-vertical.php | 2 +- .../subnet-details/subnet-permissions.php | 2 +- app/subnets/subnet-visual.php | 4 +- app/temp_share/address.php | 4 +- app/temp_share/index.php | 2 +- app/tools/changelog/changelog-print.php | 2 +- .../logical-circuit-details-members.php | 4 +- app/tools/circuits/options.php | 4 +- .../circuit-details-points.php | 4 +- .../customer/objects/ipaddresses.php | 2 +- app/tools/documentation/index.php | 6 +- app/tools/locations/single-location.php | 2 +- app/tools/mac-lookup/results.php | 2 +- app/tools/multicast-networks/index.php | 2 +- app/tools/multicast-networks/validate_mac.php | 2 +- app/tools/nat/all_nats.php | 6 +- app/tools/nat/nat_details.php | 4 +- app/tools/pass-change/result.php | 2 +- app/tools/powerDNS/domain-records.php | 2 +- app/tools/powerDNS/domains-print.php | 2 +- .../pstn-prefixes/edit-number-result.php | 4 +- app/tools/pstn-prefixes/edit-result.php | 2 +- app/tools/routing/bgp/details-subnets.php | 2 +- app/tools/search/index.php | 2 +- app/tools/search/search-results.php | 2 +- app/tools/temp-shares/delete-result.php | 2 +- app/tools/temp-shares/edit-result.php | 4 +- app/tools/tools-menu-config.php | 2 +- app/tools/user-menu/2fa.php | 2 +- app/tools/user-menu/passkeys.php | 2 +- app/tools/vaults/all-vaults.php | 2 +- .../vault/vault-item-details-general.php | 18 ++-- .../vaults/vault/vault-items-certificates.php | 4 +- functions/PEAR/Net/DNS2.php | 8 +- functions/PEAR/Net/DNS2/BitMap.php | 2 +- functions/PEAR/Net/DNS2/Cache.php | 2 +- functions/PEAR/Net/DNS2/Cache/File.php | 4 +- functions/PEAR/Net/DNS2/Cache/Shm.php | 2 +- functions/PEAR/Net/DNS2/Packet.php | 6 +- functions/PEAR/Net/DNS2/PrivateKey.php | 26 +++--- functions/PEAR/Net/DNS2/RR.php | 10 +-- functions/PEAR/Net/DNS2/RR/AAAA.php | 2 +- functions/PEAR/Net/DNS2/RR/AFSDB.php | 4 +- functions/PEAR/Net/DNS2/RR/AMTRELAY.php | 10 +-- functions/PEAR/Net/DNS2/RR/APL.php | 8 +- functions/PEAR/Net/DNS2/RR/ATMA.php | 8 +- functions/PEAR/Net/DNS2/RR/CAA.php | 10 +-- functions/PEAR/Net/DNS2/RR/CERT.php | 12 +-- functions/PEAR/Net/DNS2/RR/CNAME.php | 2 +- functions/PEAR/Net/DNS2/RR/CSYNC.php | 6 +- functions/PEAR/Net/DNS2/RR/DHCID.php | 12 +-- functions/PEAR/Net/DNS2/RR/DNAME.php | 2 +- functions/PEAR/Net/DNS2/RR/DNSKEY.php | 8 +- functions/PEAR/Net/DNS2/RR/DS.php | 4 +- functions/PEAR/Net/DNS2/RR/EUI48.php | 8 +- functions/PEAR/Net/DNS2/RR/EUI64.php | 8 +- functions/PEAR/Net/DNS2/RR/HINFO.php | 8 +- functions/PEAR/Net/DNS2/RR/HIP.php | 16 ++-- functions/PEAR/Net/DNS2/RR/IPSECKEY.php | 14 +-- functions/PEAR/Net/DNS2/RR/ISDN.php | 8 +- functions/PEAR/Net/DNS2/RR/KX.php | 6 +- functions/PEAR/Net/DNS2/RR/L32.php | 6 +- functions/PEAR/Net/DNS2/RR/L64.php | 6 +- functions/PEAR/Net/DNS2/RR/LOC.php | 2 +- functions/PEAR/Net/DNS2/RR/LP.php | 6 +- functions/PEAR/Net/DNS2/RR/MX.php | 4 +- functions/PEAR/Net/DNS2/RR/NAPTR.php | 10 +-- functions/PEAR/Net/DNS2/RR/NID.php | 6 +- functions/PEAR/Net/DNS2/RR/NS.php | 2 +- functions/PEAR/Net/DNS2/RR/NSAP.php | 32 +++---- functions/PEAR/Net/DNS2/RR/NSEC.php | 4 +- functions/PEAR/Net/DNS2/RR/NSEC3.php | 20 ++--- functions/PEAR/Net/DNS2/RR/NSEC3PARAM.php | 8 +- functions/PEAR/Net/DNS2/RR/OPENPGPKEY.php | 6 +- functions/PEAR/Net/DNS2/RR/OPT.php | 6 +- functions/PEAR/Net/DNS2/RR/PTR.php | 4 +- functions/PEAR/Net/DNS2/RR/PX.php | 4 +- functions/PEAR/Net/DNS2/RR/RP.php | 2 +- functions/PEAR/Net/DNS2/RR/RRSIG.php | 20 ++--- functions/PEAR/Net/DNS2/RR/RT.php | 4 +- functions/PEAR/Net/DNS2/RR/SIG.php | 22 ++--- functions/PEAR/Net/DNS2/RR/SOA.php | 4 +- functions/PEAR/Net/DNS2/RR/SRV.php | 4 +- functions/PEAR/Net/DNS2/RR/SSHFP.php | 8 +- functions/PEAR/Net/DNS2/RR/TALINK.php | 6 +- functions/PEAR/Net/DNS2/RR/TKEY.php | 18 ++-- functions/PEAR/Net/DNS2/RR/TLSA.php | 8 +- functions/PEAR/Net/DNS2/RR/TSIG.php | 24 ++--- functions/PEAR/Net/DNS2/RR/TXT.php | 4 +- functions/PEAR/Net/DNS2/RR/TYPE65534.php | 6 +- functions/PEAR/Net/DNS2/RR/URI.php | 6 +- functions/PEAR/Net/DNS2/RR/WKS.php | 8 +- functions/PEAR/Net/DNS2/RR/X25.php | 4 +- functions/PEAR/Net/DNS2/Resolver.php | 4 +- functions/PEAR/Net/DNS2/Socket.php | 2 +- functions/PEAR/Net/IPv4.php | 6 +- functions/PEAR/Net/IPv6.php | 10 +-- functions/PEAR/Net/Ping.php | 34 +++---- functions/PEAR/OLE/ChainedBlockStream.php | 2 +- functions/PEAR/OLE/OLE.php | 4 +- functions/PEAR/OLE/PPS/Root.php | 4 +- .../PEAR/Spreadsheet/Excel/Writer/Format.php | 4 +- .../PEAR/Spreadsheet/Excel/Writer/Parser.php | 56 ++++++------ .../Spreadsheet/Excel/Writer/Validator.php | 12 +-- .../Spreadsheet/Excel/Writer/Workbook.php | 18 ++-- .../Spreadsheet/Excel/Writer/Worksheet.php | 28 +++--- .../adLDAP/src/classes/adLDAPContacts.php | 2 +- .../adLDAP/src/classes/adLDAPExchange.php | 8 +- functions/adLDAP/src/classes/adLDAPUsers.php | 8 +- functions/adLDAP/src/classes/adLDAPUtils.php | 4 +- .../src/collections/adLDAPCollection.php | 4 +- functions/classes/class.Addresses.php | 6 +- functions/classes/class.Admin.php | 4 +- functions/classes/class.Common.php | 32 +++---- functions/classes/class.Crypto.php | 2 +- functions/classes/class.FirewallZones.php | 12 +-- functions/classes/class.Install.php | 10 +-- functions/classes/class.Log.php | 14 +-- functions/classes/class.OpenStreetMap.php | 2 +- functions/classes/class.PDO.php | 10 +-- functions/classes/class.Password_check.php | 2 +- functions/classes/class.PowerDNS.php | 20 ++--- functions/classes/class.Rackspace.php | 8 +- functions/classes/class.Radius.php | 40 ++++----- functions/classes/class.Result.php | 2 +- functions/classes/class.Rewrite.php | 8 +- functions/classes/class.SNMP.php | 12 +-- functions/classes/class.Scan.php | 4 +- functions/classes/class.Sections.php | 2 +- functions/classes/class.Subnets.php | 12 +-- functions/classes/class.SubnetsTable.php | 2 +- functions/classes/class.Tools.php | 18 ++-- functions/classes/class.User.php | 8 +- functions/functions.php | 2 +- functions/global_functions.php | 6 +- functions/php-excel-reader/excel_reader2.php | 90 +++++++++---------- functions/scripts/discoveryCheck.php | 6 +- functions/scripts/find_untranslated_files.php | 10 +-- functions/scripts/merge_databases.php | 4 +- functions/scripts/pingCheck.php | 8 +- .../scripts/remove_offline_addresses.php | 2 +- functions/scripts/reset-admin-password.php | 4 +- 278 files changed, 900 insertions(+), 899 deletions(-) diff --git a/.gitmodules b/.gitmodules index d456f432b..f0bb4a36e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,3 +36,4 @@ [submodule "functions/LdapRecord"] path = functions/LdapRecord url = https://github.com/DirectoryTree/LdapRecord.git + ignore = all diff --git a/api/controllers/Addresses.php b/api/controllers/Addresses.php index e109a9a55..2e3a04dd5 100644 --- a/api/controllers/Addresses.php +++ b/api/controllers/Addresses.php @@ -386,7 +386,7 @@ public function PATCH () { # append old address details and fill details if not provided - validate_update_parameters fetches $this->old_address foreach ($this->old_address as $ok=>$oa) { - if (!array_key_exists($ok, $values)) { + if (!array_key_exists((string) $ok, $values)) { if(!is_null($oa)) { $values[$ok] = $oa; } @@ -639,7 +639,7 @@ private function address_changelog () { if (sizeof($clogs)>0) { foreach ($clogs as $l) { // diff to array - $l->cdiff = explode("\r\n", str_replace(["[","]"], "", trim($l->cdiff))); + $l->cdiff = explode("\r\n", str_replace(["[","]"], "", trim((string) $l->cdiff))); // save $clogs_formatted[] = [ "user" => $l->real_name, diff --git a/api/controllers/Common.php b/api/controllers/Common.php index 54237fe48..fedaebafc 100644 --- a/api/controllers/Common.php +++ b/api/controllers/Common.php @@ -16,7 +16,7 @@ class API_params extends Params { #[\Override] public function read($args, $strip_tags = false, $html_escape = false) { if (is_array($args) && isset($args['controller'])) { - $args['controller'] = strtolower($args['controller']); + $args['controller'] = strtolower((string) $args['controller']); } parent::read($args, $strip_tags, $html_escape); @@ -346,11 +346,11 @@ protected function filter_result ($result = array ()) { if ($this->_params->filter_match == 'partial') { // match partial string - if (strpos($r->{$this->_params->filter_by}, $this->_params->filter_value) === false) + if (strpos((string) $r->{$this->_params->filter_by}, (string) $this->_params->filter_value) === false) continue; } elseif ($this->_params->filter_match == 'regex') { // match regular expression - if (preg_match($this->_params->filter_value, $r->{$this->_params->filter_by}) !== 1) + if (preg_match($this->_params->filter_value, (string) $r->{$this->_params->filter_by}) !== 1) continue; } else { // match full string @@ -416,7 +416,7 @@ protected function validate_filter_by ($result) { */ protected function add_links ($result, $controller=null) { // lower controller - $controller = strtolower($controller); + $controller = strtolower((string) $controller); // multiple options if(is_array($result)) { @@ -877,7 +877,7 @@ private function remap_result_keys ($result) { // search and replace if(is_array($result) || is_object($result)) { foreach($result as $k=>$v) { - if(array_key_exists($k, $this->keys)) { + if(array_key_exists((string) $k, $this->keys)) { // replace $key = $this->keys[$k]; $result_remapped->{$key} = $v; @@ -900,7 +900,7 @@ private function remap_result_keys ($result) { // search and replace foreach($r as $k=>$v) { - if(array_key_exists($k, $this->keys)) { + if(array_key_exists((string) $k, $this->keys)) { // replace $key_val = $this->keys[$k]; $result_remapped[$m]->{$key_val} = $v; diff --git a/api/controllers/Prefix.php b/api/controllers/Prefix.php index 4d4e9bbfd..3ac456c9c 100644 --- a/api/controllers/Prefix.php +++ b/api/controllers/Prefix.php @@ -632,9 +632,9 @@ private function validate_request_parameters_custom_field () { */ private function set_address_type () { // ipv4 - if ( strpos($this->_params->id2, "6")!==false ) { $this->address_type = "IPv6"; } + if ( strpos((string) $this->_params->id2, "6")!==false ) { $this->address_type = "IPv6"; } // ipv6 - elseif ( strpos($this->_params->id2, "4")!==false ) { $this->address_type = "IPv4"; } + elseif ( strpos((string) $this->_params->id2, "4")!==false ) { $this->address_type = "IPv4"; } // both else { $this->Response->throw_exception(400, "Invalid address type"); } } diff --git a/api/controllers/Responses.php b/api/controllers/Responses.php index dcf9639b6..09b8bfa77 100644 --- a/api/controllers/Responses.php +++ b/api/controllers/Responses.php @@ -84,7 +84,7 @@ public function validate_content_type () { if(isset($_SERVER['CONTENT_TYPE'])) $_SERVER['CONTENT_TYPE'] = array_shift(pf_explode(";", $_SERVER['CONTENT_TYPE'])); // not set, presume json - if( !isset($_SERVER['CONTENT_TYPE']) || strlen(@$_SERVER['CONTENT_TYPE'])==0 ) {} + if( !isset($_SERVER['CONTENT_TYPE']) || strlen((string) @$_SERVER['CONTENT_TYPE'])==0 ) {} // post elseif($_SERVER['CONTENT_TYPE']=="application/x-www-form-urlencoded") {} // set, verify @@ -264,7 +264,7 @@ private function array_to_xml(SimpleXMLElement $object, array $data) { // loop through values foreach ($data as $key => $value) { // if spaces exist in key replace them with underscores - if(strpos($key, " ")>0) { $key = str_replace(" ", "_", $key); } + if(strpos((string) $key, " ")>0) { $key = str_replace(" ", "_", $key); } // if key is numeric append item if(is_numeric($key)) $key = "item".$key; diff --git a/api/controllers/Search.php b/api/controllers/Search.php index 6090f02d7..670f83e02 100755 --- a/api/controllers/Search.php +++ b/api/controllers/Search.php @@ -46,7 +46,7 @@ public function __construct($Database, $Tools, $params, $Response) { */ private function define_search_items () { foreach ($this->_params as $item => $value) { - if (array_key_exists($item, $this->search_items)) { + if (array_key_exists((string) $item, $this->search_items)) { if($value==0 || $value==1) { $this->search_items[$item] = $value; } diff --git a/api/controllers/Sections.php b/api/controllers/Sections.php index dc65e6b84..362ea24d3 100755 --- a/api/controllers/Sections.php +++ b/api/controllers/Sections.php @@ -176,7 +176,7 @@ public function POST () { unset($values['editDate']); # validate mandatory parameters - if(strlen($this->_params->name)<3) { $this->Response->throw_exception(400, 'Name is mandatory or too short (mininum 3 characters)'); } + if(strlen((string) $this->_params->name)<3) { $this->Response->throw_exception(400, 'Name is mandatory or too short (mininum 3 characters)'); } # verify masterSection if(isset($this->_params->masterSection)) { @@ -291,7 +291,7 @@ private function section_changelog () { if (sizeof($clogs)>0) { foreach ($clogs as $l) { // diff to array - $l->cdiff = explode("\r\n", str_replace(["[","]"], "", trim($l->cdiff))); + $l->cdiff = explode("\r\n", str_replace(["[","]"], "", trim((string) $l->cdiff))); // save $clogs_formatted[] = [ "user" => $l->real_name, diff --git a/api/controllers/Subnets.php b/api/controllers/Subnets.php index 33e89fb36..f49f3a24a 100644 --- a/api/controllers/Subnets.php +++ b/api/controllers/Subnets.php @@ -525,7 +525,7 @@ private function validate_create_permissions () { } } else { - if(!array_key_exists($perm, $valid_permissions_array)) { + if(!array_key_exists((string) $perm, $valid_permissions_array)) { $this->Response->throw_exception(500, "Invalid permissions ".$perm); } else { @@ -657,7 +657,7 @@ private function subnet_changelog () { if (sizeof($clogs)>0) { foreach ($clogs as $l) { // diff to array - $l->cdiff = explode("\r\n", str_replace(["[","]"], "", trim($l->cdiff))); + $l->cdiff = explode("\r\n", str_replace(["[","]"], "", trim((string) $l->cdiff))); // save $clogs_formatted[] = [ "user" => $l->real_name, diff --git a/api/controllers/User.php b/api/controllers/User.php index e933f80e5..38b9f861c 100644 --- a/api/controllers/User.php +++ b/api/controllers/User.php @@ -551,7 +551,7 @@ private function validate_requested_token_code ($app_id) { * @return void */ private function validate_token_expiration () { - return strtotime($this->token_expires) < time() ? true : false; + return strtotime((string) $this->token_expires) < time() ? true : false; } /** @@ -565,7 +565,7 @@ private function refresh_token_expiration () { $this->token = $this->User->user->token; // convert existing expiry date string to a timestamp - $expire_time = strtotime($this->token_expires); + $expire_time = strtotime((string) $this->token_expires); // Write Throttling from token updates // In order to keep the DB writes from token updates to a minimum, only update the expire time diff --git a/api/index.php b/api/index.php index 8f2db25e5..6cbdfcd3c 100755 --- a/api/index.php +++ b/api/index.php @@ -85,7 +85,7 @@ $encryption_method = Config::ValueOf('api_crypt_encryption_library', 'openssl-128-cbc'); // decrypt request - form_encoded - if(strpos($content_type, "application/x-www-form-urlencoded")!==false) { + if(strpos((string) $content_type, "application/x-www-form-urlencoded")!==false) { $decoded = $User->Crypto->decrypt($_GET['enc_request'], $app->app_code, $encryption_method); if ($decoded === false) $Response->throw_exception(503, 'Invalid enc_request'); $decoded = $decoded[0]=="?" ? substr($decoded, 1) : $decoded; @@ -133,7 +133,7 @@ // Append Global API parameters / POST parameters if POST,PATCH or DELETE if($_SERVER['REQUEST_METHOD']=="GET" || $_SERVER['REQUEST_METHOD']=="POST" || $_SERVER['REQUEST_METHOD']=="PATCH" || $_SERVER['REQUEST_METHOD']=="DELETE") { // if application tupe is JSON (application/json) - if(strpos($content_type, "application/json")!==false){ + if(strpos((string) $content_type, "application/json")!==false){ $rawPostData = file_get_contents('php://input'); if (is_string($rawPostData) && !is_blank($rawPostData)) { $json = db_json_decode($rawPostData, true); @@ -145,7 +145,7 @@ } } // if application tupe is XML (application/json) - elseif(strpos($content_type, "application/xml")!==false){ + elseif(strpos((string) $content_type, "application/xml")!==false){ $rawPostData = file_get_contents('php://input'); if (is_string($rawPostData) && !is_blank($rawPostData)) { $xml = $Response->xml_to_array($rawPostData); @@ -228,8 +228,8 @@ /* Initialize controller ---------- */ // get the controller and format it correctly - $controller_name = ucfirst($Params->controller)."_controller"; - $controller_file = ucfirst($Params->controller); + $controller_name = ucfirst((string) $Params->controller)."_controller"; + $controller_file = ucfirst((string) $Params->controller); // check if the controller exists. if not, throw an exception if( file_exists( dirname(__FILE__) . "/controllers/$controller_file.php") ) { @@ -254,17 +254,17 @@ // POST and PATCH. This only works for controllers that support custom // fields and if the app has nested custom fields enabled, otherwise // this is skipped. - if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST' || strtoupper($_SERVER['REQUEST_METHOD']) == 'PATCH') { + if (strtoupper((string) $_SERVER['REQUEST_METHOD']) == 'POST' || strtoupper((string) $_SERVER['REQUEST_METHOD']) == 'PATCH') { $controller->unmarshal_nested_custom_fields(); } // check if the action exists in the controller. if not, throw an exception. - if( method_exists($controller, strtolower($_SERVER['REQUEST_METHOD'])) === false ) { + if( method_exists($controller, strtolower((string) $_SERVER['REQUEST_METHOD'])) === false ) { $Response->throw_exception(501, $Response->errors[501]); } // Transaction locking is only enabled for POST, PUT, PATCH and DELETE requests. - if (in_array(strtoupper($_SERVER['REQUEST_METHOD']), ["POST", "PUT", "PATCH", "DELETE"])) { + if (in_array(strtoupper((string) $_SERVER['REQUEST_METHOD']), ["POST", "PUT", "PATCH", "DELETE"])) { $lock_type = $app->app_lock_type; if ($lock_type == "Auto") { diff --git a/app/admin/2fa/save.php b/app/admin/2fa/save.php index 5ca672cdd..e59758476 100644 --- a/app/admin/2fa/save.php +++ b/app/admin/2fa/save.php @@ -29,7 +29,7 @@ if(!in_array($POST->{'2fa_provider'}, $providers)) { $Result->show("danger", _("Invalid provider"), true); } // verify name -if(strlen($POST->{'2fa_name'})>32 || is_blank($POST->{'2fa_name'})) { $Result->show("danger", _("Invalid application name"), true); } +if(strlen((string) $POST->{'2fa_name'})>32 || is_blank($POST->{'2fa_name'})) { $Result->show("danger", _("Invalid application name"), true); } // verify length if(!is_numeric($POST->{'2fa_length'})) { $Result->show("danger", _("Invalid value for length"), true); } diff --git a/app/admin/api/edit-result.php b/app/admin/api/edit-result.php index fff8e40e8..1c945cb8f 100755 --- a/app/admin/api/edit-result.php +++ b/app/admin/api/edit-result.php @@ -32,10 +32,10 @@ if($POST->action!="delete") { # code must be exactly 32 chars long and alphanumeric if app_security = crypt if($POST->app_security=="crypt") { - if(strlen($POST->app_code)!=32 || !preg_match("#^[a-zA-Z0-9-_=]+$#", $POST->app_code)) { $error[] = "Invalid application code"; } + if(strlen((string) $POST->app_code)!=32 || !preg_match("#^[a-zA-Z0-9-_=]+$#", (string) $POST->app_code)) { $error[] = "Invalid application code"; } } # name must be more than 2 and alphanumeric - if(strlen($POST->app_id)<3 || strlen($POST->app_id)>12 || !preg_match("#^[a-zA-Z0-9-_=]+$#",$POST->app_id)) { $error[] = "Invalid application id"; } + if(strlen((string) $POST->app_id)<3 || strlen((string) $POST->app_id)>12 || !preg_match("#^[a-zA-Z0-9-_=]+$#",(string) $POST->app_id)) { $error[] = "Invalid application id"; } # permissions must be 0,1,2 if($POST->app_security!="user") { if(!($POST->app_permissions==0 || $POST->app_permissions==1 || $POST->app_permissions ==2 || $POST->app_permissions ==3 )) { $error[] = "Invalid permissions"; } diff --git a/app/admin/api/index.php b/app/admin/api/index.php index 093ca2136..7e63706b0 100755 --- a/app/admin/api/index.php +++ b/app/admin/api/index.php @@ -81,7 +81,7 @@ $a['app_security'] = array_search($a['app_security'], $app_perms_text); - $a['app_last_access'] = strlen($a['app_last_access'])==0 ? "Never" : $a['app_last_access']; + $a['app_last_access'] = strlen((string) $a['app_last_access'])==0 ? "Never" : $a['app_last_access']; print ' ' . $a['app_permissions'] . ''. "\n"; print ' ' . $a['app_security'] . ''. "\n"; diff --git a/app/admin/circuits/edit-circuit-submit.php b/app/admin/circuits/edit-circuit-submit.php index 288821ade..5e1eb93c8 100644 --- a/app/admin/circuits/edit-circuit-submit.php +++ b/app/admin/circuits/edit-circuit-submit.php @@ -67,7 +67,7 @@ $POST->device1 = 0; $POST->location1 = 0; } -elseif(strpos($POST->device1,"device_")!==false) { +elseif(strpos((string) $POST->device1,"device_")!==false) { $deviceId = str_replace("device_", "", $POST->device1); if($Tools->fetch_object("devices","id",$deviceId)===false) { $Result->show("danger", _('Invalid device A').'!', true); } // save @@ -86,7 +86,7 @@ $POST->device2 = 0; $POST->location2 = 0; } -elseif(strpos($POST->device2,"device_")!==false) { +elseif(strpos((string) $POST->device2,"device_")!==false) { $deviceId = str_replace("device_", "", $POST->device2); if($Tools->fetch_object("devices","id",$deviceId)===false) { $Result->show("danger", _('Invalid device B').'!', true); } // save diff --git a/app/admin/custom-fields/edit-result.php b/app/admin/custom-fields/edit-result.php index 5719f3943..f5d69e6ff 100755 --- a/app/admin/custom-fields/edit-result.php +++ b/app/admin/custom-fields/edit-result.php @@ -32,7 +32,7 @@ } else { # remove spaces - $POST->name = trim($POST->name); + $POST->name = trim((string) $POST->name); if($POST->action == "add") { # check if name is taken @@ -53,7 +53,7 @@ if(!preg_match('/^(\p{L}|\p{N})[(\p{L}|\p{N}) _.-]+$/u', $POST->name)) { $errors[] = _('Only alphanumeric, spaces and underscore characters are allowed'); } # required must have default value - if($POST->NULL=="NO" && mb_strlen($POST->fieldDefault)==0) { $errors[] = _('Required fields must have default values'); } + if($POST->NULL=="NO" && mb_strlen((string) $POST->fieldDefault)==0) { $errors[] = _('Required fields must have default values'); } # db type validations diff --git a/app/admin/custom-fields/index.php b/app/admin/custom-fields/index.php index 4c3762a90..4dea1ae0f 100755 --- a/app/admin/custom-fields/index.php +++ b/app/admin/custom-fields/index.php @@ -106,7 +106,7 @@ foreach($cf as $f) { # space? - $class = strpos($f['name'], " ")===false ? "" : "danger"; + $class = strpos((string) $f['name'], " ")===false ? "" : "danger"; print ""; @@ -142,7 +142,7 @@ print " "; # warning for older versions - if((is_numeric(substr($f['name'], 0, 1))) || (!preg_match('/^(\p{L}|\p{N})[(\p{L}|\p{N}) _.-]+$/u', $f['name'])) ) { print 'Warning: '._('Invalid field name').'!'; } + if((is_numeric(substr((string) $f['name'], 0, 1))) || (!preg_match('/^(\p{L}|\p{N})[(\p{L}|\p{N}) _.-]+$/u', (string) $f['name'])) ) { print 'Warning: '._('Invalid field name').'!'; } print ""; print ""; diff --git a/app/admin/customers/edit-submit.php b/app/admin/customers/edit-submit.php index d43d81f4e..710b0b7ef 100644 --- a/app/admin/customers/edit-submit.php +++ b/app/admin/customers/edit-submit.php @@ -43,10 +43,10 @@ // add / edit validations if ($POST->action!="delete") { // check strings - if(strlen($POST->title)<3) { $Result->show("danger", _("Invalid Title"), true); } - if(strlen($POST->address)<3) { $Result->show("danger", _("Invalid Address"), true); } - if(strlen($POST->city)<3) { $Result->show("danger", _("Invalid City"), true); } - if(strlen($POST->state)<3) { $Result->show("danger", _("Invalid State"), true); } + if(strlen((string) $POST->title)<3) { $Result->show("danger", _("Invalid Title"), true); } + if(strlen((string) $POST->address)<3) { $Result->show("danger", _("Invalid Address"), true); } + if(strlen((string) $POST->city)<3) { $Result->show("danger", _("Invalid City"), true); } + if(strlen((string) $POST->state)<3) { $Result->show("danger", _("Invalid State"), true); } // validate postcode if(!$Tools->validate_postcode ($POST->postcode, $POST->state)) { $Result->show("danger", _("Invalid Postcode"), true); } } diff --git a/app/admin/customers/edit.php b/app/admin/customers/edit.php index a8dbd2c2c..78809cd1f 100644 --- a/app/admin/customers/edit.php +++ b/app/admin/customers/edit.php @@ -41,7 +41,7 @@ # null ? $customer===false ? $Result->show("danger", _("Invalid ID"), true) : null; # title - $title = ucwords($POST->action) .' '._('customer').' '.$customer->title; + $title = ucwords((string) $POST->action) .' '._('customer').' '.$customer->title; } else { # generate new code $customer = new Params (); diff --git a/app/admin/customers/unlink.php b/app/admin/customers/unlink.php index a63c0a78e..ff05526a9 100644 --- a/app/admin/customers/unlink.php +++ b/app/admin/customers/unlink.php @@ -22,7 +22,7 @@ $User->check_maintaneance_mode (); // make sure correct object is applied -if(!array_key_exists($POST->object, $Tools->get_customer_object_types())) { +if(!array_key_exists((string) $POST->object, $Tools->get_customer_object_types())) { $Result->show ("danger", _("Invalid object"), true, true); } // ID must be numeric diff --git a/app/admin/device-types/edit-result.php b/app/admin/device-types/edit-result.php index 3a6e0d188..be9d66c30 100755 --- a/app/admin/device-types/edit-result.php +++ b/app/admin/device-types/edit-result.php @@ -35,8 +35,8 @@ # checks if($POST->action!="delete") { - if(strlen($POST->bgcolor)<4) { $Result->show("danger", _("Invalid bg color"), true); } - if(strlen($POST->fgcolor)<4) { $Result->show("danger", _("Invalid fg color"), true); } + if(strlen((string) $POST->bgcolor)<4) { $Result->show("danger", _("Invalid bg color"), true); } + if(strlen((string) $POST->fgcolor)<4) { $Result->show("danger", _("Invalid fg color"), true); } } # create array of values for modification diff --git a/app/admin/devices/edit-result.php b/app/admin/devices/edit-result.php index 8e3ecd2f4..3824f9acc 100755 --- a/app/admin/devices/edit-result.php +++ b/app/admin/devices/edit-result.php @@ -35,7 +35,7 @@ # available devices set foreach($POST as $key=>$line) { - if (!is_blank(strstr($key,"section-"))) { + if (!is_blank(strstr((string) $key,"section-"))) { $key2 = str_replace("section-", "", $key); $temp[] = $key2; diff --git a/app/admin/devices/edit-snmp-result.php b/app/admin/devices/edit-snmp-result.php index c6e9f9dd6..620254efe 100644 --- a/app/admin/devices/edit-snmp-result.php +++ b/app/admin/devices/edit-snmp-result.php @@ -45,7 +45,7 @@ # set snmp queries foreach($POST as $key=>$line) { - if (!is_blank(strstr($key,"query-"))) { + if (!is_blank(strstr((string) $key,"query-"))) { $key2 = str_replace("query-", "", $key); $temp[] = $key2; unset($POST->$key); diff --git a/app/admin/devices/edit-snmp-test.php b/app/admin/devices/edit-snmp-test.php index bed4ad057..f56dfc5af 100644 --- a/app/admin/devices/edit-snmp-test.php +++ b/app/admin/devices/edit-snmp-test.php @@ -63,9 +63,9 @@ # set queries foreach($POST as $k=>$p) { - if(strpos($k, "query-")!==false) { + if(strpos((string) $k, "query-")!==false) { if($p=="on") { - $queries[] = substr($k, 6); + $queries[] = substr((string) $k, 6); } } } diff --git a/app/admin/filter-fields/index.php b/app/admin/filter-fields/index.php index e4bbefd9f..2c213f957 100755 --- a/app/admin/filter-fields/index.php +++ b/app/admin/filter-fields/index.php @@ -58,7 +58,7 @@ print ''. "\n"; print ' '; - print ' '. ucfirst($field_print) .''; + print ' '. ucfirst((string) $field_print) .''; print ''; } ?> diff --git a/app/admin/firewall-zones/ajax.php b/app/admin/firewall-zones/ajax.php index d9de6e511..9943295de 100644 --- a/app/admin/firewall-zones/ajax.php +++ b/app/admin/firewall-zones/ajax.php @@ -26,7 +26,7 @@ # generate a dropdown list for all subnets within a section if ($POST->operation == 'fetchSectionSubnets') { if($POST->sectionId) { - if(preg_match('/^[0-9]+$/i',$POST->sectionId)) { + if(preg_match('/^[0-9]+$/i',(string) $POST->sectionId)) { $sectionId = $POST->sectionId; print $Subnets->print_mastersubnet_dropdown_menu($sectionId); } else { @@ -38,7 +38,7 @@ # deliver zone details if ($POST->operation == 'deliverZoneDetail') { if ($POST->zoneId) { - if(preg_match('/^[0-9]+$/i',$POST->zoneId)) { + if(preg_match('/^[0-9]+$/i',(string) $POST->zoneId)) { # return the zone details $Zones->get_zone_detail($POST->zoneId); @@ -50,7 +50,7 @@ # deliver networkinformations about a specific zone if ($POST->netZoneId) { - if(preg_match('/^[0-9]+$/i',$POST->netZoneId)) { + if(preg_match('/^[0-9]+$/i',(string) $POST->netZoneId)) { # return the zone details $Zones->get_zone_network($POST->netZoneId); } else { @@ -94,15 +94,15 @@ # generate a new firewall address object on request if ($POST->operation == 'autogen') { if ($POST->action == 'net') { - if (preg_match('/^[0-9]+$/i',$POST->subnetId)){ + if (preg_match('/^[0-9]+$/i',(string) $POST->subnetId)){ $Zones->update_address_objects($POST->subnetId); } } elseif ($POST->action == 'adr') { - if (preg_match('/^[0-9]+$/i',$POST->subnetId) && preg_match('/^[0-9a-z-.]+$/i',$POST->dnsName) && preg_match('/^[0-9]+$/i',$POST->IPId)) { + if (preg_match('/^[0-9]+$/i',(string) $POST->subnetId) && preg_match('/^[0-9a-z-.]+$/i',(string) $POST->dnsName) && preg_match('/^[0-9]+$/i',(string) $POST->IPId)) { $Zones->update_address_object($POST->subnetId,$POST->IPId,$POST->dnsName); } } elseif ($POST->action == 'subnet') { - if (preg_match('/^[0-9]+$/i',$POST->subnetId)) { + if (preg_match('/^[0-9]+$/i',(string) $POST->subnetId)) { $Zones->generate_subnet_object ($POST->subnetId); } } diff --git a/app/admin/firewall-zones/mapping-edit-result.php b/app/admin/firewall-zones/mapping-edit-result.php index c0a01fbec..166f66f97 100644 --- a/app/admin/firewall-zones/mapping-edit-result.php +++ b/app/admin/firewall-zones/mapping-edit-result.php @@ -28,28 +28,28 @@ $Result->show("danger", _("Invalid action."), true); } # check the zone alias. valid values are alphanumeric characters and special characters like ".-_: " -if($POST->alias && !preg_match('/^[0-9a-z.\/\-_ :]+$/i',$POST->alias)) { +if($POST->alias && !preg_match('/^[0-9a-z.\/\-_ :]+$/i',(string) $POST->alias)) { $Result->show("danger", _("Invalid zone alias value."), true); } # check the interface name. valid values are alphanumeric characters and special characters like ".-_/: " -if($POST->interface && !preg_match('/^[0-9a-z.\/\-_ :]+$/i',$POST->interface)) { +if($POST->interface && !preg_match('/^[0-9a-z.\/\-_ :]+$/i',(string) $POST->interface)) { $Result->show("danger", _("Invalid interface."), true); } if ($POST->action != 'delete') { # check the zone ID. valid value: integer - if(!preg_match('/^[0-9]+$/i',$POST->zoneId)) { + if(!preg_match('/^[0-9]+$/i',(string) $POST->zoneId)) { $Result->show("danger", _("Invalid zone ID."), true); - } elseif (preg_match('/^0$/i',$POST->zoneId)) { + } elseif (preg_match('/^0$/i',(string) $POST->zoneId)) { $Result->show("danger", _("Invalid zone ID."), true); } # check the device ID. valid value: integer - if(!preg_match('/^[0-9]+$/i',$POST->deviceId)) { + if(!preg_match('/^[0-9]+$/i',(string) $POST->deviceId)) { $Result->show("danger", _("Invalid device ID."), true); - } elseif (preg_match('/^0$/i',$POST->deviceId)) { + } elseif (preg_match('/^0$/i',(string) $POST->deviceId)) { $Result->show("danger", _("Please select a device."), true); } # check the mapping ID. valid value: integer - if($POST->id && !preg_match('/^[0-9]+$/i',$POST->id)) { + if($POST->id && !preg_match('/^[0-9]+$/i',(string) $POST->id)) { $Result->show("danger", _("Invalid mapping ID."), true); } } diff --git a/app/admin/firewall-zones/mapping-edit.php b/app/admin/firewall-zones/mapping-edit.php index b876a7d5e..56d33088b 100644 --- a/app/admin/firewall-zones/mapping-edit.php +++ b/app/admin/firewall-zones/mapping-edit.php @@ -25,7 +25,7 @@ } # validate $POST->id values -if (!preg_match('/^[0-9]+$/i', $POST->id)) { +if (!preg_match('/^[0-9]+$/i', (string) $POST->id)) { $Result->show("danger", _("Invalid ID. Do not manipulate the POST values!"), true); } diff --git a/app/admin/firewall-zones/settings-save.php b/app/admin/firewall-zones/settings-save.php index 2b570f085..da92754b2 100644 --- a/app/admin/firewall-zones/settings-save.php +++ b/app/admin/firewall-zones/settings-save.php @@ -33,33 +33,33 @@ $ipType = $POST->ipType; # validate the IPv4 type alias. -if (!is_array($ipType) || sizeof($ipType) < 2 || !preg_match('/^[a-z0-9\-\_.]+$/i', $ipType[0])) { +if (!is_array($ipType) || sizeof($ipType) < 2 || !preg_match('/^[a-z0-9\-\_.]+$/i', (string) $ipType[0])) { $Result->show("danger", _("Invalid IPv4 address type alias. Only alphanumeric characters, "-", "_" and "." are allowed."), true); } # validate the IPv6 type alias. -if (!is_array($ipType) || sizeof($ipType) < 2 || !preg_match('/^[a-z0-9\-\_.]+$/i', $ipType[1])) { +if (!is_array($ipType) || sizeof($ipType) < 2 || !preg_match('/^[a-z0-9\-\_.]+$/i', (string) $ipType[1])) { $Result->show("danger", _("Invalid IPv4 address type alias. Only alphanumeric characters, "-", "_" and "." are allowed."), true); } # validate the separator character. -if (!preg_match('/^[\-\_.]+$/i', $POST->separator)) { +if (!preg_match('/^[\-\_.]+$/i', (string) $POST->separator)) { $Result->show("danger", _("Invalid separator. Only "-", "_" and "." are allowed."), true); } $indicator = $POST->indicator; # validate the indicator for own firewall zones. -if (!is_array($indicator) || sizeof($indicator)<2 || !preg_match('/^[a-z0-9\-\_.]+$/i', $indicator[0])) { +if (!is_array($indicator) || sizeof($indicator)<2 || !preg_match('/^[a-z0-9\-\_.]+$/i', (string) $indicator[0])) { $Result->show("danger", _("Invalid zone indicator. Only alphanumeric characters, "-", "_" and "." are allowed."), true); } # validate the IPv6 type alias. -if (!is_array($indicator) || sizeof($indicator)<2 || !preg_match('/^[a-z0-9\-\_.]+$/i', $indicator[1])) { +if (!is_array($indicator) || sizeof($indicator)<2 || !preg_match('/^[a-z0-9\-\_.]+$/i', (string) $indicator[1])) { $Result->show("danger", _("Invalid zone indicator. Only alphanumeric characters, "-", "_" and "." are allowed."), true); } # validate the zoneGenerator value. -if (!preg_match('/^[0-3]$/i', $POST->zoneGenerator)) { +if (!preg_match('/^[0-3]$/i', (string) $POST->zoneGenerator)) { $Result->show("danger", _("Invalid zone generator method. Do not manipulate the POST values!"), true); } @@ -107,7 +107,7 @@ } # validate device type ID. -if (!preg_match('/^[0-9]+$/i', $POST->deviceType)) { +if (!preg_match('/^[0-9]+$/i', (string) $POST->deviceType)) { $Result->show("danger", _("Invalid device type."), true); } @@ -117,7 +117,7 @@ } # validate the subnetPattern value. -if (!preg_match('/^[0-1]$/i', $POST->subnetPattern)) { +if (!preg_match('/^[0-1]$/i', (string) $POST->subnetPattern)) { $Result->show("danger", _("Invalid subnet name. Do not manipulate the POST values!"), true); } diff --git a/app/admin/firewall-zones/subnet-to-zone-save.php b/app/admin/firewall-zones/subnet-to-zone-save.php index b50af8342..afb85a3f4 100644 --- a/app/admin/firewall-zones/subnet-to-zone-save.php +++ b/app/admin/firewall-zones/subnet-to-zone-save.php @@ -24,19 +24,19 @@ } # validate $POST->subnetId values -if (!preg_match('/^[0-9]+$/i', $POST->subnetId)) { $Result->show("danger", _("Invalid subnet ID. Do not manipulate the POST values!"), true); } +if (!preg_match('/^[0-9]+$/i', (string) $POST->subnetId)) { $Result->show("danger", _("Invalid subnet ID. Do not manipulate the POST values!"), true); } # validate $POST->zoneId values -if (!preg_match('/^[0-9]+$/i', $POST->zoneId) || $POST->zoneId == 0) { $Result->show("danger", _("Invalid or no zone ID. "), true); } +if (!preg_match('/^[0-9]+$/i', (string) $POST->zoneId) || $POST->zoneId == 0) { $Result->show("danger", _("Invalid or no zone ID. "), true); } # validate $POST->deviceId values -if ($POST->deviceId && !preg_match('/^[0-9]+$/i', $POST->deviceId)) { $Result->show("danger", _("Invalid device ID. Do not manipulate the POST values!"), true); } +if ($POST->deviceId && !preg_match('/^[0-9]+$/i', (string) $POST->deviceId)) { $Result->show("danger", _("Invalid device ID. Do not manipulate the POST values!"), true); } # check the zone alias. valid values are alphanumeric characters and special characters like ".-_: " -if($POST->alias && !preg_match('/^[0-9a-z.\/\-_ :]+$/i',$POST->alias)) { +if($POST->alias && !preg_match('/^[0-9a-z.\/\-_ :]+$/i',(string) $POST->alias)) { $Result->show("danger", _("Invalid zone alias value."), true); } # check the interface name. valid values are alphanumeric characters and special characters like ".-_/: " -if($POST->interface && !preg_match('/^[0-9a-z.\/\-_ :]+$/i',$POST->interface)) { +if($POST->interface && !preg_match('/^[0-9a-z.\/\-_ :]+$/i',(string) $POST->interface)) { $Result->show("danger", _("Invalid interface."), true); } diff --git a/app/admin/firewall-zones/subnet-to-zone.php b/app/admin/firewall-zones/subnet-to-zone.php index 8c43d6369..b2e09594e 100644 --- a/app/admin/firewall-zones/subnet-to-zone.php +++ b/app/admin/firewall-zones/subnet-to-zone.php @@ -24,7 +24,7 @@ if ($POST->operation != 'subnet2zone') { $Result->show("danger", _("Invalid operation. Do not manipulate the POST values!"), true); } # validate $POST->subnetId values -if (!preg_match('/^[0-9]+$/i', $POST->subnetId)) { $Result->show("danger", _("Invalid subnet ID. Do not manipulate the POST values!"), true); } +if (!preg_match('/^[0-9]+$/i', (string) $POST->subnetId)) { $Result->show("danger", _("Invalid subnet ID. Do not manipulate the POST values!"), true); } $firewallZones = $Zones->get_zones(); diff --git a/app/admin/firewall-zones/zones-edit-network-result.php b/app/admin/firewall-zones/zones-edit-network-result.php index c49691d91..0d8e7bc4e 100644 --- a/app/admin/firewall-zones/zones-edit-network-result.php +++ b/app/admin/firewall-zones/zones-edit-network-result.php @@ -27,7 +27,7 @@ $Result->show("danger", _("Invalid action."), true); } # check the mastersubnet ID. valid value: integer -if($POST->masterSubnetId && !preg_match('/^[0-9]+$/i',$POST->masterSubnetId)) { +if($POST->masterSubnetId && !preg_match('/^[0-9]+$/i',(string) $POST->masterSubnetId)) { $Result->show("danger", _("Invalid subnet ID."), true); } elseif (!$POST->masterSubnetId) { $Result->show("danger", _("Please choose a appropriate network to bind to the firewall zone."), true); @@ -36,7 +36,7 @@ # validate network ID informations if($POST->network) { foreach ($POST->network as $network) { - if(!preg_match('/^[0-9]+$/i',$network)) { + if(!preg_match('/^[0-9]+$/i',(string) $network)) { $Result->show("danger", _("Invalid network ID."), true); } } @@ -50,7 +50,7 @@ } # check the zone ID. valid value: integer -if($POST->netZoneId && !preg_match('/^[0-9]+$/i',$POST->netZoneId)) { +if($POST->netZoneId && !preg_match('/^[0-9]+$/i',(string) $POST->netZoneId)) { $Result->show("danger", _("Invalid zone ID."), true); } else { # update diff --git a/app/admin/firewall-zones/zones-edit-network.php b/app/admin/firewall-zones/zones-edit-network.php index d6013562b..92a432409 100644 --- a/app/admin/firewall-zones/zones-edit-network.php +++ b/app/admin/firewall-zones/zones-edit-network.php @@ -29,10 +29,10 @@ # validate $POST->action values if ($POST->action != 'add' && $POST->action != 'delete') { $Result->show("danger", _("Invalid action. Do not manipulate the POST values!").'', true); } # validate $POST->id values -if ($POST->id && !preg_match('/^[0-9]+$/i', $POST->id)) { $Result->show("danger", _("Invalid ID. Do not manipulate the POST values!").'', true); } +if ($POST->id && !preg_match('/^[0-9]+$/i', (string) $POST->id)) { $Result->show("danger", _("Invalid ID. Do not manipulate the POST values!").'', true); } # validate $POST->sectionId values if ($POST->id && $POST->subnetId != '') { - if (!preg_match('/^[0-9]+$/i', $POST->subnetId)) { $Result->show("danger", _("Invalid subnet ID. Do not manipulate the POST values!").'', true); } + if (!preg_match('/^[0-9]+$/i', (string) $POST->subnetId)) { $Result->show("danger", _("Invalid subnet ID. Do not manipulate the POST values!").'', true); } } # fetch all sections diff --git a/app/admin/firewall-zones/zones-edit-result.php b/app/admin/firewall-zones/zones-edit-result.php index 76c6c824b..f427f8467 100644 --- a/app/admin/firewall-zones/zones-edit-result.php +++ b/app/admin/firewall-zones/zones-edit-result.php @@ -33,27 +33,27 @@ } # check the zone name. valid values are alphanumeric characters and special characters like ".-_ " -if($POST->zone && !preg_match('/^[0-9a-z.\-_ ]+$/i',$POST->zone)) { +if($POST->zone && !preg_match('/^[0-9a-z.\-_ ]+$/i',(string) $POST->zone)) { $Result->show("danger", _("Invalid zone name value."), true); } if($firewallZoneSettings['zoneGenerator']=="2") -if(is_blank($POST->zone) || strlen($POST->zone)>$firewallZoneSettings['zoneLength']) { +if(is_blank($POST->zone) || strlen((string) $POST->zone)>$firewallZoneSettings['zoneLength']) { $Result->show("danger", _("Invalid zone name length."), true); } # check the zone indicator ID. valid values are 0 or 1. -if($POST->indicator && !preg_match('/^[0-1]$/i',$POST->indicator)) { +if($POST->indicator && !preg_match('/^[0-1]$/i',(string) $POST->indicator)) { $Result->show("danger", _("Invalid indicator ID."), true); } # check the generator value. valid value: integer -if($POST->generator && !preg_match('/^[0-9]+$/i',$POST->generator)) { +if($POST->generator && !preg_match('/^[0-9]+$/i',(string) $POST->generator)) { $Result->show("danger", _("Invalid generator ID."), true); } # check the padding value. valid value: on or off -if($POST->padding && !preg_match('/^(on|off)$/i',$POST->padding)) { +if($POST->padding && !preg_match('/^(on|off)$/i',(string) $POST->padding)) { $Result->show("danger", _("Invalid padding setting."), true); } @@ -67,7 +67,7 @@ } # transform description to valid value -$description = trim(htmlspecialchars($POST->description)); +$description = trim(htmlspecialchars((string) $POST->description)); # generate a unique zone name if the generator is set to decimal or hex if (!$POST->zone && $POST->action == 'add') { diff --git a/app/admin/firewall-zones/zones-edit.php b/app/admin/firewall-zones/zones-edit.php index e648ed261..396f17483 100644 --- a/app/admin/firewall-zones/zones-edit.php +++ b/app/admin/firewall-zones/zones-edit.php @@ -29,7 +29,7 @@ $Admin->validate_action(false); # validate $POST->id values -if (!preg_match('/^[0-9]+$/i', $POST->id)) { $Result->show("danger", _("Invalid ID. Do not manipulate the POST values!"), true); } +if (!preg_match('/^[0-9]+$/i', (string) $POST->id)) { $Result->show("danger", _("Invalid ID. Do not manipulate the POST values!"), true); } # validate $POST->action values if ($POST->action != 'add' && $POST->action != 'edit' && $POST->action != 'delete') { $Result->show("danger", _("Invalid action. Do not manipulate the POST values!"), true); } diff --git a/app/admin/groups/ad-search-group-result.php b/app/admin/groups/ad-search-group-result.php index 3dee0eeb0..3ccb089ac 100644 --- a/app/admin/groups/ad-search-group-result.php +++ b/app/admin/groups/ad-search-group-result.php @@ -40,7 +40,7 @@ //no login parameters if(is_blank(@$params->adminUsername) || is_blank(@$params->adminPassword)) { $Result->show("danger", _("Missing credentials"), true); } //at least 2 chars -if(strlen($POST->dfilter)<2) { $Result->show("danger", _('Please enter at least 2 characters'), true); } +if(strlen((string) $POST->dfilter)<2) { $Result->show("danger", _('Please enter at least 2 characters'), true); } //open connection diff --git a/app/admin/groups/add-users-result.php b/app/admin/groups/add-users-result.php index f98678409..b35553d5c 100755 --- a/app/admin/groups/add-users-result.php +++ b/app/admin/groups/add-users-result.php @@ -28,8 +28,8 @@ # parse result foreach($POST as $k=>$p) { - if(substr($k, 0,4) == "user") { - $users[substr($k, 4)] = substr($k, 4); + if(substr((string) $k, 0,4) == "user") { + $users[substr((string) $k, 4)] = substr((string) $k, 4); } } diff --git a/app/admin/groups/edit-group-result.php b/app/admin/groups/edit-group-result.php index 0d44af9b4..432a11de2 100755 --- a/app/admin/groups/edit-group-result.php +++ b/app/admin/groups/edit-group-result.php @@ -35,7 +35,7 @@ $Admin->remove_group_from_sections($POST->g_id); } else { - if(strlen($POST->g_name) < 2) { $Result->show("danger", _('Name must be at least 2 characters long')."!", true); } + if(strlen((string) $POST->g_name) < 2) { $Result->show("danger", _('Name must be at least 2 characters long')."!", true); } } # unique name diff --git a/app/admin/groups/remove-users-result.php b/app/admin/groups/remove-users-result.php index 1222aa572..1f12e21dd 100755 --- a/app/admin/groups/remove-users-result.php +++ b/app/admin/groups/remove-users-result.php @@ -28,8 +28,8 @@ # parse result foreach($POST as $k=>$p) { - if(substr($k, 0,4) == "user") { - $users[substr($k, 4)] = substr($k, 4); + if(substr((string) $k, 0,4) == "user") { + $users[substr((string) $k, 4)] = substr((string) $k, 4); } } diff --git a/app/admin/import-export/export-ipaddr-field-select.php b/app/admin/import-export/export-ipaddr-field-select.php index 3b9601c84..7487345d0 100644 --- a/app/admin/import-export/export-ipaddr-field-select.php +++ b/app/admin/import-export/export-ipaddr-field-select.php @@ -131,11 +131,11 @@ foreach ($sections_sorted as $section) { //cast $section = (array) $section; - $section['url_name'] = urlencode($section['id']); + $section['url_name'] = urlencode((string) $section['id']); print ''; print '
    '; - print ' '. htmlentities($section['description']) .''. "\n"; + print ' '. htmlentities((string) $section['description']) .''. "\n"; //master Section if($section['masterSection']!=0) { # get section details diff --git a/app/admin/import-export/export-ipaddr.php b/app/admin/import-export/export-ipaddr.php index 15d656f1f..e85a25dbd 100644 --- a/app/admin/import-export/export-ipaddr.php +++ b/app/admin/import-export/export-ipaddr.php @@ -179,7 +179,7 @@ foreach ($all_sections as $section) { //cast $section = (array) $section; - $section['url_name'] = urlencode($section['id']); + $section['url_name'] = urlencode((string) $section['id']); if( $GET->{'exportSection__'.$section['url_name']} == "on" ) { // get all subnets in section @@ -325,7 +325,7 @@ foreach ($sections_sorted as $section) { //cast $section = (array) $section; - $section['url_name'] = urlencode($section['id']); + $section['url_name'] = urlencode((string) $section['id']); if( $GET->{'exportSection__'.$section['url_name']} == "on") { $worksheet_sections->write($curRow, $curColumn, $section['name'], $format_text); diff --git a/app/admin/import-export/export-subnets-field-select.php b/app/admin/import-export/export-subnets-field-select.php index 8cf893b10..c884996b1 100644 --- a/app/admin/import-export/export-subnets-field-select.php +++ b/app/admin/import-export/export-subnets-field-select.php @@ -125,7 +125,7 @@ foreach ($sections_sorted as $section) { //cast $section = (array) $section; - $section['url_name'] = urlencode($section['id']); + $section['url_name'] = urlencode((string) $section['id']); print ''; print '
    '; diff --git a/app/admin/import-export/export-subnets.php b/app/admin/import-export/export-subnets.php index f667dc3a9..e8f34c42a 100644 --- a/app/admin/import-export/export-subnets.php +++ b/app/admin/import-export/export-subnets.php @@ -152,7 +152,7 @@ foreach ($all_sections as $section) { //cast $section = (array) $section; - $section['url_name'] = urlencode($section['id']); + $section['url_name'] = urlencode((string) $section['id']); if( $GET->{'exportSection__'.$section['url_name']} == "on") { // get all subnets in section @@ -290,7 +290,7 @@ foreach ($sections_sorted as $section) { //cast $section = (array) $section; - $section['url_name'] = urlencode($section['id']); + $section['url_name'] = urlencode((string) $section['id']); if( $GET->{'exportSection__'.$section['url_name']} == "on") { $worksheet_sections->write($curRow, $curColumn, $section['name'], $format_text); diff --git a/app/admin/import-export/generate-hosts.php b/app/admin/import-export/generate-hosts.php index 5c6cf13c3..48ff970ab 100644 --- a/app/admin/import-export/generate-hosts.php +++ b/app/admin/import-export/generate-hosts.php @@ -54,7 +54,7 @@ } //than address details - $diff = 17 - strlen($Subnets->transform_to_dotted($host->ip_addr)); //for print offset + $diff = 17 - strlen((string) $Subnets->transform_to_dotted($host->ip_addr)); //for print offset $diff > 0 ?: $diff = 3; //IPv6 print offset $res[] = $Subnets->transform_to_dotted($host->ip_addr) . str_repeat(" ", $diff) . "$host->hostname"; diff --git a/app/admin/import-export/generate-mysql.php b/app/admin/import-export/generate-mysql.php index b9ee45c66..55dc64b12 100644 --- a/app/admin/import-export/generate-mysql.php +++ b/app/admin/import-export/generate-mysql.php @@ -44,7 +44,7 @@ $filename = "phpipam_MySQL_dump_" . date("Y-m-d") . ".sql"; - $command = sprintf("%s --defaults-extra-file=$cnf_file --opt %s", escapeshellcmd($mysqldump), escapeshellarg($db['name'])); + $command = sprintf("%s --defaults-extra-file=$cnf_file --opt %s", escapeshellcmd($mysqldump), escapeshellarg((string) $db['name'])); $content = "# phpipam Database dump \n"; $content .= "# command executed: $command \n"; diff --git a/app/admin/import-export/import-devices-check.php b/app/admin/import-export/import-devices-check.php index f1f3e6d95..1d2f8b1b7 100644 --- a/app/admin/import-export/import-devices-check.php +++ b/app/admin/import-export/import-devices-check.php @@ -28,7 +28,7 @@ # check which sections we need to care about $used_section = array(); -foreach ($data as &$cdata) { $used_section[strtolower($cdata['section'])]=$cdata['section']; } +foreach ($data as &$cdata) { $used_section[strtolower((string) $cdata['section'])]=$cdata['section']; } # fetch all sections and load all subnets $all_sections = $Sections->fetch_all_sections(); @@ -45,17 +45,17 @@ foreach ($all_sections as $section) { $section = (array) $section; - $section_names[strtolower($section['name'])] = $section; + $section_names[strtolower((string) $section['name'])] = $section; } foreach ($devices as $d) { $d = (array) $d; - $edata['devices'][strtolower($d['hostname'])] = $d; + $edata['devices'][strtolower((string) $d['hostname'])] = $d; } foreach ($deviceTypes as $d) { $d = (array) $d; - $edata['deviceTypes'][strtolower($d['tname'])] = $d; + $edata['deviceTypes'][strtolower((string) $d['tname'])] = $d; } #error_log ( "devicestypes : " . json_encode ($deviceTypes) ) ; @@ -75,18 +75,18 @@ } # Check if section is provided and valid and link it if it is - if (!isset($section_names[strtolower($cdata['section'])])) { + if (!isset($section_names[strtolower((string) $cdata['section'])])) { $msg.= "Invalid section."; $action = "error"; } else { - $cdata['sections'] = $section_names[strtolower($cdata['section'])]['id']; + $cdata['sections'] = $section_names[strtolower((string) $cdata['section'])]['id']; } # Check if deviceType is provided and valid and link it if it is - if (!isset($edata['deviceTypes'][strtolower($cdata['deviceType'])]) + if (!isset($edata['deviceTypes'][strtolower((string) $cdata['deviceType'])]) ) { $msg.= "Invalid deviceType."; $action = "error"; } else { - $cdata['type'] = $edata['deviceTypes'][strtolower($cdata['deviceType'])]['tid']; + $cdata['type'] = $edata['deviceTypes'][strtolower((string) $cdata['deviceType'])]['tid']; } if ($action != "error") { @@ -99,21 +99,21 @@ $msg.="Invalid IP address."; $action = "error"; } - if ((!empty($cdata['hostname'])) && (!preg_match("/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/", $cdata['hostname']))) { $msg.="Invalid DNS name."; $action = "error"; } + if ((!empty($cdata['hostname'])) && (!preg_match("/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/", (string) $cdata['hostname']))) { $msg.="Invalid DNS name."; $action = "error"; } # Allow all chars in description ... Why Limit it ? # if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } if ($cdata['mac']) { - if (!preg_match("/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/", $cdata['mac'])) { $msg.="Invalid MAC address."; $action = "error"; } + if (!preg_match("/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/", (string) $cdata['mac'])) { $msg.="Invalid MAC address."; $action = "error"; } } } # check if existing in database if ($action != "error") { - if (isset($edata['devices'][strtolower($cdata['hostname'])]) ) { - $cdata['id'] = $edata['devices'][strtolower($cdata['hostname'])]['id']; + if (isset($edata['devices'][strtolower((string) $cdata['hostname'])]) ) { + $cdata['id'] = $edata['devices'][strtolower((string) $cdata['hostname'])]['id']; # copy content to a variable for easier checks - $cedata = $edata[strtolower($cdata['hostname'])]; + $cedata = $edata[strtolower((string) $cdata['hostname'])]; # Check if we need to change any fields $action = "skip"; # skip duplicate fields if identical, update if different # Should we just let the database decided to update or not? Nice for UI, but alot of diff --git a/app/admin/import-export/import-devices-select.php b/app/admin/import-export/import-devices-select.php index 28d5fe464..68077f7e7 100644 --- a/app/admin/import-export/import-devices-select.php +++ b/app/admin/import-export/import-devices-select.php @@ -87,7 +87,7 @@ #prebuild template table rows to avoid useless foreach loops $tpl_field_names.= "".($pname ? $pname : $field['Field']).$msgr.""; - $tpl_field_types.= "". wordwrap($field['Type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $field['Type'],18,"
    \n",true) ."
    "; } # append the custom fields, if any @@ -100,7 +100,7 @@ $msgr = in_array($myField['name'],$reqfields) ? "*" : ""; $tpl_field_names.= "".$myField['name'].$msgr.""; - $tpl_field_types.= "". wordwrap($myField['type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $myField['type'],18,"
    \n",true) ."
    "; $expfields[] = $myField['name']; // $disfields[] = $myField['name']; } diff --git a/app/admin/import-export/import-devtype-select.php b/app/admin/import-export/import-devtype-select.php index 116ca4997..578e4887c 100644 --- a/app/admin/import-export/import-devtype-select.php +++ b/app/admin/import-export/import-devtype-select.php @@ -49,7 +49,7 @@ #prebuild template table rows to avoid useless foreach loops $tpl_field_names.= "".$pname.$field['Field'].$msgr.""; - $tpl_field_types.= "". wordwrap($field['Type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $field['Type'],18,"
    \n",true) ."
    "; } ?> diff --git a/app/admin/import-export/import-ipaddr-check.php b/app/admin/import-export/import-ipaddr-check.php index 65b4f6ecb..91642357c 100644 --- a/app/admin/import-export/import-ipaddr-check.php +++ b/app/admin/import-export/import-ipaddr-check.php @@ -26,7 +26,7 @@ # check which sections we need to care about $used_section = array(); -foreach ($data as &$cdata) { $used_section[strtolower($cdata['section'])]=$cdata['section']; } +foreach ($data as &$cdata) { $used_section[strtolower((string) $cdata['section'])]=$cdata['section']; } # fetch all VRFs $all_vrfs = $Admin->fetch_all_objects("vrf", "vrfId"); @@ -56,10 +56,10 @@ foreach ($all_sections as $section) { $section = (array) $section; - $section_names[strtolower($section['name'])] = $section; + $section_names[strtolower((string) $section['name'])] = $section; # skip sections we're not importing for, so we save cpu time and memory - if (!isset($used_section[strtolower($section['name'])])) { continue; } + if (!isset($used_section[strtolower((string) $section['name'])])) { continue; } $section_subnets = $Subnets->fetch_section_subnets($section['id']); @@ -129,13 +129,13 @@ # if the subnet contains "/", split it in network and mask if ($action != "error") { - if (preg_match("/\//", $cdata['subnet'])) { + if (preg_match("/\//", (string) $cdata['subnet'])) { list($caddr,$cmask) = $Subnets->cidr_network_and_mask($cdata['subnet']); $cdata['mask'] = $cmask; $cdata['subnet'] = $caddr; } else { $msg.= "The subnet needs to have the mask defined as /BM (Bit Mask)"; $action = "error"; } - if ((!empty($cdata['mask'])) && (!preg_match("/^([0-9]+|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/", $cdata['mask']))) { + if ((!empty($cdata['mask'])) && (!preg_match("/^([0-9]+|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/", (string) $cdata['mask']))) { $msg.="Invalid network mask format."; $action = "error"; } else { $cdata['type'] = $Subnets->identify_address($cdata['subnet']); @@ -144,10 +144,10 @@ } # Check if section is provided and valid and link it if it is - if (!isset($section_names[strtolower($cdata['section'])])) { + if (!isset($section_names[strtolower((string) $cdata['section'])])) { $msg.= "Invalid section."; $action = "error"; } else { - $cdata['sectionId'] = $section_names[strtolower($cdata['section'])]['id']; + $cdata['sectionId'] = $section_names[strtolower((string) $cdata['section'])]['id']; } # Check if VRF is provided and valid and link it if it is @@ -218,17 +218,17 @@ # Verify gateway - if (in_array(strtolower($cdata['is_gateway']),array("yes","true","1"))) { $cdata['is_gateway'] = 1; } else { $cdata['is_gateway'] = 0; } + if (in_array(strtolower((string) $cdata['is_gateway']),array("yes","true","1"))) { $cdata['is_gateway'] = 1; } else { $cdata['is_gateway'] = 0; } if ($action != "error") { if(!$Addresses->validate_ip($cdata['ip_addr'])) { $msg.="Invalid IP address."; $action = "error"; } - if ((!empty($cdata['hostname'])) && (!preg_match("/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/", $cdata['hostname']))) { $msg.="Invalid DNS name."; $action = "error"; } - if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } + if ((!empty($cdata['hostname'])) && (!preg_match("/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/", (string) $cdata['hostname']))) { $msg.="Invalid DNS name."; $action = "error"; } + if (preg_match("/[;'\"]/", (string) $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } if ($cdata['mac']) { - if (!preg_match("/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/", $cdata['mac'])) { $msg.="Invalid MAC address."; $action = "error"; } + if (!preg_match("/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/", (string) $cdata['mac'])) { $msg.="Invalid MAC address."; $action = "error"; } } - if (preg_match("/[;'\"]/", $cdata['owner'])) { $msg.="Invalid characters in owner name."; $action = "error"; } - if (preg_match("/[;'\"]/", $cdata['note'])) { $msg.="Invalid characters in note."; $action = "error"; } + if (preg_match("/[;'\"]/", (string) $cdata['owner'])) { $msg.="Invalid characters in owner name."; $action = "error"; } + if (preg_match("/[;'\"]/", (string) $cdata['note'])) { $msg.="Invalid characters in note."; $action = "error"; } } // Check IP belongs to subnet diff --git a/app/admin/import-export/import-ipaddr-select.php b/app/admin/import-export/import-ipaddr-select.php index 84161fc16..507084462 100644 --- a/app/admin/import-export/import-ipaddr-select.php +++ b/app/admin/import-export/import-ipaddr-select.php @@ -83,7 +83,7 @@ #prebuild template table rows to avoid useless foreach loops $tpl_field_names.= "".($pname ? $pname : $field['Field']).$msgr.""; - $tpl_field_types.= "". wordwrap($field['Type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $field['Type'],18,"
    \n",true) ."
    "; } # append the custom fields, if any @@ -96,7 +96,7 @@ $msgr = in_array($myField['name'],$reqfields) ? "*" : ""; $tpl_field_names.= "".$myField['name'].$msgr.""; - $tpl_field_types.= "". wordwrap($myField['type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $myField['type'],18,"
    \n",true) ."
    "; $expfields[] = $myField['name']; // $disfields[] = $myField['name']; } diff --git a/app/admin/import-export/import-l2dom-check.php b/app/admin/import-export/import-l2dom-check.php index 43df7ca4d..fc4fec58c 100644 --- a/app/admin/import-export/import-l2dom-check.php +++ b/app/admin/import-export/import-l2dom-check.php @@ -45,8 +45,8 @@ # check data format if ($action != "error") { - if (!preg_match("/^[a-zA-Z0-9-_. ]+$/", $cdata['name'])) { $msg.="Invalid name format."; $action = "error"; } - if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } + if (!preg_match("/^[a-zA-Z0-9-_. ]+$/", (string) $cdata['name'])) { $msg.="Invalid name format."; $action = "error"; } + if (preg_match("/[;'\"]/", (string) $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } } # check if duplicate L2 domain diff --git a/app/admin/import-export/import-l2dom-select.php b/app/admin/import-export/import-l2dom-select.php index 72e950004..3f9d5c373 100644 --- a/app/admin/import-export/import-l2dom-select.php +++ b/app/admin/import-export/import-l2dom-select.php @@ -49,7 +49,7 @@ #prebuild template table rows to avoid useless foreach loops $tpl_field_names.= "".$pname.$field['Field'].$msgr.""; - $tpl_field_types.= "". wordwrap($field['Type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $field['Type'],18,"
    \n",true) ."
    "; } ?> diff --git a/app/admin/import-export/import-load-data.php b/app/admin/import-export/import-load-data.php index dbe8928ea..2067aec2e 100644 --- a/app/admin/import-export/import-load-data.php +++ b/app/admin/import-export/import-load-data.php @@ -52,7 +52,7 @@ $data = array(); # read first row from CSV -if (strtolower($filetype) == "csv") { +if (strtolower((string) $filetype) == "csv") { # open CSV file $filehdl = fopen('upload/data_import.csv', 'r'); @@ -67,7 +67,7 @@ foreach ($cols as $val) { $col++; # map import columns to expected fields as per previous window - $fieldmap[$col] = escape_input(trim($impfields[$val])); + $fieldmap[$col] = escape_input(trim((string) $impfields[$val])); $hcol = $col; } @@ -83,7 +83,7 @@ $Result->show('danger', _("Extra column found on line ").$row._(" in CSV file. CSV delimiter used in value field?"), true); } else { # read each row into a dictionary with expected fields as keys - $record[$fieldmap[$col]] = escape_input(trim($val)); + $record[$fieldmap[$col]] = escape_input(trim((string) $val)); } } $data[] = $record; @@ -91,7 +91,7 @@ fclose($filehdl); } # read first row from XLS -elseif(strtolower($filetype) == "xls") { +elseif(strtolower((string) $filetype) == "xls") { # get excel object require_once(dirname(__FILE__) . '/../../../functions/php-excel-reader/excel_reader2.php'); //excel reader 2.21 $xls = new Spreadsheet_Excel_Reader('upload/data_import.xls', false); @@ -110,7 +110,7 @@ if ($col > $hcol) { $Result->show('danger', _("Extra column found on line ").$row._(" in XLS file. Please check input file."), true); } else { - $record[$fieldmap[$col]] = escape_input(trim($Tools->convert_encoding_to_UTF8($xls->val($row,$col,$sheet)))); + $record[$fieldmap[$col]] = escape_input(trim((string) $Tools->convert_encoding_to_UTF8($xls->val($row,$col,$sheet)))); } } $data[] = $record; diff --git a/app/admin/import-export/import-recompute-logic.php b/app/admin/import-export/import-recompute-logic.php index 7de30b10f..7d2e4905b 100644 --- a/app/admin/import-export/import-recompute-logic.php +++ b/app/admin/import-export/import-recompute-logic.php @@ -28,7 +28,7 @@ # Read selected fields and pass them to the save form foreach($GET as $key => $value) { - if (preg_match("/recomputeSection_(\d+)$/",$key,$matches) && ($value == "on")) { + if (preg_match("/recomputeSection_(\d+)$/",(string) $key,$matches) && ($value == "on")) { # Grab provided values $rlist[$matches[1]]["IPv4"] = ($GET->{'recomputeSectionIPv4_'.$matches[1]} == "on" ? true : false); $rlist[$matches[1]]["IPv6"] = ($GET->{'recomputeSectionIPv6_'.$matches[1]} == "on" ? true : false); diff --git a/app/admin/import-export/import-subnets-check.php b/app/admin/import-export/import-subnets-check.php index 1bf99918e..b5cc5162f 100644 --- a/app/admin/import-export/import-subnets-check.php +++ b/app/admin/import-export/import-subnets-check.php @@ -48,7 +48,7 @@ //cast $vlan = (array) $vlan; $vlan_data[$vlan_domain['name']][$vlan['number']] = $vlan; - $vlan_data[$vlan_domain['name']][strtolower($vlan['name'])] = $vlan; + $vlan_data[$vlan_domain['name']][strtolower((string) $vlan['name'])] = $vlan; } } @@ -104,14 +104,14 @@ # if the subnet contains "/", split it in network and mask if ($action != "error") { - if (preg_match("/\//", $cdata['subnet'])) { + if (preg_match("/\//", (string) $cdata['subnet'])) { list($caddr,$cmask) = $Subnets->cidr_network_and_mask($cdata['subnet']); $cdata['mask'] = $cmask; $cdata['subnet'] = $caddr; } else { # check that mask is provided if ((!isset($cdata['mask'])) || ($cdata['mask'] == "")) { $msg.= "Required field mask missing or empty."; $action = "error"; } } - if ((!empty($cdata['mask'])) && (!preg_match("/^([0-9]+|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/", $cdata['mask']))) { + if ((!empty($cdata['mask'])) && (!preg_match("/^([0-9]+|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/", (string) $cdata['mask']))) { $msg.="Invalid network mask format."; $action = "error"; } else { $cdata['type'] = $Subnets->identify_address($cdata['subnet']); @@ -145,9 +145,9 @@ $msg.= "Invalid VLAN domain."; $action = "error"; } else { if (!empty($cdata['vlan'])) { - if (in_array(strtolower($cdata['vlan']),array("na","n/a","nan"))) { $cdata['vlan'] = ""; } - if ((!empty($cdata['vlan'])) && (strtolower($cdata['vlan']) != "na")) { - $v = strtolower($cdata['vlan']); + if (in_array(strtolower((string) $cdata['vlan']),array("na","n/a","nan"))) { $cdata['vlan'] = ""; } + if ((!empty($cdata['vlan'])) && (strtolower((string) $cdata['vlan']) != "na")) { + $v = strtolower((string) $cdata['vlan']); if (!isset($vlan_data[$cdom][$v])) { $msg.= "VLAN not found in provided domain."; $action = "error"; } else { @@ -165,13 +165,13 @@ if ($net = $Subnets->get_network_boundaries($cdata['subnet'],$cdata['mask'])) { $cdata['mask'] = $net['bitmask']; $cidr_check = $Subnets->verify_cidr_address($cdata['subnet']."/".$cdata['mask']); - if (strlen($cidr_check)>5) { $msg.=$cidr_check; $action = "error"; } + if (strlen((string) $cidr_check)>5) { $msg.=$cidr_check; $action = "error"; } } else { $msg.=$net['message']; $action = "error"; } - if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } - if ((!empty($cdata['vrf'])) && (!preg_match("/^[a-zA-Z0-9-_]+$/", $cdata['vrf']))) { $msg.="Invalid VRF name format."; $action = "error"; } + if (preg_match("/[;'\"]/", (string) $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } + if ((!empty($cdata['vrf'])) && (!preg_match("/^[a-zA-Z0-9-_]+$/", (string) $cdata['vrf']))) { $msg.="Invalid VRF name format."; $action = "error"; } # Allow VLAN to be the string now. # if ((!empty($cdata['vlan'])) && (!preg_match("/^[0-9]+$/", $cdata['vlan']))) { $msg.="Invalid VLAN number format."; $action = "error"; } - if ((!empty($cdata['domain'])) && (!preg_match("/^[a-zA-Z0-9-_. ]+$/", $cdata['domain']))) { $msg.="Invalid VLAN domain format."; $action = "error"; } + if ((!empty($cdata['domain'])) && (!preg_match("/^[a-zA-Z0-9-_. ]+$/", (string) $cdata['domain']))) { $msg.="Invalid VLAN domain format."; $action = "error"; } } # check if duplicate in the import data diff --git a/app/admin/import-export/import-subnets-select.php b/app/admin/import-export/import-subnets-select.php index 60fe01fc5..48ac43f78 100644 --- a/app/admin/import-export/import-subnets-select.php +++ b/app/admin/import-export/import-subnets-select.php @@ -71,7 +71,7 @@ #prebuild template table rows to avoid useless foreach loops $tpl_field_names.= "".$pname.$field['Field'].$msgr.""; - $tpl_field_types.= "". wordwrap($field['Type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $field['Type'],18,"
    \n",true) ."
    "; } # append the custom fields, if any @@ -84,7 +84,7 @@ $msgr = in_array($myField['name'],$reqfields) ? "*" : ""; $tpl_field_names.= "".$myField['name'].$msgr.""; - $tpl_field_types.= "". wordwrap($myField['type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $myField['type'],18,"
    \n",true) ."
    "; $expfields[] = $myField['name']; } } diff --git a/app/admin/import-export/import-vlan-check.php b/app/admin/import-export/import-vlan-check.php index de9070a90..af461a58b 100644 --- a/app/admin/import-export/import-vlan-check.php +++ b/app/admin/import-export/import-vlan-check.php @@ -70,10 +70,10 @@ # check data format if ($action != "error") { - if (!preg_match("//u", $cdata['name'])) { $msg.="Invalid name format."; $action = "error"; } - if (!preg_match("/^[0-9]+$/", $cdata['number'])) { $msg.="Invalid number format."; $action = "error"; } - if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } - if (!preg_match("/^[a-zA-Z0-9-_. ]+$/", $cdom)) { $msg.="Invalid domain format."; $action = "error"; } + if (!preg_match("//u", (string) $cdata['name'])) { $msg.="Invalid name format."; $action = "error"; } + if (!preg_match("/^[0-9]+$/", (string) $cdata['number'])) { $msg.="Invalid number format."; $action = "error"; } + if (preg_match("/[;'\"]/", (string) $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } + if (!preg_match("/^[a-zA-Z0-9-_. ]+$/", (string) $cdom)) { $msg.="Invalid domain format."; $action = "error"; } if ($action != "error") { if ($cdata['number']>$User->settings->vlanMax) { $msg.= _('Highest possible VLAN number is ').$User->settings->vlanMax.'!'; $action = "error"; } } } diff --git a/app/admin/import-export/import-vlan-select.php b/app/admin/import-export/import-vlan-select.php index 329a6e503..5fd9f05fe 100644 --- a/app/admin/import-export/import-vlan-select.php +++ b/app/admin/import-export/import-vlan-select.php @@ -53,7 +53,7 @@ #prebuild template table rows to avoid useless foreach loops $tpl_field_names.= "".$pname.$field['Field'].$msgr.""; - $tpl_field_types.= "". wordwrap($field['Type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $field['Type'],18,"
    \n",true) ."
    "; } # append the custom fields, if any @@ -66,7 +66,7 @@ $msgr = in_array($myField['name'],$reqfields) ? "*" : ""; $tpl_field_names.= "".$myField['name'].$msgr.""; - $tpl_field_types.= "". wordwrap($myField['type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $myField['type'],18,"
    \n",true) ."
    "; $expfields[] = $myField['name']; } } diff --git a/app/admin/import-export/import-vrf-check.php b/app/admin/import-export/import-vrf-check.php index cc78fc8b1..07b61a3d0 100644 --- a/app/admin/import-export/import-vrf-check.php +++ b/app/admin/import-export/import-vrf-check.php @@ -46,9 +46,9 @@ # check data format if ($action != "error") { - if (!preg_match("/^[a-zA-Z0-9-_]+$/", $cdata['name'])) { $msg.="Invalid name format."; $action = "error"; } - if (!preg_match("/^[0-9:]+$/", $cdata['rd'])) { $msg.="Invalid RD format."; $action = "error"; } - if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } + if (!preg_match("/^[a-zA-Z0-9-_]+$/", (string) $cdata['name'])) { $msg.="Invalid name format."; $action = "error"; } + if (!preg_match("/^[0-9:]+$/", (string) $cdata['rd'])) { $msg.="Invalid RD format."; $action = "error"; } + if (preg_match("/[;'\"]/", (string) $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } } # check if existing diff --git a/app/admin/import-export/import-vrf-select.php b/app/admin/import-export/import-vrf-select.php index 1cb04a99f..13bf698fb 100644 --- a/app/admin/import-export/import-vrf-select.php +++ b/app/admin/import-export/import-vrf-select.php @@ -44,7 +44,7 @@ #prebuild template table rows to avoid useless foreach loops $tpl_field_names.= "".$field['Field'].$msgr.""; - $tpl_field_types.= "". wordwrap($field['Type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $field['Type'],18,"
    \n",true) ."
    "; } # append the custom fields, if any @@ -57,7 +57,7 @@ # mark required fields with * $msgr = in_array($myField['name'],$reqfields) ? "*" : ""; $tpl_field_names.= "". $myField['name'] .""; - $tpl_field_types.= "". wordwrap($myField['type'],18,"
    \n",true) ."
    "; + $tpl_field_types.= "". wordwrap((string) $myField['type'],18,"
    \n",true) ."
    "; $expfields[] = $myField['name']; } } diff --git a/app/admin/languages/edit-result.php b/app/admin/languages/edit-result.php index 3ec9d29bc..c8d1a3ce7 100755 --- a/app/admin/languages/edit-result.php +++ b/app/admin/languages/edit-result.php @@ -28,8 +28,8 @@ $User->Crypto->csrf_cookie ("validate", "languages", $POST->csrf_cookie) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; # verify that description is present if action != delete -if($POST->action != "delete" && strlen($POST->l_code) < 2) { $Result->show("danger", _('Code must be at least 2 characters long'), true); } -if($POST->action != "delete" && strlen($POST->l_name) < 2) { $Result->show("danger", _('Name must be at least 2 characters long'), true); } +if($POST->action != "delete" && strlen((string) $POST->l_code) < 2) { $Result->show("danger", _('Code must be at least 2 characters long'), true); } +if($POST->action != "delete" && strlen((string) $POST->l_name) < 2) { $Result->show("danger", _('Name must be at least 2 characters long'), true); } # create update array $values = array("l_id"=>$POST->l_id, diff --git a/app/admin/locations/edit-result.php b/app/admin/locations/edit-result.php index d5f407150..7d0492178 100644 --- a/app/admin/locations/edit-result.php +++ b/app/admin/locations/edit-result.php @@ -39,11 +39,11 @@ if($POST->action!=="delete") { // lat if(!is_blank($POST->lat)) { - if(!preg_match('/^(\-?\d+(\.\d+)?).\s*(\-?\d+(\.\d+)?)$/', $POST->lat)) { $Result->show("danger", _("Invalid Latitude"), true); } + if(!preg_match('/^(\-?\d+(\.\d+)?).\s*(\-?\d+(\.\d+)?)$/', (string) $POST->lat)) { $Result->show("danger", _("Invalid Latitude"), true); } } // long if(!is_blank($POST->long)) { - if(!preg_match('/^(\-?\d+(\.\d+)?).\s*(\-?\d+(\.\d+)?)$/', $POST->long)) { $Result->show("danger", _("Invalid Longitude"), true); } + if(!preg_match('/^(\-?\d+(\.\d+)?).\s*(\-?\d+(\.\d+)?)$/', (string) $POST->long)) { $Result->show("danger", _("Invalid Longitude"), true); } } // fetch latlng diff --git a/app/admin/nameservers/edit-result.php b/app/admin/nameservers/edit-result.php index c75e030d7..d79df7951 100755 --- a/app/admin/nameservers/edit-result.php +++ b/app/admin/nameservers/edit-result.php @@ -31,7 +31,7 @@ $nservers_reindexed = array (); # reindex foreach($POST as $k=>$v) { - if(strpos($k, "namesrv-")!==false) { + if(strpos((string) $k, "namesrv-")!==false) { $nservers_reindexed["namesrv-".$m] = $v; $m++; unset($POST->{$k}); @@ -46,9 +46,9 @@ // merge nameservers foreach($POST as $key=>$line) { - if (!is_blank(strstr($key,"namesrv-"))) { + if (!is_blank(strstr((string) $key,"namesrv-"))) { if (!is_blank($line)) { - $all_nameservers[] = trim($line); + $all_nameservers[] = trim((string) $line); } } } @@ -57,7 +57,7 @@ // set sections $temp = array(); foreach($POST as $key=>$line) { - if (!is_blank(strstr($key,"section-"))) { + if (!is_blank(strstr((string) $key,"section-"))) { $key2 = str_replace("section-", "", $key); $temp[] = $key2; unset($POST->{$key}); diff --git a/app/admin/nat/edit-map.php b/app/admin/nat/edit-map.php index 0392e8121..faaa42310 100644 --- a/app/admin/nat/edit-map.php +++ b/app/admin/nat/edit-map.php @@ -47,7 +47,7 @@ $n->description = !is_blank($n->description) ? "($n->description)" : ""; // device -if (strlen($n->device)) { +if (strlen((string) $n->device)) { if($n->device !== 0) { $device = $Tools->fetch_object ("devices", "id", $n->device); $description = !is_blank($device->description) ? "($device->description)" : ""; @@ -79,7 +79,7 @@ // print print ""; print " "; - print " ".ucwords($n->type)." $n->name $n->description"; + print " ".ucwords((string) $n->type)." $n->name $n->description"; print ""; print ""; diff --git a/app/admin/nat/edit-result.php b/app/admin/nat/edit-result.php index cb10e4a65..a3e4bb00a 100644 --- a/app/admin/nat/edit-result.php +++ b/app/admin/nat/edit-result.php @@ -36,7 +36,7 @@ } if($POST->action=="add" || $POST->action=="edit") { // name - if(strlen($POST->name)<3) { $Result->show("danger", _("Name must have at least 3 characters"), true); } + if(strlen((string) $POST->name)<3) { $Result->show("danger", _("Name must have at least 3 characters"), true); } if(!in_array($POST->type, array("source", "static", "destination"))) { $Result->show("danger", _("Invalid NAT type"), true); } if(isset($POST->device)) { if(!is_numeric($POST->device)) { $Result->show("danger", _("Invalid device"), true); } diff --git a/app/admin/nat/item-add-search.php b/app/admin/nat/item-add-search.php index 716909488..2dd179d79 100644 --- a/app/admin/nat/item-add-search.php +++ b/app/admin/nat/item-add-search.php @@ -40,7 +40,7 @@ } # change * to % for database wildchar -$search_term = trim($search_term); +$search_term = trim((string) $search_term); $search_term = str_replace("*", "%", $search_term); # fetch old details diff --git a/app/admin/powerDNS/domain-edit-result.php b/app/admin/powerDNS/domain-edit-result.php index 82e2116b0..2a1acbfdf 100644 --- a/app/admin/powerDNS/domain-edit-result.php +++ b/app/admin/powerDNS/domain-edit-result.php @@ -39,7 +39,7 @@ // master if (!is_blank($POST->master)) { // if multiple masters - if (strpos($POST->master, ",")!==false) { + if (strpos((string) $POST->master, ",")!==false) { // to array and trim, check each $masters = array_filter(pf_explode(",", $POST->master)); foreach ($masters as $m) { @@ -62,7 +62,7 @@ if ($POST->type=="SLAVE") { if (is_blank($POST->master)) { $Result->show("danger", _("Please set master server(s) if domain type is SLAVE"), true); } else { - if (strpos($POST->master, ",")!==false) { + if (strpos((string) $POST->master, ",")!==false) { // to array and trim, check each $masters = array_filter(pf_explode(",", $POST->master)); foreach ($masters as $m) { diff --git a/app/admin/powerDNS/record-edit-result.php b/app/admin/powerDNS/record-edit-result.php index f2449a8cf..aebb104b4 100644 --- a/app/admin/powerDNS/record-edit-result.php +++ b/app/admin/powerDNS/record-edit-result.php @@ -36,15 +36,15 @@ # edit and add - check that smth is in name and content! if ($POST->action != "delete") { - if (strlen($POST->name) < 2) {$Result->show("danger", _("Invalid name"), true);} - if (strlen($POST->content) < 2) {$Result->show("danger", _("Invalid content"), true);} + if (strlen((string) $POST->name) < 2) {$Result->show("danger", _("Invalid name"), true);} + if (strlen((string) $POST->content) < 2) {$Result->show("danger", _("Invalid content"), true);} } # dont permit modifications on slave domain $domain = $PowerDNS->fetch_domain ($POST->domain_id); $domain!==false ? : $Result->show("danger", _("Invalid ID"), true, true); -if(strtolower($domain->type) == "slave") { +if(strtolower((string) $domain->type) == "slave") { $Result->show("danger", _("Adding domain record on slave zone is not permitted"), true); } diff --git a/app/admin/powerDNS/record-edit.php b/app/admin/powerDNS/record-edit.php index 5758af5a5..b1534a12a 100644 --- a/app/admin/powerDNS/record-edit.php +++ b/app/admin/powerDNS/record-edit.php @@ -66,7 +66,7 @@ if (isset($matches)) { $max = 0; foreach($matches as $k=>$m){ - $length = strlen($m->name); + $length = strlen((string) $m->name); if($length > $max){ $max = $length; $element_id = $k; } } // save longest match id diff --git a/app/admin/powerDNS/settings.php b/app/admin/powerDNS/settings.php index 749fc4b6b..885c12cfe 100644 --- a/app/admin/powerDNS/settings.php +++ b/app/admin/powerDNS/settings.php @@ -101,7 +101,7 @@
    host, ";")!==false) { + if(strpos((string) $pdns->host, ";")!==false) { // multiple ? if(isset($PowerDNS->db_check_error)) { foreach ($PowerDNS->db_check_error as $err) { @@ -114,7 +114,7 @@ // print active else { // set to array - $active_db = explode(";", $PowerDNS->db_settings->host); + $active_db = explode(";", (string) $PowerDNS->db_settings->host); // print $Result->show("success ", "Database connection ok".". "._("Active database").": ".$active_db[$PowerDNS->active_db]); } diff --git a/app/admin/requests/index.php b/app/admin/requests/index.php index aba2b4344..4cce0d14a 100755 --- a/app/admin/requests/index.php +++ b/app/admin/requests/index.php @@ -51,7 +51,7 @@ foreach ($custom_fields as $field) { print "".$Tools->print_custom_field_name ($field['name']).""; if(!in_array($myField['name'], $hidden_cfields)) { - print ''.ucwords($Tools->print_custom_field_name ($field['name'])).''; + print ''.ucwords((string) $Tools->print_custom_field_name ($field['name'])).''; } } } diff --git a/app/admin/required-fields/index.php b/app/admin/required-fields/index.php index 013c32374..9b03aba87 100755 --- a/app/admin/required-fields/index.php +++ b/app/admin/required-fields/index.php @@ -58,7 +58,7 @@ print ''. "\n"; print ' '; - print ' '. ucfirst($field_print) .''; + print ' '. ucfirst((string) $field_print) .''; print ''; } ?> diff --git a/app/admin/ripe-import/import-subnets.php b/app/admin/ripe-import/import-subnets.php index 551ab1aa6..c90464556 100755 --- a/app/admin/ripe-import/import-subnets.php +++ b/app/admin/ripe-import/import-subnets.php @@ -28,7 +28,7 @@ //get unique keys for subnets because they are not sequential if deleted!!! foreach($POST as $key=>$line) { - if (!is_blank(strstr($key,"subnet"))) { + if (!is_blank(strstr((string) $key,"subnet"))) { $allSubnets[] = $key; } } diff --git a/app/admin/ripe-import/ripe-telnet.php b/app/admin/ripe-import/ripe-telnet.php index b4427c218..f5f4801dc 100755 --- a/app/admin/ripe-import/ripe-telnet.php +++ b/app/admin/ripe-import/ripe-telnet.php @@ -21,8 +21,8 @@ //strip AS if provided, to get just the number -if(substr($POST->as, 0,2)=="AS" || substr($POST->as, 0,2)=="as") { - $POST->as = substr($POST->as, 2); +if(substr((string) $POST->as, 0,2)=="AS" || substr((string) $POST->as, 0,2)=="as") { + $POST->as = substr((string) $POST->as, 2); }; // numeric @@ -74,7 +74,7 @@ if ($m > 999) break; # only not empty - if(strlen($route)>2) { + if(strlen((string) $route)>2) { print ''. "\n"; //delete diff --git a/app/admin/scan-agents/edit-result.php b/app/admin/scan-agents/edit-result.php index f205fc440..83623ff79 100644 --- a/app/admin/scan-agents/edit-result.php +++ b/app/admin/scan-agents/edit-result.php @@ -50,7 +50,7 @@ if($POST->action!="delete") { # code must be exactly 32 chars long and alfanumeric if app_security = crypt if(@$agent_old->type!="direct") { - if(strlen($POST->code)!=32 || !preg_match("#^[a-zA-Z0-9-_=]+$#", $POST->code)) { $error[] = _("Invalid agent code"); } + if(strlen((string) $POST->code)!=32 || !preg_match("#^[a-zA-Z0-9-_=]+$#", (string) $POST->code)) { $error[] = _("Invalid agent code"); } } # name must be more than 2 and alphanumberic if(is_blank($POST->name)) { $error[] = _("Invalid agent name"); } diff --git a/app/admin/scan-agents/index.php b/app/admin/scan-agents/index.php index d052ed38c..74f3e0fe7 100644 --- a/app/admin/scan-agents/index.php +++ b/app/admin/scan-agents/index.php @@ -46,8 +46,8 @@ $a = (array) $a; // fixes - $a['code'] = strlen($a['code'])===0 ? "/" : $a['code']; - $a['last_access'] = strlen($a['last_access'])===0 ? ""._("Never")."" : $a['last_access']; + $a['code'] = strlen((string) $a['code'])===0 ? "/" : $a['code']; + $a['last_access'] = strlen((string) $a['last_access'])===0 ? ""._("Never")."" : $a['last_access']; // print print '' . "\n"; diff --git a/app/admin/sections/index.php b/app/admin/sections/index.php index 405510db3..fe69a3b0f 100755 --- a/app/admin/sections/index.php +++ b/app/admin/sections/index.php @@ -100,7 +100,7 @@ print " "; //permissions print ""; - if(strlen($section['permissions'])>1 && !is_null($section['permissions'])) { + if(strlen((string) $section['permissions'])>1 && !is_null($section['permissions'])) { $permissions = $Sections->parse_section_permissions($section['permissions']); # print for each if they exist if(sizeof($permissions) > 0) { diff --git a/app/admin/settings/logo/import-verify.php b/app/admin/settings/logo/import-verify.php index 9906ae229..99f858ad2 100644 --- a/app/admin/settings/logo/import-verify.php +++ b/app/admin/settings/logo/import-verify.php @@ -30,7 +30,7 @@ /* no errors */ if(isset($_FILES['file']) && $_FILES['file']['error'] == 0) { //wrong extension - if(!in_array(strtolower($filename), $allowed)) { + if(!in_array(strtolower((string) $filename), $allowed)) { echo '{"status":"error", "error":"Invalid document type - allowed '.implode(";", $allowed).'"}'; exit; } diff --git a/app/admin/settings/settings-save.php b/app/admin/settings/settings-save.php index 14d42265c..745a979da 100755 --- a/app/admin/settings/settings-save.php +++ b/app/admin/settings/settings-save.php @@ -28,7 +28,7 @@ //check for http/https -if ( (strpos($POST->siteURL,'http://') !== false) || (strpos($POST->siteURL,'https://') !== false) ) {} +if ( (strpos((string) $POST->siteURL,'http://') !== false) || (strpos((string) $POST->siteURL,'https://') !== false) ) {} else { $POST->siteURL = "http://".$POST->siteURL; } //verify ping status fields diff --git a/app/admin/subnets/edit-folder-result.php b/app/admin/subnets/edit-folder-result.php index b416e0f41..32d089374 100755 --- a/app/admin/subnets/edit-folder-result.php +++ b/app/admin/subnets/edit-folder-result.php @@ -78,7 +78,7 @@ } //check for name length - 2 is minimum! -if(strlen($POST->description)<2 && $POST->action!="delete") { $Result->show("danger", _('Folder name must have at least 2 characters')."!", true); } +if(strlen((string) $POST->description)<2 && $POST->action!="delete") { $Result->show("danger", _('Folder name must have at least 2 characters')."!", true); } # delete and not yet confirmed if ($POST->action=="delete" && !isset($POST->deleteconfirm)) { diff --git a/app/admin/subnets/edit-result.php b/app/admin/subnets/edit-result.php index 7882972fe..e2fbcece4 100755 --- a/app/admin/subnets/edit-result.php +++ b/app/admin/subnets/edit-result.php @@ -42,13 +42,13 @@ } # modify post parameters -$POST->cidr = trim($POST->subnet); +$POST->cidr = trim((string) $POST->subnet); $POST->id = $POST->subnetId; # get mask and subnet $temp = $Subnets->cidr_network_and_mask($POST->subnet); -$POST->mask = trim($temp[1]); -$POST->subnet = trim($temp[0]); +$POST->mask = trim((string) $temp[1]); +$POST->subnet = trim((string) $temp[0]); # errors array @@ -86,7 +86,7 @@ //verify cidr $cidr_check = $Subnets->verify_cidr_address($POST->cidr); - if(strlen($cidr_check)>5) { $errors[] = $cidr_check; } + if(strlen((string) $cidr_check)>5) { $errors[] = $cidr_check; } # Set permissions if adding new subnet diff --git a/app/admin/subnets/edit.php b/app/admin/subnets/edit.php index 084452477..b8c8f9578 100755 --- a/app/admin/subnets/edit.php +++ b/app/admin/subnets/edit.php @@ -147,12 +147,12 @@ // mastersubnet Ajax $("input[name='subnet']").change(function() { var $masterdopdown = $("select[name='masterSubnetId']"); - $masterdopdown.load('sectionId).'&cidr='; ?>' + $(this).val() + '&prev=' + $masterdopdown.val()); + $masterdopdown.load('sectionId).'&cidr='; ?>' + $(this).val() + '&prev=' + $masterdopdown.val()); }); location=="ipcalc" && !isset($POST->freespaceMSID)) { ?> var $masterdopdown = $("select[name='masterSubnetId']"); - $masterdopdown.load('sectionId).'&cidr='; ?>' + $(this).val() + '&prev=0'); + $masterdopdown.load('sectionId).'&cidr='; ?>' + $(this).val() + '&prev=0'); }); diff --git a/app/admin/subnets/permissions-show.php b/app/admin/subnets/permissions-show.php index 580025251..f3f2970f9 100755 --- a/app/admin/subnets/permissions-show.php +++ b/app/admin/subnets/permissions-show.php @@ -73,7 +73,7 @@ permissions)>1) { $permissons = $Sections->parse_section_permissions($subnet->permissions); } + if(strlen((string) $subnet->permissions)>1) { $permissons = $Sections->parse_section_permissions($subnet->permissions); } else { $permissons = ""; } # print each group diff --git a/app/admin/subnets/ripe-query.php b/app/admin/subnets/ripe-query.php index 19342b45f..c8d01b19e 100755 --- a/app/admin/subnets/ripe-query.php +++ b/app/admin/subnets/ripe-query.php @@ -29,7 +29,7 @@ show("danger", _(ucwords($res['error'])), false); + $Result->show("danger", _(ucwords((string) $res['error'])), false); } // ok, print field matching else { @@ -39,7 +39,7 @@ // leave only varchar and text foreach ($custom_fields as $k=>$f) { - if (!(strpos($f['type'], "varchar")!==false || $f['type']=="text")) { + if (!(strpos((string) $f['type'], "varchar")!==false || $f['type']=="text")) { unset($custom_fields[$k]); } } @@ -71,7 +71,7 @@ // replace descr with description if ($k=="descr") $k = "description"; - if (strtolower($f['name'])==strtolower($k)) { print ""; } + if (strtolower((string) $f['name'])==strtolower((string) $k)) { print ""; } else { print ""; } } } diff --git a/app/admin/tags/edit-result.php b/app/admin/tags/edit-result.php index 8afd0e794..e0ffa2102 100644 --- a/app/admin/tags/edit-result.php +++ b/app/admin/tags/edit-result.php @@ -35,9 +35,9 @@ /* checks */ if($POST->action=="delete" && $old_tag->locked!="No") { $Result->show("danger", _("Cannot delete locked tag"), true); } if($POST->action!="delete") { - if(strlen($POST->type)<3) { $Result->show("danger", _("Invalid tag name"), true); } - if(strlen($POST->bgcolor)<4) { $Result->show("danger", _("Invalid bg color"), true); } - if(strlen($POST->fgcolor)<4) { $Result->show("danger", _("Invalid fg color"), true); } + if(strlen((string) $POST->type)<3) { $Result->show("danger", _("Invalid tag name"), true); } + if(strlen((string) $POST->bgcolor)<4) { $Result->show("danger", _("Invalid bg color"), true); } + if(strlen((string) $POST->fgcolor)<4) { $Result->show("danger", _("Invalid fg color"), true); } } # create array of values for modification diff --git a/app/admin/users/ad-search-result.php b/app/admin/users/ad-search-result.php index b4eda9420..1a0000eba 100755 --- a/app/admin/users/ad-search-result.php +++ b/app/admin/users/ad-search-result.php @@ -32,7 +32,7 @@ //no login parameters if(is_blank($params->adminUsername) || is_blank($params->adminPassword)) { $Result->show("danger", _("Missing credentials"), true); } //at least 2 chars -if(strlen($POST->dname)<2) { $Result->show("danger", _('Please enter at least 2 characters'), true); } +if(strlen((string) $POST->dname)<2) { $Result->show("danger", _('Please enter at least 2 characters'), true); } //open connection diff --git a/app/admin/users/edit-notify.php b/app/admin/users/edit-notify.php index ca872a042..052cd00c3 100755 --- a/app/admin/users/edit-notify.php +++ b/app/admin/users/edit-notify.php @@ -79,7 +79,7 @@ $content_plain = implode("\r\n",$content_plain); $phpipam_mail->Php_mailer->setFrom($mail_settings->mAdminMail, $mail_settings->mAdminName); - $phpipam_mail->Php_mailer->addAddress(addslashes(trim($POST->email)), addslashes(trim($POST->real_name))); + $phpipam_mail->Php_mailer->addAddress(addslashes(trim((string) $POST->email)), addslashes(trim((string) $POST->real_name))); //add all admins to CC if (sizeof($users)>0) { foreach($users as $admin) { diff --git a/app/admin/users/edit-result.php b/app/admin/users/edit-result.php index bdb4867df..d67af0e9f 100755 --- a/app/admin/users/edit-result.php +++ b/app/admin/users/edit-result.php @@ -73,7 +73,7 @@ if ($POST->action=="add") { //username > 8 chars if ($auth_method->type=="local") { - if(strlen($POST->username)<3) { $Result->show("danger", _("Username must be at least 3 characters long!"), true); } + if(strlen((string) $POST->username)<3) { $Result->show("danger", _("Username must be at least 3 characters long!"), true); } } else { if(is_blank($POST->username)) { $Result->show("danger", _("Username must be at least 1 character long!"), true); } } diff --git a/app/admin/users/edit.php b/app/admin/users/edit.php index 387efa0e4..7ecd74465 100755 --- a/app/admin/users/edit.php +++ b/app/admin/users/edit.php @@ -415,7 +415,7 @@ $timepicker_index = $custom_input['timepicker_index']; // print print ""; - print " ".ucwords($field['name'])." ".$custom_input['required'].""; + print " ".ucwords((string) $field['name'])." ".$custom_input['required'].""; print " ".$custom_input['field'].""; print ""; } diff --git a/app/admin/users/print_module_permissions.php b/app/admin/users/print_module_permissions.php index 611d305b1..ad20c6fb2 100644 --- a/app/admin/users/print_module_permissions.php +++ b/app/admin/users/print_module_permissions.php @@ -33,7 +33,7 @@ print '
      '; foreach ($user as $key=>$u) { - if(strpos($key, "perm_")!==false && array_key_exists($key, $perm_names)) { + if(strpos((string) $key, "perm_")!==false && array_key_exists((string) $key, $perm_names)) { print '
    • '; // title print ""; @@ -54,7 +54,7 @@ else { print ""; foreach ($user as $key=>$u) { - if(strpos($key, "perm_")!==false && array_key_exists($key, $perm_names)) { + if(strpos((string) $key, "perm_")!==false && array_key_exists((string) $key, $perm_names)) { print ""; } } diff --git a/app/admin/vaults/download-certificate-execute.php b/app/admin/vaults/download-certificate-execute.php index f950bbf04..93ab191c2 100644 --- a/app/admin/vaults/download-certificate-execute.php +++ b/app/admin/vaults/download-certificate-execute.php @@ -49,7 +49,7 @@ } else { // parse certificate to cer format - $certificate = base64_decode($vault_item_values->certificate); + $certificate = base64_decode((string) $vault_item_values->certificate); } // no key @@ -60,7 +60,7 @@ if($content == "") { // base64 decode cert form DB - $certificate = base64_decode($vault_item_values->certificate); + $certificate = base64_decode((string) $vault_item_values->certificate); // public and private keys // $cert_res_pub = openssl_pkey_get_public ($certificate); diff --git a/app/admin/vaults/download-certificate.php b/app/admin/vaults/download-certificate.php index f55cb54b1..d053d5e5c 100644 --- a/app/admin/vaults/download-certificate.php +++ b/app/admin/vaults/download-certificate.php @@ -53,7 +53,7 @@ // $options['cer'] = "Download DER encoded public certificate (binary) - cer"; // private key - if(openssl_get_privatekey(base64_decode($vault_item_values->certificate))!==false) { + if(openssl_get_privatekey(base64_decode((string) $vault_item_values->certificate))!==false) { $options['pem'] = "Download PEM encoded certificate (ASCII) with private key - pem"; // $options['der'] = "Download DER encoded certificate (Binary) with private key - der"; $options['p12'] = "Download PKCS#12 encoded certificate (Binary) with private key - p12"; diff --git a/app/admin/vaults/edit-item-certificate-result.php b/app/admin/vaults/edit-item-certificate-result.php index 6d665ec1c..2313f6b32 100644 --- a/app/admin/vaults/edit-item-certificate-result.php +++ b/app/admin/vaults/edit-item-certificate-result.php @@ -45,7 +45,7 @@ } // for edits without certificate get old value! elseif($POST->action=="edit") { - if(openssl_x509_parse(base64_decode($POST->certificate))===false) { + if(openssl_x509_parse(base64_decode((string) $POST->certificate))===false) { $vault_item = $Tools->fetch_object("vaultItems", "id", $POST->id); $vault_item_values = db_json_decode($User->Crypto->decrypt($vault_item->values, $_SESSION['vault'.$POST->vaultId])); $POST->certificate = $vault_item_values->certificate; @@ -55,7 +55,7 @@ # add, edit if($POST->action!="delete") { # name must be more than 2 and alphanumeric - if(strlen($POST->name)<3 || strlen($POST->name)>64) { $error[] = "Invalid name"; } + if(strlen((string) $POST->name)<3 || strlen((string) $POST->name)>64) { $error[] = "Invalid name"; } } # custom diff --git a/app/admin/vaults/edit-item-password-result.php b/app/admin/vaults/edit-item-password-result.php index 21c2eb00c..96f670e9a 100644 --- a/app/admin/vaults/edit-item-password-result.php +++ b/app/admin/vaults/edit-item-password-result.php @@ -42,9 +42,9 @@ # add, edit if($POST->action!="delete") { # name must be more than 2 and alphanumeric - if(strlen($POST->name)<3 || strlen($POST->name)>64) { $error[] = "Invalid name"; } - if(strlen($POST->username)<3 || strlen($POST->username)>64) { $error[] = "Invalid username"; } - if(strlen($POST->password)<3 || strlen($POST->password)>64) { $error[] = "Invalid password"; } + if(strlen((string) $POST->name)<3 || strlen((string) $POST->name)>64) { $error[] = "Invalid name"; } + if(strlen((string) $POST->username)<3 || strlen((string) $POST->username)>64) { $error[] = "Invalid username"; } + if(strlen((string) $POST->password)<3 || strlen((string) $POST->password)>64) { $error[] = "Invalid password"; } } diff --git a/app/admin/vaults/edit-result.php b/app/admin/vaults/edit-result.php index d31b962a5..7873e5f52 100644 --- a/app/admin/vaults/edit-result.php +++ b/app/admin/vaults/edit-result.php @@ -37,11 +37,11 @@ # add, edit if($POST->action!="delete") { # name must be more than 2 and alphanumeric - if(strlen($POST->name)<3 || strlen($POST->name)>64) { $error[] = "Invalid name"; } + if(strlen((string) $POST->name)<3 || strlen((string) $POST->name)>64) { $error[] = "Invalid name"; } } # ad - check secret length if($POST->action=="add") { - if(strlen($POST->secret)<8) { $Result->show("danger", _("Secret must be at least 8 characters long!"), true); } + if(strlen((string) $POST->secret)<8) { $Result->show("danger", _("Secret must be at least 8 characters long!"), true); } //enforce password policy $policy = (db_json_decode($User->settings->passwordPolicy, true)); diff --git a/app/admin/vaults/import-certificate-file-verify.php b/app/admin/vaults/import-certificate-file-verify.php index e767420f8..e563f95f6 100644 --- a/app/admin/vaults/import-certificate-file-verify.php +++ b/app/admin/vaults/import-certificate-file-verify.php @@ -33,7 +33,7 @@ /* no errors */ if(isset($_FILES['file']) && $_FILES['file']['error'] == 0) { //wrong extension - if(!in_array(strtolower($filename), $allowed)) { + if(!in_array(strtolower((string) $filename), $allowed)) { echo '{"status":"error", "error":"Invalid document type - allowed '.implode(",", $allowed).'"}'; exit; } diff --git a/app/admin/version-check/index.php b/app/admin/version-check/index.php index d100bb85e..0fc6d934b 100755 --- a/app/admin/version-check/index.php +++ b/app/admin/version-check/index.php @@ -70,7 +70,7 @@ print "
      $r->title $prerelease
      "; // date print "
      "; - print "Released on ".date("Y-M-d", strtotime($r->updated))." "; + print "Released on ".date("Y-M-d", strtotime((string) $r->updated))." "; print "
      $r->content
      "; // tag print "href."'>Download (GitHub)"; diff --git a/app/admin/vlans/edit-domain-result.php b/app/admin/vlans/edit-domain-result.php index 2205ba898..80a5d03ec 100644 --- a/app/admin/vlans/edit-domain-result.php +++ b/app/admin/vlans/edit-domain-result.php @@ -40,7 +40,7 @@ if($POST->id!=1) { $temp = []; foreach($POST as $key=>$line) { - if (!is_blank(strstr($key,"section-"))) { + if (!is_blank(strstr((string) $key,"section-"))) { $key2 = str_replace("section-", "", $key); $temp[] = $key2; unset($POST->{$key}); diff --git a/app/admin/vlans/vlans-scan-execute.php b/app/admin/vlans/vlans-scan-execute.php index 3830acad1..9439c05c9 100644 --- a/app/admin/vlans/vlans-scan-execute.php +++ b/app/admin/vlans/vlans-scan-execute.php @@ -53,7 +53,7 @@ # set devices foreach ($POST as $k=>$p) { - if (strpos($k, "device-")!==false) { + if (strpos((string) $k, "device-")!==false) { # fetch device $device = $Tools->fetch_object ("devices", "id", str_replace("device-", "", $k)); if ($device !== false) { diff --git a/app/admin/vlans/vlans-scan-result.php b/app/admin/vlans/vlans-scan-result.php index ca02d9e1c..e168ba0c6 100644 --- a/app/admin/vlans/vlans-scan-result.php +++ b/app/admin/vlans/vlans-scan-result.php @@ -41,18 +41,18 @@ # ok, lets get results form post array! foreach($POST as $key=>$line) { // IP address - if(substr($key, 0,4)=="name") { $res[substr($key, 4)]['name'] = $line; } + if(substr((string) $key, 0,4)=="name") { $res[substr((string) $key, 4)]['name'] = $line; } // mac - elseif(substr($key, 0,6)=="number") { $res[substr($key, 6)]['number'] = $line; } + elseif(substr((string) $key, 0,6)=="number") { $res[substr((string) $key, 6)]['number'] = $line; } // device - elseif(substr($key, 0,8)=="domainId") { $res[substr($key, 8)]['domainId'] = $line; } + elseif(substr((string) $key, 0,8)=="domainId") { $res[substr((string) $key, 8)]['domainId'] = $line; } // description - elseif(substr($key, 0,11)=="description") { $res[substr($key, 11)]['description'] = $line; } + elseif(substr((string) $key, 0,11)=="description") { $res[substr((string) $key, 11)]['description'] = $line; } // custom fields elseif (isset($required_fields)) { foreach ($required_fields as $k=>$f) { - if((strpos($key, $f['name'])) !== false) { - { $res[substr($key, strlen($f['name']))][$f['name']] = $line; } + if((strpos((string) $key, (string) $f['name'])) !== false) { + { $res[substr((string) $key, strlen((string) $f['name']))][$f['name']] = $line; } } } } diff --git a/app/admin/vrf/edit-result.php b/app/admin/vrf/edit-result.php index 3cee6e3a8..1c6cacabc 100755 --- a/app/admin/vrf/edit-result.php +++ b/app/admin/vrf/edit-result.php @@ -37,7 +37,7 @@ // set sections foreach($POST as $key=>$line) { - if (!is_blank(strstr($key,"section-"))) { + if (!is_blank(strstr((string) $key,"section-"))) { $key2 = str_replace("section-", "", $key); $temp[] = $key2; unset($POST->{$key}); diff --git a/app/admin/vrf/vrf-scan-execute.php b/app/admin/vrf/vrf-scan-execute.php index 0d2ba8d8e..261360b51 100644 --- a/app/admin/vrf/vrf-scan-execute.php +++ b/app/admin/vrf/vrf-scan-execute.php @@ -43,7 +43,7 @@ # set devices foreach ($POST as $k=>$p) { - if (strpos($k, "device-")!==false) { + if (strpos((string) $k, "device-")!==false) { # fetch device $device = $Tools->fetch_object ("devices", "id", str_replace("device-", "", $k)); if ($device !== false) { diff --git a/app/admin/vrf/vrf-scan-result.php b/app/admin/vrf/vrf-scan-result.php index b18a26b0d..c9849ef9a 100644 --- a/app/admin/vrf/vrf-scan-result.php +++ b/app/admin/vrf/vrf-scan-result.php @@ -39,16 +39,16 @@ # ok, lets get results form post array! foreach($POST as $key=>$line) { // IP address - if(substr($key, 0,2)=="rd") { $res[substr($key, 2)]['rd'] = $line; } + if(substr((string) $key, 0,2)=="rd") { $res[substr((string) $key, 2)]['rd'] = $line; } // mac - elseif(substr($key, 0,4)=="name") { $res[substr($key, 4)]['name'] = $line; } + elseif(substr((string) $key, 0,4)=="name") { $res[substr((string) $key, 4)]['name'] = $line; } // description - elseif(substr($key, 0,11)=="description") { $res[substr($key, 11)]['description'] = $line; } + elseif(substr((string) $key, 0,11)=="description") { $res[substr((string) $key, 11)]['description'] = $line; } // custom fields elseif (isset($required_fields)) { foreach ($required_fields as $k=>$f) { - if((strpos($key, $f['name'])) !== false) { - { $res[substr($key, strlen($f['name']))][$f['name']] = $line; } + if((strpos((string) $key, (string) $f['name'])) !== false) { + { $res[substr((string) $key, strlen((string) $f['name']))][$f['name']] = $line; } } } } diff --git a/app/admin/widgets/edit-result.php b/app/admin/widgets/edit-result.php index 1dcae43b0..117a36b05 100755 --- a/app/admin/widgets/edit-result.php +++ b/app/admin/widgets/edit-result.php @@ -35,7 +35,7 @@ } # Remove .php form wfile if it is present -$POST->wfile = str_replace(".php","",trim($POST->wfile)); +$POST->wfile = str_replace(".php","",trim((string) $POST->wfile)); # set update values $values = array("wid"=>$POST->wid, diff --git a/app/dashboard/index.php b/app/dashboard/index.php index 29c3d709f..e4fbd0da2 100755 --- a/app/dashboard/index.php +++ b/app/dashboard/index.php @@ -152,7 +152,7 @@ # print items in a row foreach($w as $c) { /* print items */ - if(array_key_exists($c, $widgets)) { + if(array_key_exists((string) $c, $widgets)) { $wdet = (array) $widgets[$c]; //reset size if not set diff --git a/app/dashboard/widgets/index.php b/app/dashboard/widgets/index.php index 08e398f18..15c84b69b 100644 --- a/app/dashboard/widgets/index.php +++ b/app/dashboard/widgets/index.php @@ -2,7 +2,7 @@ # get filelist for all configured widgets if ( - !preg_match('/^[a-zA-Z0-9-_]+$/', $GET->section) || + !preg_match('/^[a-zA-Z0-9-_]+$/', (string) $GET->section) || $Tools->fetch_object("widgets", "wfile", $GET->section) === false || $Tools->verify_widget($GET->section) === false ) { diff --git a/app/dashboard/widgets/ipcalc-result.php b/app/dashboard/widgets/ipcalc-result.php index 0b24d06cd..4951e7bd7 100644 --- a/app/dashboard/widgets/ipcalc-result.php +++ b/app/dashboard/widgets/ipcalc-result.php @@ -22,7 +22,7 @@ $User->check_user_session(); # get requested IP addresses in CIDR format -$POST->cidr = trim($POST->cidr); +$POST->cidr = trim((string) $POST->cidr); # verify input CIDR and die if errors $errors = $Subnets->verify_cidr_address ($POST->cidr, false); diff --git a/app/dashboard/widgets/top10_hosts_lib.php b/app/dashboard/widgets/top10_hosts_lib.php index d6ad6aa34..f462d2c03 100644 --- a/app/dashboard/widgets/top10_hosts_lib.php +++ b/app/dashboard/widgets/top10_hosts_lib.php @@ -91,11 +91,11 @@ function top10_widget($type_ip, $type_percentage, $height, $slimit) { # odd/even if more than 5 items if($valid_subnets > 5) { - if ($m&1) { print "['|
      " . addslashes($subnet['description']) . "', $display_item, '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } - else { print "['" . addslashes($subnet['description']) . "', $display_item, '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } + if ($m&1) { print "['|
      " . addslashes((string) $subnet['description']) . "', $display_item, '" . addslashes((string) $subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } + else { print "['" . addslashes((string) $subnet['description']) . "', $display_item, '" . addslashes((string) $subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } } else { - print "['" . addslashes($subnet['description']) . "', $display_item, '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; + print "['" . addslashes((string) $subnet['description']) . "', $display_item, '" . addslashes((string) $subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } } ?> diff --git a/app/error.php b/app/error.php index ae0c5a248..6c738bbe3 100755 --- a/app/error.php +++ b/app/error.php @@ -58,7 +58,7 @@ ); // validate -if (!array_key_exists($GET->section, $http_codes)) { $GET->section = 404; } +if (!array_key_exists((string) $GET->section, $http_codes)) { $GET->section = 404; } ?>
      diff --git a/app/install/postinstall_submit.php b/app/install/postinstall_submit.php index 740ee4df4..3ca5dc07b 100755 --- a/app/install/postinstall_submit.php +++ b/app/install/postinstall_submit.php @@ -24,8 +24,8 @@ # update else { # check lengths - if(strlen($POST->password1)<8) { $Result->show("danger", _("Password must be at least 8 characters long!"), true); } - if(strlen($POST->password2)<8) { $Result->show("danger", _("Password must be at least 8 characters long!"), true); } + if(strlen((string) $POST->password1)<8) { $Result->show("danger", _("Password must be at least 8 characters long!"), true); } + if(strlen((string) $POST->password2)<8) { $Result->show("danger", _("Password must be at least 8 characters long!"), true); } # check password match if($POST->password1!=$POST->password2) { $Result->show("danger", _("Passwords do not match"), true); } diff --git a/app/login/2fa/2fa_create.php b/app/login/2fa/2fa_create.php index 3387176bb..704b20133 100644 --- a/app/login/2fa/2fa_create.php +++ b/app/login/2fa/2fa_create.php @@ -14,7 +14,7 @@ $ga = new PHPGangsta_GoogleAuthenticator(); // create secret $secret = $ga->createSecret(32); // Override $User->settings->{'2fa_length'}. Only lengths 16 and 32 produce reliable results. See #3724 - $username = strtolower($User->user->username)."@".$User->settings->{'2fa_name'}; + $username = strtolower((string) $User->user->username)."@".$User->settings->{'2fa_name'}; // save secret to DB try { @@ -57,7 +57,7 @@ - \ No newline at end of file diff --git a/app/login/2fa/2fa_form.php b/public/app/login/2fa/2fa_form.php similarity index 100% rename from app/login/2fa/2fa_form.php rename to public/app/login/2fa/2fa_form.php diff --git a/app/login/2fa/2fa_validate.php b/public/app/login/2fa/2fa_validate.php similarity index 94% rename from app/login/2fa/2fa_validate.php rename to public/app/login/2fa/2fa_validate.php index c893513e6..447ebb36a 100644 --- a/app/login/2fa/2fa_validate.php +++ b/public/app/login/2fa/2fa_validate.php @@ -37,7 +37,6 @@ # check for failed logins and captcha if($User->blocklimit > $cnt) { # init class - require_once (__DIR__."/../../../functions/GoogleAuthenticator/PHPGangsta/GoogleAuthenticator.php"); $ga = new PHPGangsta_GoogleAuthenticator(); # validate if ($ga->verifyCode($User->user->{'2fa_secret'}, $POST->code, 2)) { diff --git a/app/login/2fa/index.php b/public/app/login/2fa/index.php similarity index 95% rename from app/login/2fa/index.php rename to public/app/login/2fa/index.php index 5a7c3a1bb..aeef3a622 100644 --- a/app/login/2fa/index.php +++ b/public/app/login/2fa/index.php @@ -1,7 +1,7 @@ check_user_session(true, true); @@ -132,7 +132,7 @@
      - + diff --git a/app/login/captchashow.php b/public/app/login/captchashow.php similarity index 79% rename from app/login/captchashow.php rename to public/app/login/captchashow.php index c3aefc4dd..4cb8c0c08 100644 --- a/app/login/captchashow.php +++ b/public/app/login/captchashow.php @@ -7,8 +7,7 @@ */ // defines Securimage class -require_once '../../functions/functions.php'; -require_once 'captcha/securimage.php'; +require_once __DIR__ . '/../../../functions/functions.php'; // Create a user $_SESSION to store captcha code $Database = new Database_PDO; @@ -23,10 +22,10 @@ 'text_color' => '#707070', // hex color for captcha text 'line_color' => '#202020', // hex color for lines over text 'num_lines' => 5, // # of lines to draw over text - 'wordlist_file' => 'words/words.txt', // text file for word captcha + 'wordlist_file' => __DIR__ . '/../../../vendor/dapphp/securimage/words/words.txt', // text file for word captcha 'use_wordlist' => false, // true to use word list 'wordlist_file_encoding' => null, // character encoding of word file if other than ASCII (e.g. UTF-8, GB2312) - 'ttf_file' => './captcha/AHGBold.ttf', // TTF file for captcha text + 'ttf_file' => __DIR__ . '/../../../vendor/dapphp/securimage/AHGBold.ttf', // TTF file for captcha text 'no_session' => false, 'session_name' => Config::ValueOf('phpsessname', 'phpipam'), 'use_database' => false diff --git a/app/login/index.php b/public/app/login/index.php similarity index 96% rename from app/login/index.php rename to public/app/login/index.php index 6c30a1ebf..2be07d732 100755 --- a/app/login/index.php +++ b/public/app/login/index.php @@ -1,7 +1,7 @@ subnetId = "404"; print "
      "; - include_once('app/error.php'); + require __DIR__ . '/../error.php'; print "
      "; } ?> @@ -182,7 +182,7 @@ - + diff --git a/app/login/login_check.php b/public/app/login/login_check.php similarity index 100% rename from app/login/login_check.php rename to public/app/login/login_check.php diff --git a/app/login/login_form.php b/public/app/login/login_form.php similarity index 100% rename from app/login/login_form.php rename to public/app/login/login_form.php diff --git a/app/login/login_form_sso.php b/public/app/login/login_form_sso.php similarity index 72% rename from app/login/login_form_sso.php rename to public/app/login/login_form_sso.php index 77958fc4f..1985a18d0 100644 --- a/app/login/login_form_sso.php +++ b/public/app/login/login_form_sso.php @@ -17,17 +17,8 @@ } //check if SAML2 login is possible - $saml2settings=$Tools->fetch_object("usersAuthMethod", "type", "SAML2"); - - if ($saml2settings!=false) { - $version = db_json_decode(@file_get_contents(__DIR__.'/../../functions/php-saml/src/Saml2/version.json'), true); - $version = $version['php-saml']['version']; - - if ($version < 3.4) { - $Result->show("danger", _('php-saml library missing, please update submodules')); - } else { - $Result->show("success", _('You can login with SAML2') . ' ' . _('here') . '!', false); - } + if (is_object($Tools->fetch_object("usersAuthMethod", "type", "SAML2"))) { + $Result->show("success", _('You can login with SAML2') . ' ' . _('here') . '!', false); } ?> @@ -37,8 +28,8 @@
      composer_has_errors(["firehed/webauthn", "firehed/cbor"]) ? "disabled" : ""; + if ($composer_autoload_err !== false) + $Result->show("warning", $composer_autoload_err, false); ?>
      @@ -51,7 +42,7 @@
      -
      "; - $content[] = " "; + $content[] = " "; $content[] = " "; $content[] = " "; - $content[] = " "; + $content[] = " "; $content[] = " "; $content[] = " "; $content[] = ""; diff --git a/functions/scripts/remove_offline_addresses.php b/functions/scripts/remove_offline_addresses.php index 0137641e3..4e4a542eb 100644 --- a/functions/scripts/remove_offline_addresses.php +++ b/functions/scripts/remove_offline_addresses.php @@ -127,7 +127,7 @@ $content[] = " "; $content[] = " "; $content[] = " "; - $content[] = " "; + $content[] = " "; $content[] = " "; $content[] = ""; diff --git a/public/app/admin/circuits/edit-logical-circuit-submit.php b/public/app/admin/circuits/edit-logical-circuit-submit.php index 03e6eb233..fa503507b 100644 --- a/public/app/admin/circuits/edit-logical-circuit-submit.php +++ b/public/app/admin/circuits/edit-logical-circuit-submit.php @@ -40,7 +40,7 @@ # Validate to make sure there aren't duplicates of the same circuit in the list of circuit ids # Create list of member circuit IDs for mapping $POST->circuit_list = str_replace("undefined.", "", $POST->circuit_list); -$id_list = $POST->circuit_list!=="" ? pf_explode("." , rtrim($POST->circuit_list,".")) : []; +$id_list = $POST->circuit_list!=="" ? pf_explode("." , rtrim((string) $POST->circuit_list,".")) : []; if(sizeof($id_list ) != sizeof(array_unique($id_list))){ $Result->show("danger", _('Remove duplicates of circuit').'!', true); } if($POST->action == "add" && sizeof($id_list) == 0){ $Result->show("danger", _('No circuits selected').'!', true); } From acf6fee97b790084d66c1ea8e2567a096c9371ec Mon Sep 17 00:00:00 2001 From: Gary Date: Fri, 1 May 2026 22:29:24 +0100 Subject: [PATCH 19/28] Bugfix: Rector PHP fixes * NullToStrictStringFuncCallArgRector (str_replace) --- functions/classes/class.Common.php | 10 ++++----- functions/classes/class.FirewallZones.php | 4 ++-- functions/classes/class.Log.php | 22 +++++++++---------- functions/classes/class.PDO.php | 2 +- functions/classes/class.PowerDNS.php | 2 +- functions/classes/class.Rewrite.php | 2 +- functions/classes/class.SNMP.php | 10 ++++----- functions/classes/class.Scan.php | 2 +- functions/classes/class.Subnets.php | 2 +- functions/classes/class.Tools.php | 18 +++++++-------- functions/classes/class.User.php | 2 +- functions/functions.php | 2 +- functions/scripts/pingCheck.php | 4 ++-- .../scripts/remove_offline_addresses.php | 2 +- functions/version.php | 2 +- public/api/controllers/Circuits.php | 2 +- public/api/controllers/Responses.php | 2 +- .../check-connection.php | 2 +- .../admin/circuits/edit-circuit-submit.php | 8 +++---- .../circuits/edit-logical-circuit-submit.php | 2 +- public/app/admin/custom-fields/edit.php | 2 +- .../app/admin/custom-fields/filter-result.php | 2 +- public/app/admin/custom-fields/filter.php | 2 +- public/app/admin/devices/edit-result.php | 2 +- public/app/admin/devices/edit-snmp-result.php | 2 +- public/app/admin/import-export/export-bgp.php | 2 +- .../export-devices-field-select.php | 2 +- .../admin/import-export/export-devices.php | 2 +- .../export-ipaddr-field-select.php | 2 +- .../app/admin/import-export/export-ipaddr.php | 4 ++-- .../export-subnets-field-select.php | 2 +- .../admin/import-export/export-subnets.php | 4 ++-- .../export-vlan-field-select.php | 4 ++-- .../app/admin/import-export/export-vlan.php | 12 +++++----- .../import-export/export-vrf-field-select.php | 2 +- public/app/admin/import-export/export-vrf.php | 4 ++-- .../admin/import-export/import-load-data.php | 2 +- .../import-export/import-recompute-select.php | 2 +- .../app/admin/import-export/import-verify.php | 2 +- public/app/admin/nameservers/edit-result.php | 2 +- public/app/admin/nat/edit-result.php | 2 +- public/app/admin/password-policy/save.php | 2 +- public/app/admin/powerDNS/settings-save.php | 2 +- public/app/admin/requests/edit-result.php | 2 +- .../app/admin/ripe-import/import-subnets.php | 2 +- public/app/admin/sections/index.php | 2 +- public/app/admin/settings/settings-save.php | 4 ++-- public/app/admin/subnets/edit-folder.php | 2 +- public/app/admin/users/ad-search-result.php | 2 +- public/app/admin/users/edit-result.php | 2 +- public/app/admin/users/edit.php | 4 ++-- public/app/admin/users/print-user/account.php | 2 +- .../vaults/download-certificate-execute.php | 4 ++-- .../vaults/edit-item-certificate-result.php | 2 +- .../vaults/edit-item-password-result.php | 2 +- public/app/admin/vaults/edit-result.php | 2 +- .../vaults/fetch_website_certificate.php | 2 +- public/app/admin/version-check/index.php | 2 +- public/app/admin/vlans/edit-domain-result.php | 2 +- public/app/admin/vlans/edit-result.php | 2 +- public/app/admin/vlans/vlans-scan-execute.php | 2 +- public/app/admin/vrf/edit-result.php | 4 ++-- public/app/admin/vrf/vrf-scan-execute.php | 2 +- public/app/dashboard/widgets/changelog.php | 4 ++-- .../app/dashboard/widgets/top10_hosts_lib.php | 4 ++-- public/app/sections/all-sections.php | 2 +- public/app/sections/section-changelog.php | 2 +- .../address-details/address-changelog.php | 2 +- .../address-details/address-details.php | 4 ++-- .../addresses/address-modify-submit.php | 6 ++--- .../subnets/addresses/export-field-select.php | 2 +- .../app/subnets/addresses/export-subnet.php | 4 ++-- .../subnets/addresses/mail-notify-check.php | 2 +- public/app/subnets/addresses/mail-notify.php | 2 +- .../subnets/addresses/print-address-table.php | 4 ++-- public/app/subnets/mail-notify-subnet.php | 2 +- .../scan/subnet-scan-execute-scan-telnet.php | 4 ++-- .../subnet-details/subnet-changelog.php | 6 ++--- .../subnets/subnet-details/subnet-details.php | 4 ++-- .../subnets/subnet-details/subnet-graph.php | 4 ++-- public/app/temp_share/address.php | 2 +- public/app/temp_share/subnet-addresses.php | 4 ++-- public/app/temp_share/subnet-details.php | 2 +- .../app/tools/changelog/changelog-print.php | 6 ++--- public/app/tools/changelog/show-popup.php | 4 ++-- .../customer/objects/ipaddresses.php | 2 +- .../device-details/device-addresses.php | 2 +- public/app/tools/documentation/index.php | 2 +- .../app/tools/locations/single-location.php | 2 +- public/app/tools/logs/detail-popup.php | 2 +- public/app/tools/logs/export.php | 2 +- public/app/tools/logs/show-logs.php | 2 +- public/app/tools/multicast-networks/index.php | 4 ++-- public/app/tools/nat/all_nats.php | 2 +- public/app/tools/nat/nat_details.php | 2 +- .../pstn-prefixes/single-prefix-graph.php | 4 ++-- .../pstn-prefixes/single-prefix-numbers.php | 2 +- .../app/tools/pstn-prefixes/single-prefix.php | 2 +- public/app/tools/racks/print-single-rack.php | 2 +- .../search-results_addresses.php | 4 ++-- .../vaults/vault/vault-details-general.php | 2 +- .../vault/vault-item-details-general.php | 6 ++--- .../vaults/vault/vault-items-certificates.php | 2 +- public/app/tools/vlan/vlan-details.php | 2 +- public/app/tools/vrf/vrf-details.php | 2 +- public/app/vlan/vlan-details.php | 2 +- public/app/vrf/vrf-details.php | 2 +- public/index.php | 2 +- public/install/index.php | 2 +- public/upgrade/index.php | 2 +- 110 files changed, 175 insertions(+), 175 deletions(-) diff --git a/functions/classes/class.Common.php b/functions/classes/class.Common.php index 3b980f3f0..7793ba7eb 100644 --- a/functions/classes/class.Common.php +++ b/functions/classes/class.Common.php @@ -861,7 +861,7 @@ public function shorten_text($text, $chars = 25) { */ public function reformat_mac_address ($mac, $format = 1) { // strip al tags first - $mac = strtolower(str_replace([":",".","-"], "", $mac)); + $mac = strtolower(str_replace([":",".","-"], "", (string) $mac)); // format 4 if ($format==4) { return $mac; @@ -1457,7 +1457,7 @@ public function create_custom_field_input ($field, $object, $timepicker_index, $ // disabled $disabled_text = $disabled ? "readonly" : ""; // replace spaces with | - $field['nameNew'] = str_replace(" ", "___", $field['name']); + $field['nameNew'] = str_replace(" ", "___", (string) $field['name']); // required $required = $field['Null']=="NO" ? "*" : ""; // set default value if adding new object @@ -1637,10 +1637,10 @@ private function create_custom_field_input_input ($field, $object, $disabled_tex // max length $maxlength = 100; if(strpos((string) $field['type'],"varchar")!==false) { - $maxlength = str_replace(["varchar","(",")"],"", $field['type']); + $maxlength = str_replace(["varchar","(",")"],"", (string) $field['type']); } if(strpos((string) $field['type'],"int")!==false) { - $maxlength = str_replace(["int","(",")"],"", $field['type']); + $maxlength = str_replace(["int","(",")"],"", (string) $field['type']); } // print $html[] = ' '. "\n"; @@ -1665,7 +1665,7 @@ public function print_custom_field ($type, $value, $delimiter = false, $replacem // delimiter ? if($delimiter !== false && $replacement !== false) { - $value = str_replace($delimiter, $replacement, $value); + $value = str_replace($delimiter, (string) $replacement, $value); } //booleans diff --git a/functions/classes/class.FirewallZones.php b/functions/classes/class.FirewallZones.php index b178f19d1..d5962e175 100644 --- a/functions/classes/class.FirewallZones.php +++ b/functions/classes/class.FirewallZones.php @@ -1011,10 +1011,10 @@ public function generate_subnet_object ($id) { if (filter_var($this->Subnets->transform_to_dotted($zone->subnet), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { $firewallAddressObject = $firewallAddressObject.$this->Subnets->transform_to_dotted($zone->subnet).'-'.$zone->mask; } elseif (filter_var($this->Subnets->transform_to_dotted($zone->subnet), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { - $firewallAddressObject = $firewallAddressObject.str_replace(':',$firewallZoneSettings['separator'],$this->Subnets->transform_to_dotted($zone->subnet)).'-'.$zone->mask; + $firewallAddressObject = $firewallAddressObject.str_replace(':',(string) $firewallZoneSettings['separator'],(string) $this->Subnets->transform_to_dotted($zone->subnet)).'-'.$zone->mask; } } elseif ($firewallZoneSettings['subnetPatternValues'][$firewallZoneSettings['subnetPattern']] == 'description' ) { - $firewallAddressObject = $firewallAddressObject.str_replace(' ',$firewallZoneSettings['separator'],strtolower((string) $zone->subnetDescription)); + $firewallAddressObject = $firewallAddressObject.str_replace(' ',(string) $firewallZoneSettings['separator'],strtolower((string) $zone->subnetDescription)); } # get subnet information to compare against the changes diff --git a/functions/classes/class.Log.php b/functions/classes/class.Log.php index 1bc9ba303..83e9b964e 100644 --- a/functions/classes/class.Log.php +++ b/functions/classes/class.Log.php @@ -509,8 +509,8 @@ private function syslog_set_priority () { */ private function syslog_format_details () { // replace
      - $this->log_details = str_replace("
      ", ",",$this->log_details); - $this->log_details = str_replace("
      ", ",",$this->log_details); + $this->log_details = str_replace("
      ", ",",(string) $this->log_details); + $this->log_details = str_replace("
      ", ",",(string) $this->log_details); // replace spaces $this->log_details = trim($this->log_details, ","); } @@ -530,8 +530,8 @@ private function syslog_write_changelog ($changelog) { else { $obj_id = $this->object_old['id']; } # format - $changelog = str_replace("
      ", ",",$changelog); - $changelog = str_replace("
      ", ",",$changelog); + $changelog = str_replace("
      ", ",",(string) $changelog); + $changelog = str_replace("
      ", ",",(string) $changelog); # formulate $log = []; @@ -779,7 +779,7 @@ public function write_changelog ($object_type, $action, $result, $old = [], $new if(is_array($log) && sizeof($log)>0) { // reformat null foreach ($log as $k=>$v) { - $log[$k] = str_replace(":
      ", ": /
      ", $v); + $log[$k] = str_replace(":
      ", ": /
      ", (string) $v); } // execute if ($this->log_type == "syslog") { $this->syslog_write_changelog ($log); } @@ -802,7 +802,7 @@ public function write_changelog ($object_type, $action, $result, $old = [], $new */ private function changelog_write_to_db ($changelog) { # log to array - $changelog = str_replace("
      ", "\r\n", $this->array_to_log ($changelog, true)); + $changelog = str_replace("
      ", "\r\n", (string) $this->array_to_log ($changelog, true)); # fetch user id $this->get_active_user_id (); @@ -1406,10 +1406,10 @@ private function changelog_format_master_section_diff ($k, $v) { private function changelog_format_permission_diff ($k, $v) { // get old and compare if (isset($this->object_new['permissions'])) { - $this->object_new['permissions'] = db_json_decode(str_replace("\\", "", $this->object_new['permissions']), true); //Remove / + $this->object_new['permissions'] = db_json_decode(str_replace("\\", "", (string) $this->object_new['permissions']), true); //Remove / } if (isset($this->object_old['permissions'])) { - $this->object_old['permissions'] = db_json_decode(str_replace("\\", "", $this->object_old['permissions']), true); //Remove / + $this->object_old['permissions'] = db_json_decode(str_replace("\\", "", (string) $this->object_old['permissions']), true); //Remove / } # Get all groups: @@ -1473,7 +1473,7 @@ private function changelog_make_booleans ($k, $v) { */ private function changelog_format_permission_change () { # get old and compare - $this->object_new['permissions_change'] = db_json_decode(str_replace("\\", "", $this->object_new['permissions_change']), true); //Remove / + $this->object_new['permissions_change'] = db_json_decode(str_replace("\\", "", (string) $this->object_new['permissions_change']), true); //Remove / # Get all groups: $groups = (array) $this->Tools->fetch_all_objects("userGroups", "g_id"); @@ -1791,8 +1791,8 @@ public function changelog_send_mail ($changelog) { $obj_details = array_merge(['id' => null, 'name' => null, 'description' => null, 'subnet' => null, 'ip_addr' => null, 'mask' => null, 'hostname' => null], (array) $obj_details); # change ip_addr - $this->object_type = str_replace("ip_addr", "address", $this->object_type); - $this->object_type = str_replace("ip_range", "address range", $this->object_type); + $this->object_type = str_replace("ip_addr", "address", (string) $this->object_type); + $this->object_type = str_replace("ip_range", "address range", (string) $this->object_type); # folder if ((isset($this->object_new['isFolder']) && $this->object_new['isFolder'] == "1") || diff --git a/functions/classes/class.PDO.php b/functions/classes/class.PDO.php index 3c5abde9c..a07cdf486 100644 --- a/functions/classes/class.PDO.php +++ b/functions/classes/class.PDO.php @@ -177,7 +177,7 @@ private function load_schema_exceptions() { return; } - $lines = explode("\n", str_replace("\r\n", "\n", fread($fh, 100000))); + $lines = explode("\n", str_replace("\r\n", "\n", (string) fread($fh, 100000))); fclose($fh); $current_table = ""; diff --git a/functions/classes/class.PowerDNS.php b/functions/classes/class.PowerDNS.php index 7e78d485d..4d920e329 100644 --- a/functions/classes/class.PowerDNS.php +++ b/functions/classes/class.PowerDNS.php @@ -1115,7 +1115,7 @@ public function create_default_records ($values, $checkOnly = false) { // content $soa = []; $soa[] = array_shift(pf_explode(";", $values['ns'])); - $soa[] = str_replace ("@", ".", $values['hostmaster']); + $soa[] = str_replace ("@", ".", (string) $values['hostmaster']); $soa[] = date("Ymd")."00"; $soa[] = $this->validate_refresh ($values['refresh']); $soa[] = $this->validate_integer ($values['retry']); diff --git a/functions/classes/class.Rewrite.php b/functions/classes/class.Rewrite.php index 6cc69c844..e1dcaafc6 100644 --- a/functions/classes/class.Rewrite.php +++ b/functions/classes/class.Rewrite.php @@ -133,7 +133,7 @@ private function process_request_uri () { // ignore for direct access if(strpos((string) $_SERVER['REQUEST_URI'], "index.php")===false) { if(BASE!="/") { - $this->uri_parts = array_values(array_filter(pf_explode("/", str_replace(BASE, "", $_SERVER['REQUEST_URI'])))); + $this->uri_parts = array_values(array_filter(pf_explode("/", str_replace((string) BASE, "", (string) $_SERVER['REQUEST_URI'])))); } else { $this->uri_parts = array_values(array_filter(pf_explode("/", $_SERVER['REQUEST_URI']))); diff --git a/functions/classes/class.SNMP.php b/functions/classes/class.SNMP.php index 3166372fe..685934215 100644 --- a/functions/classes/class.SNMP.php +++ b/functions/classes/class.SNMP.php @@ -766,7 +766,7 @@ private function get_vlan_table () { // parse result foreach ($res1 as $k=>$r) { // set number - $k = str_replace($this->snmp_oids['CISCO-VTP-MIB::vtpVlanName'].'.1.', "", $k); + $k = str_replace($this->snmp_oids['CISCO-VTP-MIB::vtpVlanName'].'.1.', "", (string) $k); $k = array_pop(pf_explode(".", $k)); // set value $r = trim(str_replace("\"","",substr((string) $r, strpos((string) $r, ":")+2))); @@ -821,8 +821,8 @@ private function get_vrf_table () { // parse results foreach ($res1 as $k=>$r) { // set name - $k = str_replace($this->snmp_oids['MPLS-VPN-MIB::mplsVpnVrfRouteDistinguisher'].'.', "", $k); - $k = str_replace("\"", "", $k); + $k = str_replace($this->snmp_oids['MPLS-VPN-MIB::mplsVpnVrfRouteDistinguisher'].'.', "", (string) $k); + $k = str_replace("\"", "", (string) $k); $k = $this->decode_mplsVpnVrfName($k); // set rd $r = $this->parse_snmp_result_value ($r); @@ -830,8 +830,8 @@ private function get_vrf_table () { } foreach ($res2 as $k=>$r) { // set name - $k = str_replace($this->snmp_oids['MPLS-VPN-MIB::mplsVpnVrfDescription'].'.', "", $k); - $k = str_replace("\"", "", $k); + $k = str_replace($this->snmp_oids['MPLS-VPN-MIB::mplsVpnVrfDescription'].'.', "", (string) $k); + $k = str_replace("\"", "", (string) $k); $k = $this->decode_mplsVpnVrfName($k); // set descr $r = $this->parse_snmp_result_value ($r); diff --git a/functions/classes/class.Scan.php b/functions/classes/class.Scan.php index 069c1981c..8e9aa1122 100644 --- a/functions/classes/class.Scan.php +++ b/functions/classes/class.Scan.php @@ -720,7 +720,7 @@ public function update_address_tag ($address_id, $tag_id = 2, $old_tag_id = null */ public function telnet_address ($address, $port) { # set all ports - $ports = pf_explode(",", str_replace(";",",",$port)); + $ports = pf_explode(",", str_replace(";",",",(string) $port)); # default response is dead $retval = 1; //try each port until one is alive diff --git a/functions/classes/class.Subnets.php b/functions/classes/class.Subnets.php index 244a529e4..5c0d4da39 100644 --- a/functions/classes/class.Subnets.php +++ b/functions/classes/class.Subnets.php @@ -2719,7 +2719,7 @@ public function find_inactive_hosts ($timelimit = 86400, $limit = 100) { // fetch settings $this->get_settings (); // search - try { $res = $this->Database->getObjectsQuery('ipaddresses', "select ipaddresses.* from `ipaddresses` join subnets on ipaddresses.subnetId = subnets.id where subnets.pingSubnet = 1 and `lastSeen` between ? and ? order by lastSeen desc limit $limit;", [date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s"))-$timelimit), date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s"))-(int) str_replace(";","",strstr((string) $this->settings->pingStatus, ";")))] ); } + try { $res = $this->Database->getObjectsQuery('ipaddresses', "select ipaddresses.* from `ipaddresses` join subnets on ipaddresses.subnetId = subnets.id where subnets.pingSubnet = 1 and `lastSeen` between ? and ? order by lastSeen desc limit $limit;", [date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s"))-$timelimit), date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s"))-(int) str_replace(";","",(string) strstr((string) $this->settings->pingStatus, ";")))] ); } catch (Exception $e) { $this->Result->show("danger", _("Error: ").$e->getMessage()); return false; diff --git a/functions/classes/class.Tools.php b/functions/classes/class.Tools.php index c7b0585b8..a3776605c 100644 --- a/functions/classes/class.Tools.php +++ b/functions/classes/class.Tools.php @@ -552,7 +552,7 @@ public function search_devices ($search_term, $custom_fields = []) { */ public function reformat_IPv4_for_search ($address) { # remove % sign if present - $address = str_replace("%", "", $address); + $address = str_replace("%", "", (string) $address); # we need Addresses class $Addresses = new Addresses ($this->Database); @@ -735,7 +735,7 @@ public function update_POST_custom_fields(string $table, ?string $action, Params if (!empty($custom_fields) && $action != "delete") { foreach ($custom_fields as $field) { # replace possible ___ back to spaces! - $field['nameTest'] = str_replace(" ", "___", $field['name']); + $field['nameTest'] = str_replace(" ", "___", (string) $field['name']); if (isset($POST->{$field['nameTest']})) { $POST->{$field['name']} = $POST->{$field['nameTest']}; } else { @@ -790,7 +790,7 @@ private function fetch_columns ($table) { */ private function read_db_schema() { $fh = fopen(__DIR__ . '/../../db/SCHEMA.sql', 'r'); - return str_replace("\r\n", "\n", fread($fh, 100000)); + return str_replace("\r\n", "\n", (string) fread($fh, 100000)); } /** @@ -1735,11 +1735,11 @@ public function check_latest_phpipam_version ($print_error = false) { // check for latest release foreach ($json->entry as $e) { // releases will be named with numberic values - if (is_numeric(str_replace(["Version", "."], "", $e->title))) { + if (is_numeric(str_replace(["Version", "."], "", (string) $e->title))) { // save $this->phpipam_latest_release = $e; // return - return str_replace("Version", "", $e->title); + return str_replace("Version", "", (string) $e->title); } } // none @@ -2192,7 +2192,7 @@ public function print_nat_table ($n, $is_admin = false, $nat_id = false, $admin $destinations = [""._("None").""]; // description - $n->description = str_replace("\n", "
      ", $n->description); + $n->description = str_replace("\n", "
      ", (string) $n->description); $n->description = !is_blank($n->description) ? "
      $n->description" : ""; // device @@ -2328,7 +2328,7 @@ public function fetch_all_prefixes ($master = false, $recursive = false) { * @return mixed */ public function prefix_normalize ($number) { - return str_replace(["+", " ", "-"], "", $number); + return str_replace(["+", " ", "-"], "", (string) $number); } /** @@ -2584,7 +2584,7 @@ public function print_menu_prefixes($user, $prefixes, $custom_fields) { //text elseif ($field['type'] == "text") { if (!is_blank($option[$field['name']])) { - $html[] = ""; + $html[] = ""; } else { $html[] = ""; } @@ -3579,7 +3579,7 @@ public function get_translation_version ($code) { //check for version $ver = shell_exec("grep 'Project-Id-Version:' " . __DIR__ . "/../locale/$code/LC_MESSAGES/phpipam.po"); //parse - $ver = str_replace(["Project-Id-Version:", " ", '"', "#",'\n', ":"], "", $ver); + $ver = str_replace(["Project-Id-Version:", " ", '"', "#",'\n', ":"], "", (string) $ver); //return version return $ver; } diff --git a/functions/classes/class.User.php b/functions/classes/class.User.php index deb9727e8..7b926b514 100644 --- a/functions/classes/class.User.php +++ b/functions/classes/class.User.php @@ -1037,7 +1037,7 @@ private function directory_connect ($authparams) { $dirparams['base_dn'] = @$authparams['base_dn']; $dirparams['ad_port'] = @$authparams['ad_port']; $dirparams['account_suffix'] = @$authparams['account_suffix']; - $dirparams['domain_controllers'] = pf_explode(";", str_replace(" ", "", $authparams['domain_controllers'])); + $dirparams['domain_controllers'] = pf_explode(";", str_replace(" ", "", (string) $authparams['domain_controllers'])); // set ssl and tls separate for ldap and AD if ($this->ldap) { // set ssl and tls diff --git a/functions/functions.php b/functions/functions.php index 54d3f7332..35a539654 100644 --- a/functions/functions.php +++ b/functions/functions.php @@ -3,7 +3,7 @@ // auto-set base if not already defined if(!defined('BASE')) { $root = substr((string) $_SERVER['DOCUMENT_ROOT'],-1)=="/" ? substr((string) $_SERVER['DOCUMENT_ROOT'],0,-1) : $_SERVER['DOCUMENT_ROOT']; // fix for missing / in some environments - define('BASE', substr(str_replace($root, "", realpath(__DIR__ . '/../public/app')), 0, -3)); + define('BASE', substr(str_replace((string) $root, "", (string) realpath(__DIR__ . '/../public/app')), 0, -3)); } // global and missing functions diff --git a/functions/scripts/pingCheck.php b/functions/scripts/pingCheck.php index ff586b077..5966ee135 100755 --- a/functions/scripts/pingCheck.php +++ b/functions/scripts/pingCheck.php @@ -464,10 +464,10 @@ //content $content[] = "
      "; - $content[] = " "; + $content[] = " "; $content[] = " "; $content[] = " "; - $content[] = " "; + $content[] = " "; $content[] = " "; $content[] = " "; $content[] = ""; diff --git a/functions/scripts/remove_offline_addresses.php b/functions/scripts/remove_offline_addresses.php index 4e4a542eb..ec337fdd6 100644 --- a/functions/scripts/remove_offline_addresses.php +++ b/functions/scripts/remove_offline_addresses.php @@ -127,7 +127,7 @@ $content[] = " "; $content[] = " "; $content[] = " "; - $content[] = " "; + $content[] = " "; $content[] = " "; $content[] = ""; diff --git a/functions/version.php b/functions/version.php index 85d963af9..c259a3127 100644 --- a/functions/version.php +++ b/functions/version.php @@ -14,7 +14,7 @@ function get_dbversion() { require __DIR__ . '/upgrade_queries.php'; $upgrade_keys = array_keys($upgrade_queries); - return str_replace(VERSION.".", "", end($upgrade_keys)); + return str_replace(VERSION.".", "", (string) end($upgrade_keys)); } if(!defined('DBVERSION')) diff --git a/public/api/controllers/Circuits.php b/public/api/controllers/Circuits.php index dd26279d9..f5dae49bc 100644 --- a/public/api/controllers/Circuits.php +++ b/public/api/controllers/Circuits.php @@ -433,7 +433,7 @@ private function validate_cid ($action, $old_object) { private function validate_circuit_type ($action="add") { if(isset($this->_params->type)) { $type_desc = $this->Database->getFieldInfo ("circuits", "type"); - $all_types = pf_explode(",", str_replace(["enum","(",")","'"], "",$type_desc->Type)); + $all_types = pf_explode(",", str_replace(["enum","(",")","'"], "",(string) $type_desc->Type)); if(!in_array($this->_params->type, $all_types)) { $this->Response->throw_exception(400, "Invalid circuit type"); } } else { diff --git a/public/api/controllers/Responses.php b/public/api/controllers/Responses.php index d105f3d88..74fb4c759 100644 --- a/public/api/controllers/Responses.php +++ b/public/api/controllers/Responses.php @@ -264,7 +264,7 @@ private function array_to_xml(SimpleXMLElement $object, array $data) { // loop through values foreach ($data as $key => $value) { // if spaces exist in key replace them with underscores - if(strpos((string) $key, " ")>0) { $key = str_replace(" ", "_", $key); } + if(strpos((string) $key, " ")>0) { $key = str_replace(" ", "_", (string) $key); } // if key is numeric append item if(is_numeric($key)) $key = "item".$key; diff --git a/public/app/admin/authentication-methods/check-connection.php b/public/app/admin/authentication-methods/check-connection.php index 5798386aa..56826c44f 100644 --- a/public/app/admin/authentication-methods/check-connection.php +++ b/public/app/admin/authentication-methods/check-connection.php @@ -27,7 +27,7 @@ # AD? if($auth_settings->type=="AD" || $auth_settings->type=="LDAP" || $auth_settings->type=="NetIQ") { # set controllers - $controllers = pf_explode(";", str_replace(" ", "", $parameters->domain_controllers)); + $controllers = pf_explode(";", str_replace(" ", "", (string) $parameters->domain_controllers)); //open connection try { diff --git a/public/app/admin/circuits/edit-circuit-submit.php b/public/app/admin/circuits/edit-circuit-submit.php index 3f48b57f3..8a0fedb93 100644 --- a/public/app/admin/circuits/edit-circuit-submit.php +++ b/public/app/admin/circuits/edit-circuit-submit.php @@ -68,14 +68,14 @@ $POST->location1 = 0; } elseif(strpos((string) $POST->device1,"device_")!==false) { - $deviceId = str_replace("device_", "", $POST->device1); + $deviceId = str_replace("device_", "", (string) $POST->device1); if($Tools->fetch_object("devices","id",$deviceId)===false) { $Result->show("danger", _('Invalid device A').'!', true); } // save $POST->device1 = $deviceId; $POST->location1 = 0; } else { - $locationId = str_replace("location_", "", $POST->device1); + $locationId = str_replace("location_", "", (string) $POST->device1); if($Tools->fetch_object("locations","id",$locationId)===false) { $Result->show("danger", _('Invalid location A').'!', true); } // save $POST->device1 = 0; @@ -87,14 +87,14 @@ $POST->location2 = 0; } elseif(strpos((string) $POST->device2,"device_")!==false) { - $deviceId = str_replace("device_", "", $POST->device2); + $deviceId = str_replace("device_", "", (string) $POST->device2); if($Tools->fetch_object("devices","id",$deviceId)===false) { $Result->show("danger", _('Invalid device B').'!', true); } // save $POST->device2 = $deviceId; $POST->location2 = 0; } else { - $locationId = str_replace("location_", "", $POST->device2); + $locationId = str_replace("location_", "", (string) $POST->device2); if($Tools->fetch_object("locations","id",$locationId)===false) { $Result->show("danger", _('Invalid location B').'!', true); } // save $POST->device2 = 0; diff --git a/public/app/admin/circuits/edit-logical-circuit-submit.php b/public/app/admin/circuits/edit-logical-circuit-submit.php index fa503507b..1841dd889 100644 --- a/public/app/admin/circuits/edit-logical-circuit-submit.php +++ b/public/app/admin/circuits/edit-logical-circuit-submit.php @@ -39,7 +39,7 @@ # Validate to make sure there aren't duplicates of the same circuit in the list of circuit ids # Create list of member circuit IDs for mapping -$POST->circuit_list = str_replace("undefined.", "", $POST->circuit_list); +$POST->circuit_list = str_replace("undefined.", "", (string) $POST->circuit_list); $id_list = $POST->circuit_list!=="" ? pf_explode("." , rtrim((string) $POST->circuit_list,".")) : []; if(sizeof($id_list ) != sizeof(array_unique($id_list))){ $Result->show("danger", _('Remove duplicates of circuit').'!', true); } if($POST->action == "add" && sizeof($id_list) == 0){ $Result->show("danger", _('No circuits selected').'!', true); } diff --git a/public/app/admin/custom-fields/edit.php b/public/app/admin/custom-fields/edit.php index 67ae54a9c..2983aed3b 100755 --- a/public/app/admin/custom-fields/edit.php +++ b/public/app/admin/custom-fields/edit.php @@ -104,7 +104,7 @@ function check_name_whitespace () { $mTypes = $Admin->valid_custom_field_types(); //reformat old type $oldMType = strstr((string) @$fieldval['Type'], "(", true); - $oldMSize = str_replace(["(",")"], "",strstr((string) @$fieldval['Type'], "(", false)); + $oldMSize = str_replace(["(",")"], "",(string) strstr((string) @$fieldval['Type'], "(", false)); //exceptions if(@$fieldval['Type']=="text" || @$fieldval['Type']=="date" || @$fieldval['Type']=="datetime" || @$fieldval['Type']=="set" || @$fieldval['Type']=="enum") { $oldMType = @$fieldval['Type']; } diff --git a/public/app/admin/custom-fields/filter-result.php b/public/app/admin/custom-fields/filter-result.php index 2627b8aa8..4325da8a9 100755 --- a/public/app/admin/custom-fields/filter-result.php +++ b/public/app/admin/custom-fields/filter-result.php @@ -33,7 +33,7 @@ /* anything to write? */ if(sizeof($POST)>0) { foreach($POST as $k=>$v) { - $kTest = str_replace("___", " ", $k); + $kTest = str_replace("___", " ", (string) $k); $filtered_fields[] = array_key_exists($kTest, $fields) ? $kTest : $k; } } diff --git a/public/app/admin/custom-fields/filter.php b/public/app/admin/custom-fields/filter.php index b8ae3b4fd..83f0e16ad 100755 --- a/public/app/admin/custom-fields/filter.php +++ b/public/app/admin/custom-fields/filter.php @@ -62,7 +62,7 @@ $c) { - $kNew = str_replace(" ", "___", $k); + $kNew = str_replace(" ", "___", (string) $k); print ""; # select print " "; $custom_fields_boxes.= " "; } diff --git a/public/app/admin/import-export/export-devices.php b/public/app/admin/import-export/export-devices.php index ae1b7779f..517945fc5 100644 --- a/public/app/admin/import-export/export-devices.php +++ b/public/app/admin/import-export/export-devices.php @@ -51,7 +51,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //change spaces to "___" so it can be used as element id - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); array_push ( $fields, $myField['nameTemp'] ); } } diff --git a/public/app/admin/import-export/export-ipaddr-field-select.php b/public/app/admin/import-export/export-ipaddr-field-select.php index b459c7240..a91f5cd25 100644 --- a/public/app/admin/import-export/export-ipaddr-field-select.php +++ b/public/app/admin/import-export/export-ipaddr-field-select.php @@ -57,7 +57,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //change spaces to "___" so it can be used as element id - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); $custom_fields_names.= " "; $custom_fields_boxes.= " "; } diff --git a/public/app/admin/import-export/export-ipaddr.php b/public/app/admin/import-export/export-ipaddr.php index f57a0964b..5073c50b5 100644 --- a/public/app/admin/import-export/export-ipaddr.php +++ b/public/app/admin/import-export/export-ipaddr.php @@ -162,7 +162,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( $GET->{$myField['nameTemp']} == "on" ) { $worksheet->write($curRow, $curColumn, $myField['name'] ,$format_header); @@ -282,7 +282,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( $GET->{$myField['nameTemp']} == "on") { $worksheet->write($curRow, $curColumn, $ip[$myField['name']], $format_text); diff --git a/public/app/admin/import-export/export-subnets-field-select.php b/public/app/admin/import-export/export-subnets-field-select.php index 5f46d5509..659ffcacf 100644 --- a/public/app/admin/import-export/export-subnets-field-select.php +++ b/public/app/admin/import-export/export-subnets-field-select.php @@ -57,7 +57,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //change spaces to "___" so it can be used as element id - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); $custom_fields_names.= " "; $custom_fields_boxes.= " "; } diff --git a/public/app/admin/import-export/export-subnets.php b/public/app/admin/import-export/export-subnets.php index c826aaf17..d3d48210d 100644 --- a/public/app/admin/import-export/export-subnets.php +++ b/public/app/admin/import-export/export-subnets.php @@ -135,7 +135,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( $GET->{$myField['nameTemp']} == "on" ) { $worksheet->write($curRow, $curColumn, $myField['name'] ,$format_header); @@ -247,7 +247,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( $GET->{$myField['nameTemp']} == "on" ) { $worksheet->write($curRow, $curColumn, $subnet[$myField['name']], $format_text); diff --git a/public/app/admin/import-export/export-vlan-field-select.php b/public/app/admin/import-export/export-vlan-field-select.php index 104c1a4c4..d0c8d5a5a 100644 --- a/public/app/admin/import-export/export-vlan-field-select.php +++ b/public/app/admin/import-export/export-vlan-field-select.php @@ -35,7 +35,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //change spaces to "___" so it can be used as element id - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); $custom_fields_names.= " "; $custom_fields_boxes.= " "; } @@ -94,7 +94,7 @@ print " "; print " "; + print " "; print " \n"; } } diff --git a/public/app/admin/import-export/export-vlan.php b/public/app/admin/import-export/export-vlan.php index 1748ed8e5..017407923 100644 --- a/public/app/admin/import-export/export-vlan.php +++ b/public/app/admin/import-export/export-vlan.php @@ -92,7 +92,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( $GET->{$myField['nameTemp']} == "on") { $worksheet->write($curRow, $curColumn, $myField['name'] ,$format_header); @@ -110,8 +110,8 @@ //cast $vlan_domain = (array) $vlan_domain; - $vldn = str_replace(" ", "_",$vlan_domain['name']); - $vldn = str_replace(".", "_",$vldn); + $vldn = str_replace(" ", "_",(string) $vlan_domain['name']); + $vldn = str_replace(".", "_",(string) $vldn); if ($GET->{'exportDomain__'.$vldn} == "on") { // get all VLANs in VLAN domain @@ -149,7 +149,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( $GET->{$myField['nameTemp']} == "on" ) { $custom_value = isset($vlan[$myField['name']]) ? $vlan[$myField['name']] : ''; @@ -189,8 +189,8 @@ //cast $vlan_domain = (array) $vlan_domain; - $vldn = str_replace(" ", "_",$vlan_domain['name']); - $vldn = str_replace(".", "_",$vldn); + $vldn = str_replace(" ", "_",(string) $vlan_domain['name']); + $vldn = str_replace(".", "_",(string) $vldn); if( $GET->{'exportDomain__'. $vldn} == "on" ) { $worksheet_domains->write($curRow, $curColumn, $vlan_domain['name'], $format_text); diff --git a/public/app/admin/import-export/export-vrf-field-select.php b/public/app/admin/import-export/export-vrf-field-select.php index 0aae14723..339730394 100644 --- a/public/app/admin/import-export/export-vrf-field-select.php +++ b/public/app/admin/import-export/export-vrf-field-select.php @@ -30,7 +30,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //change spaces to "___" so it can be used as element id - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); $custom_fields_names.= " "; $custom_fields_boxes.= " "; } diff --git a/public/app/admin/import-export/export-vrf.php b/public/app/admin/import-export/export-vrf.php index b400989c9..c2f009e07 100644 --- a/public/app/admin/import-export/export-vrf.php +++ b/public/app/admin/import-export/export-vrf.php @@ -86,7 +86,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( $GET->{$myField['nameTemp']} == "on") { $worksheet->write($curRow, $curColumn, $myField['name'] ,$format_header); $curColumn++; @@ -121,7 +121,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( $GET->{$myField['nameTemp']} == "on") { $worksheet->write($curRow, $curColumn, $vlan[$myField['name']], $format_text); $curColumn++; diff --git a/public/app/admin/import-export/import-load-data.php b/public/app/admin/import-export/import-load-data.php index 3086e964b..886378c9e 100644 --- a/public/app/admin/import-export/import-load-data.php +++ b/public/app/admin/import-export/import-load-data.php @@ -62,7 +62,7 @@ # set delimiter $Tools->set_csv_delimiter ($line); $row++; - $line = str_replace( ["\r\n","\r","\n"] , "" , $line); //remove line break + $line = str_replace( ["\r\n","\r","\n"] , "" , (string) $line); //remove line break $cols = str_getcsv ($line, $Tools->csv_delimiter, '"', "\\"); foreach ($cols as $val) { $col++; diff --git a/public/app/admin/import-export/import-recompute-select.php b/public/app/admin/import-export/import-recompute-select.php index 875fb88f6..1fa30aeab 100644 --- a/public/app/admin/import-export/import-recompute-select.php +++ b/public/app/admin/import-export/import-recompute-select.php @@ -63,7 +63,7 @@ $last_master = $section['id']; } $section_rows.= ""; - $section_rows.= ""; + $section_rows.= ""; $section_rows.= ""; $section_rows.= ""; $section_rows.= ""; diff --git a/public/app/admin/import-export/import-verify.php b/public/app/admin/import-export/import-verify.php index 3f65f8b93..03a93f4fa 100644 --- a/public/app/admin/import-export/import-verify.php +++ b/public/app/admin/import-export/import-verify.php @@ -69,7 +69,7 @@ $Tools->set_csv_delimiter ($data); /* format file */ - $data = str_replace( ["\r\n","\r","\n"] , "" , $data); //remove line break + $data = str_replace( ["\r\n","\r","\n"] , "" , (string) $data); //remove line break $data = str_getcsv ($data, $Tools->csv_delimiter, '"', "\\"); foreach ($data as $col) { diff --git a/public/app/admin/nameservers/edit-result.php b/public/app/admin/nameservers/edit-result.php index fa1a87e72..fc342d963 100755 --- a/public/app/admin/nameservers/edit-result.php +++ b/public/app/admin/nameservers/edit-result.php @@ -58,7 +58,7 @@ $temp = []; foreach($POST as $key=>$line) { if (!is_blank(strstr((string) $key,"section-"))) { - $key2 = str_replace("section-", "", $key); + $key2 = str_replace("section-", "", (string) $key); $temp[] = $key2; unset($POST->{$key}); } diff --git a/public/app/admin/nat/edit-result.php b/public/app/admin/nat/edit-result.php index 806d27aa8..f4bf94309 100644 --- a/public/app/admin/nat/edit-result.php +++ b/public/app/admin/nat/edit-result.php @@ -71,7 +71,7 @@ if(sizeof($custom) > 0) { foreach($custom as $myField) { # replace possible ___ back to spaces! - $myField['nameTest'] = str_replace(" ", "___", $myField['name']); + $myField['nameTest'] = str_replace(" ", "___", (string) $myField['name']); if(isset($POST->{$myField['nameTest']})) { $values[$myField['name']] = $POST->{$myField['nameTest']};} } } diff --git a/public/app/admin/password-policy/save.php b/public/app/admin/password-policy/save.php index 8d50f6be5..9f733c565 100644 --- a/public/app/admin/password-policy/save.php +++ b/public/app/admin/password-policy/save.php @@ -52,7 +52,7 @@ } # symbols if (!is_blank($POST->allowedSymbols)) { - $POST->allowedSymbols = str_replace(" ", "", $POST->allowedSymbols); + $POST->allowedSymbols = str_replace(" ", "", (string) $POST->allowedSymbols); $passwordPolicy['allowedSymbols'] = $POST->allowedSymbols; } diff --git a/public/app/admin/powerDNS/settings-save.php b/public/app/admin/powerDNS/settings-save.php index d39d4232c..cdbbe85fb 100644 --- a/public/app/admin/powerDNS/settings-save.php +++ b/public/app/admin/powerDNS/settings-save.php @@ -34,7 +34,7 @@ // formulate json $values = new StdClass (); -$values->host = trim(str_replace(",", ";", $POST->host)); +$values->host = trim(str_replace(",", ";", (string) $POST->host)); $values->name = $POST->name; $values->username = $POST->username; $values->password = $POST->password; diff --git a/public/app/admin/requests/edit-result.php b/public/app/admin/requests/edit-result.php index ea5250676..a800dba30 100755 --- a/public/app/admin/requests/edit-result.php +++ b/public/app/admin/requests/edit-result.php @@ -97,7 +97,7 @@ $tmp['vlan'] = $vlan==false ? "" : $vlan->number." - ".$vlan->description; //set dns $dns = $Tools->fetch_object ("nameservers", "id", $subnet['nameserverId']); - $tmp['dns'] = $dns==false ? "" : $dns->description."
      ".str_replace(";", ", ", $dns->namesrv1); + $tmp['dns'] = $dns==false ? "" : $dns->description."
      ".str_replace(";", ", ", (string) $dns->namesrv1); $POST->read($tmp); diff --git a/public/app/admin/ripe-import/import-subnets.php b/public/app/admin/ripe-import/import-subnets.php index 34333cba8..73a38b3d6 100755 --- a/public/app/admin/ripe-import/import-subnets.php +++ b/public/app/admin/ripe-import/import-subnets.php @@ -36,7 +36,7 @@ # format and verify each record foreach($allSubnets as $subnet) { //get sequential number - $m = str_replace("subnet-", "", $subnet); + $m = str_replace("subnet-", "", (string) $subnet); //reformat subnet $_temp = $Subnets->cidr_network_and_mask($POST->{'subnet-' . $m}); diff --git a/public/app/admin/sections/index.php b/public/app/admin/sections/index.php index fe69a3b0f..06be60c41 100755 --- a/public/app/admin/sections/index.php +++ b/public/app/admin/sections/index.php @@ -69,7 +69,7 @@ print '
      '. "\n"; - print ' '. "\n"; + print ' '. "\n"; print ' '. "\n"; //master Section if($section['masterSection']!=0) { diff --git a/public/app/admin/settings/settings-save.php b/public/app/admin/settings/settings-save.php index 09a8d5409..3d21482ba 100755 --- a/public/app/admin/settings/settings-save.php +++ b/public/app/admin/settings/settings-save.php @@ -32,8 +32,8 @@ else { $POST->siteURL = "http://".$POST->siteURL; } //verify ping status fields -$POST->pingStatus = str_replace(" ", "", $POST->pingStatus); //remove possible spaces -$POST->pingStatus = str_replace(",", ";", $POST->pingStatus); //change possible , for ; +$POST->pingStatus = str_replace(" ", "", (string) $POST->pingStatus); //remove possible spaces +$POST->pingStatus = str_replace(",", ";", (string) $POST->pingStatus); //change possible , for ; $statuses = pf_explode(";", $POST->pingStatus); if(sizeof($statuses)!=2) { $Result->show("danger", _("Invalid ping status intervals"), true); } diff --git a/public/app/admin/subnets/edit-folder.php b/public/app/admin/subnets/edit-folder.php index 3151f9c1f..297736b39 100755 --- a/public/app/admin/subnets/edit-folder.php +++ b/public/app/admin/subnets/edit-folder.php @@ -137,7 +137,7 @@ print ""; foreach($custom_fields as $field) { # retain newlines - $folder_old_details[$field['name']] = str_replace("\n", "\\n", @$folder_old_details[$field['name']]); + $folder_old_details[$field['name']] = str_replace("\n", "\\n", (string) @$folder_old_details[$field['name']]); # set default value ! if ($POST->action=="add") { $folder_old_details[$field['name']] = $field['Default']; } diff --git a/public/app/admin/users/ad-search-result.php b/public/app/admin/users/ad-search-result.php index 21c5c1c96..4b42e923e 100755 --- a/public/app/admin/users/ad-search-result.php +++ b/public/app/admin/users/ad-search-result.php @@ -42,7 +42,7 @@ $options = [ 'base_dn'=>$params->base_dn, 'account_suffix'=>$params->account_suffix, - 'domain_controllers'=>pf_explode(";", str_replace(" ", "", $params->domain_controllers)), + 'domain_controllers'=>pf_explode(";", str_replace(" ", "", (string) $params->domain_controllers)), 'ad_port'=>$params->ad_port ]; diff --git a/public/app/admin/users/edit-result.php b/public/app/admin/users/edit-result.php index 16270cb3e..16743ed0f 100755 --- a/public/app/admin/users/edit-result.php +++ b/public/app/admin/users/edit-result.php @@ -159,7 +159,7 @@ $passkeys_to_remove = []; foreach($POST as $key=>$post) { if(substr($key, 0,15) == "delete-passkey-") { - $passkeys_to_remove[] = str_replace("delete-passkey-", "", $key); + $passkeys_to_remove[] = str_replace("delete-passkey-", "", (string) $key); } } diff --git a/public/app/admin/users/edit.php b/public/app/admin/users/edit.php index e061bd6fd..46034bf7a 100755 --- a/public/app/admin/users/edit.php +++ b/public/app/admin/users/edit.php @@ -370,7 +370,7 @@ // Set default module permissions foreach ($perm_modules as $key => $name) { - $module_permissions[str_replace("perm_", "", $key)] = "0"; + $module_permissions[str_replace("perm_", "", (string) $key)] = "0"; } // Merge with user module permissions $user_module_permissions = db_json_decode($user->module_permissions, true); @@ -386,7 +386,7 @@ print " "; print " "; print " '. "\n"; - print ' '. "\n"; + print ' '. "\n"; print ' '. "\n"; //master Section if($section['masterSection']!=0) { diff --git a/public/app/sections/section-changelog.php b/public/app/sections/section-changelog.php index 9aacb0a34..efb63894c 100755 --- a/public/app/sections/section-changelog.php +++ b/public/app/sections/section-changelog.php @@ -39,7 +39,7 @@ # cast $l = (array) $l; # format diff - $l['cdiff'] = str_replace("\n", "
      ", $l['cdiff']); + $l['cdiff'] = str_replace("\n", "
      ", (string) $l['cdiff']); # set class for badge if($l['cresult']=="success") { $bclass='alert-success'; } diff --git a/public/app/subnets/addresses/address-details/address-changelog.php b/public/app/subnets/addresses/address-details/address-changelog.php index 5ec62d84d..333d937f3 100644 --- a/public/app/subnets/addresses/address-details/address-changelog.php +++ b/public/app/subnets/addresses/address-details/address-changelog.php @@ -42,7 +42,7 @@ foreach($clogs as $l) { $l = (array) $l; # format diff - $l['cdiff'] = str_replace("\n", "
      ", $l['cdiff']); + $l['cdiff'] = str_replace("\n", "
      ", (string) $l['cdiff']); # set class for badge if($l['cresult']=="success") { $bclass='alert-success'; } diff --git a/public/app/subnets/addresses/address-details/address-details.php b/public/app/subnets/addresses/address-details/address-details.php index 7c28aa587..0e0ccea40 100644 --- a/public/app/subnets/addresses/address-details/address-details.php +++ b/public/app/subnets/addresses/address-details/address-details.php @@ -15,7 +15,7 @@ # check if it exists, otherwise print error if(sizeof($address)>1) { - $address['description'] = str_replace("\n", "
      ", $address['description']); + $address['description'] = str_replace("\n", "
      ", (string) $address['description']); print "
      "._($perm_names[$key])."".$User->print_permission_badge($user[$key])."
      ip_addr)){ $first = $POST->ip_addr; }else{ diff --git a/public/app/tools/subnet-masks/popup.php b/public/app/tools/subnet-masks/popup.php index 723a5ba02..d55746a2d 100644 --- a/public/app/tools/subnet-masks/popup.php +++ b/public/app/tools/subnet-masks/popup.php @@ -5,7 +5,7 @@ */ /* functions */ -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # database object $Database = new Database_PDO; diff --git a/public/app/tools/temp-shares/delete-result.php b/public/app/tools/temp-shares/delete-result.php index 270d1849c..69946e48b 100644 --- a/public/app/tools/temp-shares/delete-result.php +++ b/public/app/tools/temp-shares/delete-result.php @@ -5,7 +5,7 @@ *************************************/ /* functions */ -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize user object $Database = new Database_PDO; diff --git a/public/app/tools/temp-shares/edit-result.php b/public/app/tools/temp-shares/edit-result.php index a9355478f..c7b967d35 100644 --- a/public/app/tools/temp-shares/edit-result.php +++ b/public/app/tools/temp-shares/edit-result.php @@ -5,7 +5,7 @@ *************************************/ /* functions */ -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize user object $Database = new Database_PDO; diff --git a/public/app/tools/temp-shares/edit.php b/public/app/tools/temp-shares/edit.php index 19dccfe7e..a5eb4e5fa 100644 --- a/public/app/tools/temp-shares/edit.php +++ b/public/app/tools/temp-shares/edit.php @@ -5,7 +5,7 @@ *************************************************/ /* functions */ -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize user object $Database = new Database_PDO; diff --git a/public/app/tools/user-menu/2fa_save.php b/public/app/tools/user-menu/2fa_save.php index 8b0fba94f..555ea10bb 100644 --- a/public/app/tools/user-menu/2fa_save.php +++ b/public/app/tools/user-menu/2fa_save.php @@ -7,7 +7,7 @@ */ # include required scripts -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize required objects $Database = new Database_PDO; diff --git a/public/app/tools/user-menu/passkey_challenge.php b/public/app/tools/user-menu/passkey_challenge.php index 4579606b0..7c65d0c34 100644 --- a/public/app/tools/user-menu/passkey_challenge.php +++ b/public/app/tools/user-menu/passkey_challenge.php @@ -5,7 +5,7 @@ # // phpipam stuff -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize required objects - to start session $Database = new Database_PDO; diff --git a/public/app/tools/user-menu/passkey_edit.php b/public/app/tools/user-menu/passkey_edit.php index e4527fb8b..77d9faaa6 100644 --- a/public/app/tools/user-menu/passkey_edit.php +++ b/public/app/tools/user-menu/passkey_edit.php @@ -6,7 +6,7 @@ */ # include required scripts -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize user object $Database = new Database_PDO; diff --git a/public/app/tools/user-menu/passkey_edit_result.php b/public/app/tools/user-menu/passkey_edit_result.php index bfac1da8f..e67e03a93 100644 --- a/public/app/tools/user-menu/passkey_edit_result.php +++ b/public/app/tools/user-menu/passkey_edit_result.php @@ -7,7 +7,7 @@ */ # include required scripts -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize required objects $Database = new Database_PDO; diff --git a/public/app/tools/user-menu/passkey_save.php b/public/app/tools/user-menu/passkey_save.php index 3b2bf4417..f748884c0 100644 --- a/public/app/tools/user-menu/passkey_save.php +++ b/public/app/tools/user-menu/passkey_save.php @@ -7,7 +7,7 @@ */ // phpipam stuff -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize required objects $Database = new Database_PDO; diff --git a/public/app/tools/user-menu/user-edit.php b/public/app/tools/user-menu/user-edit.php index 572b78b23..51df66325 100755 --- a/public/app/tools/user-menu/user-edit.php +++ b/public/app/tools/user-menu/user-edit.php @@ -9,7 +9,7 @@ header('Content-Type: text/html; charset=utf-8'); # include required scripts -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize required objects $Database = new Database_PDO; diff --git a/public/app/tools/user-menu/user-widgets-set.php b/public/app/tools/user-menu/user-widgets-set.php index ea8f30809..626cb3c8b 100755 --- a/public/app/tools/user-menu/user-widgets-set.php +++ b/public/app/tools/user-menu/user-widgets-set.php @@ -7,7 +7,7 @@ */ # include required scripts -require_once( __DIR__ . '/../../../functions/functions.php' ); +require_once __DIR__ . '/../../../../functions/functions.php'; # initialize required objects $Database = new Database_PDO; diff --git a/public/app/upgrade/upgrade-execute.php b/public/app/upgrade/upgrade-execute.php index 68290e6ea..bc735012f 100755 --- a/public/app/upgrade/upgrade-execute.php +++ b/public/app/upgrade/upgrade-execute.php @@ -3,7 +3,7 @@ /* ---------- Upgrade database ---------- */ /* functions */ -require_once( __DIR__ . '/../../functions/functions.php' ); +require_once __DIR__ . '/../../../functions/functions.php'; # initialize user object $Database = new Database_PDO; diff --git a/public/functions/functions.php b/public/functions/functions.php deleted file mode 100755 index 17ff91ac0..000000000 --- a/public/functions/functions.php +++ /dev/null @@ -1,2 +0,0 @@ -
      -- config.php file missing! Please copy default config file `config.dist.php` to `config.php` and set configuration! --

      phpipam installation documentation: http://phpipam.net/documents/installation/"); } diff --git a/public/install/index.php b/public/install/index.php index 9a53ef9f0..353cc6053 100644 --- a/public/install/index.php +++ b/public/install/index.php @@ -1,6 +1,6 @@ From 891ccad0f67d5f94a99e5a02bd80a82527be5dee Mon Sep 17 00:00:00 2001 From: Gary Date: Fri, 1 May 2026 22:23:14 +0100 Subject: [PATCH 17/28] Bugfix: Rector PHP fixes * NullToStrictStringFuncCallArgRector (json_decode) --- public/app/login/passkey_login_check.php | 2 +- public/app/tools/user-menu/passkey_save.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/login/passkey_login_check.php b/public/app/login/passkey_login_check.php index 3b6a13b91..f3c885d9f 100644 --- a/public/app/login/passkey_login_check.php +++ b/public/app/login/passkey_login_check.php @@ -31,7 +31,7 @@ // process request json $json = file_get_contents('php://input'); -$data = json_decode($json, true); +$data = json_decode((string) $json, true); // parser $parser = new ArrayBufferResponseParser(); diff --git a/public/app/tools/user-menu/passkey_save.php b/public/app/tools/user-menu/passkey_save.php index f748884c0..4e1b5406a 100644 --- a/public/app/tools/user-menu/passkey_save.php +++ b/public/app/tools/user-menu/passkey_save.php @@ -30,7 +30,7 @@ # process request $json = file_get_contents('php://input'); -$data = json_decode($json, true); +$data = json_decode((string) $json, true); // // we dont try to catch exceptions, as messages are unclear, check webserver/php-fpm error_logs From 5ce422d1595216337a25a43cc063a1e4d07d5ef5 Mon Sep 17 00:00:00 2001 From: Gary Date: Fri, 1 May 2026 22:26:23 +0100 Subject: [PATCH 18/28] Bugfix: Rector PHP fixes * NullToStrictStringFuncCallArgRector (ltrim, rtrim) --- functions/scripts/pingCheck.php | 4 ++-- functions/scripts/remove_offline_addresses.php | 2 +- public/app/admin/circuits/edit-logical-circuit-submit.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/scripts/pingCheck.php b/functions/scripts/pingCheck.php index 957db564e..ff586b077 100755 --- a/functions/scripts/pingCheck.php +++ b/functions/scripts/pingCheck.php @@ -464,10 +464,10 @@ //content $content[] = "
      $Subnets->mail_font_style_href " . $Subnets->transform_to_dotted($change['ip_addr']) . "$Subnets->mail_font_style_href " . $Subnets->transform_to_dotted($change['ip_addr']) . "$Subnets->mail_font_style $change[description]$Subnets->mail_font_style_href $change[hostname]$Subnets->mail_font_style_href " . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . "" . $subnet->description . "$Subnets->mail_font_style_href " . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . "" . $subnet->description . "$Subnets->mail_font_style $ago$Subnets->mail_font_style $oldStatus > $newStatus
      $Subnets->mail_font_style ".$Subnets->transform_to_dotted($change['ip_addr'])."$Subnets->mail_font_style $change[description]$Subnets->mail_font_style_href $change[hostname]$Subnets->mail_font_style_href ".$Subnets->transform_to_dotted($subnet->subnet)."/".$subnet->mask."".$subnet->description."$Subnets->mail_font_style_href ".$Subnets->transform_to_dotted($subnet->subnet)."/".$subnet->mask."".$subnet->description."$Subnets->mail_font_style $change[lastSeen]
      $Subnets->mail_font_style_href " . $Subnets->transform_to_dotted($change['ip_addr']) . "$Subnets->mail_font_style_href " . $Subnets->transform_to_dotted($change['ip_addr']) . "$Subnets->mail_font_style $change[description]$Subnets->mail_font_style_href $change[hostname]$Subnets->mail_font_style_href " . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . "" . $subnet->description . "$Subnets->mail_font_style_href " . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . "" . $subnet->description . "$Subnets->mail_font_style $ago$Subnets->mail_font_style $oldStatus > $newStatus
      $Subnets->mail_font_style ".$Subnets->transform_to_dotted($change['ip_addr'])."$Subnets->mail_font_style $change[description]$Subnets->mail_font_style_href $change[hostname]$Subnets->mail_font_style_href ".$Subnets->transform_to_dotted($subnet->subnet)."/".$subnet->mask."".$subnet->description."$Subnets->mail_font_style_href ".$Subnets->transform_to_dotted($subnet->subnet)."/".$subnet->mask."".$subnet->description."$Subnets->mail_font_style $change[lastSeen]
      "; diff --git a/public/app/admin/devices/edit-result.php b/public/app/admin/devices/edit-result.php index 6f85577ee..923f5a1c6 100755 --- a/public/app/admin/devices/edit-result.php +++ b/public/app/admin/devices/edit-result.php @@ -36,7 +36,7 @@ # available devices set foreach($POST as $key=>$line) { if (!is_blank(strstr((string) $key,"section-"))) { - $key2 = str_replace("section-", "", $key); + $key2 = str_replace("section-", "", (string) $key); $temp[] = $key2; unset($POST->{$key}); diff --git a/public/app/admin/devices/edit-snmp-result.php b/public/app/admin/devices/edit-snmp-result.php index c77e3ae3c..879893934 100644 --- a/public/app/admin/devices/edit-snmp-result.php +++ b/public/app/admin/devices/edit-snmp-result.php @@ -46,7 +46,7 @@ # set snmp queries foreach($POST as $key=>$line) { if (!is_blank(strstr((string) $key,"query-"))) { - $key2 = str_replace("query-", "", $key); + $key2 = str_replace("query-", "", (string) $key); $temp[] = $key2; unset($POST->$key); } diff --git a/public/app/admin/import-export/export-bgp.php b/public/app/admin/import-export/export-bgp.php index 26f32cc26..b41ac15a3 100644 --- a/public/app/admin/import-export/export-bgp.php +++ b/public/app/admin/import-export/export-bgp.php @@ -51,7 +51,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //change spaces to "___" so it can be used as element id - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); array_push ( $fields, $myField['nameTemp'] ); } } diff --git a/public/app/admin/import-export/export-devices-field-select.php b/public/app/admin/import-export/export-devices-field-select.php index d63f6199d..c21df7d65 100644 --- a/public/app/admin/import-export/export-devices-field-select.php +++ b/public/app/admin/import-export/export-devices-field-select.php @@ -35,7 +35,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //change spaces to "___" so it can be used as element id - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); $custom_fields_names.= " $myField[name] $myField[name] $myField[name] $myField[name]
      ".$domain['name'].""; print " ".$domain['description'].""; - print "
      $myField[name]
      '. str_replace("_", " ", $section['name']).' '. str_replace("_", " ", (string) $section['name']).''. $section['description'] .'
      "; print " "; diff --git a/public/app/admin/users/print-user/account.php b/public/app/admin/users/print-user/account.php index b8db92dc4..4e7de8da0 100644 --- a/public/app/admin/users/print-user/account.php +++ b/public/app/admin/users/print-user/account.php @@ -44,7 +44,7 @@ # custom subnet fields if(sizeof($custom_fields) > 0) { foreach($custom_fields as $key=>$field) { - $user->{$key} = str_replace("\n", "
      ",$user->{$key}); + $user->{$key} = str_replace("\n", "
      ",(string) $user->{$key}); print "
      $key"; diff --git a/public/app/admin/vaults/download-certificate-execute.php b/public/app/admin/vaults/download-certificate-execute.php index 1c7f7a8bc..e1418a259 100644 --- a/public/app/admin/vaults/download-certificate-execute.php +++ b/public/app/admin/vaults/download-certificate-execute.php @@ -101,8 +101,8 @@ // get PEM pubkey openssl_x509_export ($cert_res_pub, $exported_pub); // remove BEGIN / END Certificate - $exported_pub = str_replace("-----BEGIN CERTIFICATE-----".PHP_EOL, "", $exported_pub); - $exported_pub = str_replace("-----END CERTIFICATE-----".PHP_EOL, "", $exported_pub); + $exported_pub = str_replace("-----BEGIN CERTIFICATE-----".PHP_EOL, "", (string) $exported_pub); + $exported_pub = str_replace("-----END CERTIFICATE-----".PHP_EOL, "", (string) $exported_pub); // $content = wordwrap($exported_pub, 64, "\r\n", true); $content = wordwrap(base64_decode($exported_pub), 64, "\r\n", true); diff --git a/public/app/admin/vaults/edit-item-certificate-result.php b/public/app/admin/vaults/edit-item-certificate-result.php index a5e8150e1..3664c059c 100644 --- a/public/app/admin/vaults/edit-item-certificate-result.php +++ b/public/app/admin/vaults/edit-item-certificate-result.php @@ -91,7 +91,7 @@ if(sizeof($custom) > 0) { foreach($custom as $myField) { # replace possible ___ back to spaces! - $myField['nameTest'] = str_replace(" ", "___", $myField['name']); + $myField['nameTest'] = str_replace(" ", "___", (string) $myField['name']); if(isset($POST->{$myField['nameTest']})) { $values[$myField['name']] = $POST->{$myField['nameTest']};} } } diff --git a/public/app/admin/vaults/edit-item-password-result.php b/public/app/admin/vaults/edit-item-password-result.php index 6339ac110..5f41ee144 100644 --- a/public/app/admin/vaults/edit-item-password-result.php +++ b/public/app/admin/vaults/edit-item-password-result.php @@ -79,7 +79,7 @@ if(sizeof($custom) > 0) { foreach($custom as $myField) { # replace possible ___ back to spaces! - $myField['nameTest'] = str_replace(" ", "___", $myField['name']); + $myField['nameTest'] = str_replace(" ", "___", (string) $myField['name']); if(isset($POST->{$myField['nameTest']})) { $values[$myField['name']] = $POST->{$myField['nameTest']};} } } diff --git a/public/app/admin/vaults/edit-result.php b/public/app/admin/vaults/edit-result.php index 24fcbc9b8..800d69db4 100644 --- a/public/app/admin/vaults/edit-result.php +++ b/public/app/admin/vaults/edit-result.php @@ -65,7 +65,7 @@ if(sizeof($custom) > 0) { foreach($custom as $myField) { # replace possible ___ back to spaces! - $myField['nameTest'] = str_replace(" ", "___", $myField['name']); + $myField['nameTest'] = str_replace(" ", "___", (string) $myField['name']); if(isset($POST->{$myField['nameTest']})) { $values[$myField['name']] = $POST->{$myField['nameTest']};} } } diff --git a/public/app/admin/vaults/fetch_website_certificate.php b/public/app/admin/vaults/fetch_website_certificate.php index fb2dd1580..80122da17 100644 --- a/public/app/admin/vaults/fetch_website_certificate.php +++ b/public/app/admin/vaults/fetch_website_certificate.php @@ -36,7 +36,7 @@ function php_error_handler($errno, $errstr){ } // replace https -$website = str_replace(["https://", "http://"], "ssl://", $POST->website); +$website = str_replace(["https://", "http://"], "ssl://", (string) $POST->website); if (!preg_match('/:\d+$/',$website)) { $website.= ":443"; } diff --git a/public/app/admin/version-check/index.php b/public/app/admin/version-check/index.php index ee422b3bf..9b98318fe 100755 --- a/public/app/admin/version-check/index.php +++ b/public/app/admin/version-check/index.php @@ -64,7 +64,7 @@ print "

      Release log


      "; foreach ($Tools->phpipam_releases as $r) { // pre-release ? - $prerelease = !is_numeric(str_replace(["Version", "."], "", $r->title)) ? "Prerelease" : ""; + $prerelease = !is_numeric(str_replace(["Version", "."], "", (string) $r->title)) ? "Prerelease" : ""; // title print "
      $r->title $prerelease
      "; diff --git a/public/app/admin/vlans/edit-domain-result.php b/public/app/admin/vlans/edit-domain-result.php index e15323aff..e62726e6f 100644 --- a/public/app/admin/vlans/edit-domain-result.php +++ b/public/app/admin/vlans/edit-domain-result.php @@ -41,7 +41,7 @@ $temp = []; foreach($POST as $key=>$line) { if (!is_blank(strstr((string) $key,"section-"))) { - $key2 = str_replace("section-", "", $key); + $key2 = str_replace("section-", "", (string) $key); $temp[] = $key2; unset($POST->{$key}); } diff --git a/public/app/admin/vlans/edit-result.php b/public/app/admin/vlans/edit-result.php index f33f53e72..0cee8e74a 100755 --- a/public/app/admin/vlans/edit-result.php +++ b/public/app/admin/vlans/edit-result.php @@ -74,7 +74,7 @@ if(sizeof($custom) > 0) { foreach($custom as $myField) { # replace possible ___ back to spaces! - $myField['nameTest'] = str_replace(" ", "___", $myField['name']); + $myField['nameTest'] = str_replace(" ", "___", (string) $myField['name']); if(isset($POST->{$myField['nameTest']})) { $values[$myField['name']] = $POST->{$myField['nameTest']};} } } diff --git a/public/app/admin/vlans/vlans-scan-execute.php b/public/app/admin/vlans/vlans-scan-execute.php index 5581f8c51..35c6465dc 100644 --- a/public/app/admin/vlans/vlans-scan-execute.php +++ b/public/app/admin/vlans/vlans-scan-execute.php @@ -55,7 +55,7 @@ foreach ($POST as $k=>$p) { if (strpos((string) $k, "device-")!==false) { # fetch device - $device = $Tools->fetch_object ("devices", "id", str_replace("device-", "", $k)); + $device = $Tools->fetch_object ("devices", "id", str_replace("device-", "", (string) $k)); if ($device !== false) { $scan_devices[] = $device; } diff --git a/public/app/admin/vrf/edit-result.php b/public/app/admin/vrf/edit-result.php index e991d0704..8e0d9915a 100755 --- a/public/app/admin/vrf/edit-result.php +++ b/public/app/admin/vrf/edit-result.php @@ -38,7 +38,7 @@ // set sections foreach($POST as $key=>$line) { if (!is_blank(strstr((string) $key,"section-"))) { - $key2 = str_replace("section-", "", $key); + $key2 = str_replace("section-", "", (string) $key); $temp[] = $key2; unset($POST->{$key}); } @@ -58,7 +58,7 @@ if(sizeof($custom) > 0) { foreach($custom as $myField) { # replace possible ___ back to spaces! - $myField['nameTest'] = str_replace(" ", "___", $myField['name']); + $myField['nameTest'] = str_replace(" ", "___", (string) $myField['name']); if(isset($POST->{$myField['nameTest']})) { $values[$myField['name']] = $POST->{$myField['nameTest']};} } } diff --git a/public/app/admin/vrf/vrf-scan-execute.php b/public/app/admin/vrf/vrf-scan-execute.php index a1df8c8ff..f9269c222 100644 --- a/public/app/admin/vrf/vrf-scan-execute.php +++ b/public/app/admin/vrf/vrf-scan-execute.php @@ -45,7 +45,7 @@ foreach ($POST as $k=>$p) { if (strpos((string) $k, "device-")!==false) { # fetch device - $device = $Tools->fetch_object ("devices", "id", str_replace("device-", "", $k)); + $device = $Tools->fetch_object ("devices", "id", str_replace("device-", "", (string) $k)); if ($device !== false) { $scan_devices[] = $device; } diff --git a/public/app/dashboard/widgets/changelog.php b/public/app/dashboard/widgets/changelog.php index 2ec4a5239..75639323c 100755 --- a/public/app/dashboard/widgets/changelog.php +++ b/public/app/dashboard/widgets/changelog.php @@ -74,8 +74,8 @@ if($permission > 0) { # format diff - $changelog = str_replace("\r\n", "
      ",$l['cdiff']); - $changelog = str_replace("\n", "
      ",$changelog); + $changelog = str_replace("\r\n", "
      ",(string) $l['cdiff']); + $changelog = str_replace("\n", "
      ",(string) $changelog); $changelog = htmlentities($changelog); $changelog = array_filter(pf_explode("
      ", $changelog)); diff --git a/public/app/dashboard/widgets/top10_hosts_lib.php b/public/app/dashboard/widgets/top10_hosts_lib.php index c85c872b6..734b1e0ef 100644 --- a/public/app/dashboard/widgets/top10_hosts_lib.php +++ b/public/app/dashboard/widgets/top10_hosts_lib.php @@ -83,7 +83,7 @@ function top10_widget($type_ip, $type_percentage, $height, $slimit) { if ($type_percentage === true) { # set percentage because of localisation - $subnet['percentage'] = str_replace(",", ".", $subnet['percentage']); + $subnet['percentage'] = str_replace(",", ".", (string) $subnet['percentage']); $display_item = $subnet['percentage']; } else { $display_item = $subnet['usage']; @@ -177,7 +177,7 @@ function showTooltip(x, y, contents) { show: true }, yaxis: { - percentage); ?> + percentage); ?> }, margin: { diff --git a/public/app/sections/all-sections.php b/public/app/sections/all-sections.php index eb8d03191..c67f81d71 100644 --- a/public/app/sections/all-sections.php +++ b/public/app/sections/all-sections.php @@ -75,7 +75,7 @@ print '
      '. str_replace("_", " ", $section['name']).''. str_replace("_", " ", (string) $section['name']).''. $section['description'] .'
      "; print ""; @@ -251,7 +251,7 @@ foreach($custom_fields as $key=>$field) { if(!is_blank($address[$key])) { - $address[$key] = str_replace(["\n", "\r\n"], "
      ",$address[$key]); + $address[$key] = str_replace(["\n", "\r\n"], "
      ",(string) $address[$key]); print "
      "; print " "; print " "; print " "; diff --git a/public/app/subnets/addresses/export-subnet.php b/public/app/subnets/addresses/export-subnet.php index 2f7601243..1ba6b7de6 100755 --- a/public/app/subnets/addresses/export-subnet.php +++ b/public/app/subnets/addresses/export-subnet.php @@ -172,7 +172,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( (isset($GET->{$myField['nameTemp']})) && ($GET->{$myField['nameTemp']} == "on") ) { $worksheet->write($lineCount, $rowCount, $myField['name'] ,$format_title); @@ -277,7 +277,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $myField) { //set temp name - replace space with three ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); if( (isset($GET->{$myField['nameTemp']})) && ($GET->{$myField['nameTemp']} == "on") ) { $worksheet->write($lineCount, $rowCount, $ip[$myField['name']]); diff --git a/public/app/subnets/addresses/mail-notify-check.php b/public/app/subnets/addresses/mail-notify-check.php index 8e60e5a2f..675be0fd2 100644 --- a/public/app/subnets/addresses/mail-notify-check.php +++ b/public/app/subnets/addresses/mail-notify-check.php @@ -45,7 +45,7 @@ $content[] = ""; //set al content $content_plain[] = "$subject"."\r\n------------------------------\r\n"; - $content_plain[] = str_replace("·", "\t - ", $POST->content); + $content_plain[] = str_replace("·", "\t - ", (string) $POST->content); $content_plain[] = "\r\n\r\n"._("Sent by user")." ".$User->user->real_name." at ".date('Y/m/d H:i'); $content[] = "
      " . $Tools->print_custom_field_name($key) . ""; diff --git a/public/app/subnets/addresses/address-modify-submit.php b/public/app/subnets/addresses/address-modify-submit.php index 9df773303..51fe6ab4c 100644 --- a/public/app/subnets/addresses/address-modify-submit.php +++ b/public/app/subnets/addresses/address-modify-submit.php @@ -82,7 +82,7 @@ # remove all spaces in hostname -if (!is_blank($POST->hostname)) { $POST->hostname = str_replace(" ", "", $POST->hostname); } +if (!is_blank($POST->hostname)) { $POST->hostname = str_replace(" ", "", (string) $POST->hostname); } # required fields isset($POST->action) ?: $Result->show("danger", _("Missing required fields"). " action", true); @@ -147,7 +147,7 @@ $POST->type = "series"; # remove possible spaces - $POST->ip_addr = str_replace(" ", "", $POST->ip_addr); + $POST->ip_addr = str_replace(" ", "", (string) $POST->ip_addr); # get start and stop of range $range = pf_explode("-", $POST->ip_addr); @@ -180,7 +180,7 @@ # check if delete is confirmed if ($action=="delete" && !isset($POST->deleteconfirm)) { - $range = str_replace("-", " - ", $POST->ip_addr); + $range = str_replace("-", " - ", (string) $POST->ip_addr); # for ajax to prevent reload print "
      alert alert-danger
      "; # result diff --git a/public/app/subnets/addresses/export-field-select.php b/public/app/subnets/addresses/export-field-select.php index 340c11723..efe2f1ab1 100644 --- a/public/app/subnets/addresses/export-field-select.php +++ b/public/app/subnets/addresses/export-field-select.php @@ -135,7 +135,7 @@ foreach($custom_fields as $myField) { //change spaces to ___ - $myField['nameTemp'] = str_replace(" ", "___", $myField['name']); + $myField['nameTemp'] = str_replace(" ", "___", (string) $myField['name']); print "
      $myField[name]
      $User->mail_font_style_light Sent by user ".$User->user->real_name." at ".date('Y/m/d H:i')."
      "; diff --git a/public/app/subnets/addresses/mail-notify.php b/public/app/subnets/addresses/mail-notify.php index 533ca76eb..90694f1a8 100644 --- a/public/app/subnets/addresses/mail-notify.php +++ b/public/app/subnets/addresses/mail-notify.php @@ -71,7 +71,7 @@ # Nameserver sets if ( !empty( $subnet['nameserverId'] ) ) { - $nslist = str_replace(";", ", ", $nameservers['namesrv1']); + $nslist = str_replace(";", ", ", (string) $nameservers['namesrv1']); $content[] = "• "._('Nameservers').": \t $nslist ({$nameservers['name']})"; } diff --git a/public/app/subnets/addresses/print-address-table.php b/public/app/subnets/addresses/print-address-table.php index 50042c016..d454ef795 100644 --- a/public/app/subnets/addresses/print-address-table.php +++ b/public/app/subnets/addresses/print-address-table.php @@ -503,7 +503,7 @@ function unset_array_value(&$array, $value) { } //text elseif($myField['type']=="text") { - if(!is_blank($addresses[$n]->{$myField['name']})) { print ""; } + if(!is_blank($addresses[$n]->{$myField['name']})) { print ""; } else { print ""; } } else { @@ -616,7 +616,7 @@ function unset_array_value(&$array, $value) { } # print info button for hover if(in_array('note', $selected_ip_fields)) { - if(!empty($s->note)) { print ""; } + if(!empty($s->note)) { print ""; } else { print ""; } } # print device diff --git a/public/app/subnets/mail-notify-subnet.php b/public/app/subnets/mail-notify-subnet.php index bc8896891..7154f6db9 100644 --- a/public/app/subnets/mail-notify-subnet.php +++ b/public/app/subnets/mail-notify-subnet.php @@ -60,7 +60,7 @@ # Nameserver sets if ( !empty( $subnet['nameserverId'] ) ) { - $nslist = str_replace(";", ", ", $nameservers['namesrv1']); + $nslist = str_replace(";", ", ", (string) $nameservers['namesrv1']); $content[] = "• "._('Nameservers').": \t $nslist ({$nameservers['name']})"; } diff --git a/public/app/subnets/scan/subnet-scan-execute-scan-telnet.php b/public/app/subnets/scan/subnet-scan-execute-scan-telnet.php index 5d40976c8..a23b40a2b 100755 --- a/public/app/subnets/scan/subnet-scan-execute-scan-telnet.php +++ b/public/app/subnets/scan/subnet-scan-execute-scan-telnet.php @@ -11,13 +11,13 @@ if(empty($POST->port)) { $Result->show("danger", _('Please enter ports to scan').'!', true); } //verify ports -$pcheck = pf_explode(";", str_replace(",",";",$POST->port)); +$pcheck = pf_explode(";", str_replace(",",";",(string) $POST->port)); foreach($pcheck as $p) { if(!is_numeric($p)) { $Result->show("danger", _("Invalid port").' ('.$p.')', true); } } -$POST->port = str_replace(";",",",$POST->port); +$POST->port = str_replace(";",",",(string) $POST->port); // verify subnetId if(!is_numeric($POST->subnetId)) { $Result->show("danger", _('Invalid subnet Identifier').'!', true); } diff --git a/public/app/subnets/subnet-details/subnet-changelog.php b/public/app/subnets/subnet-details/subnet-changelog.php index ea80a796a..fefbdd87a 100755 --- a/public/app/subnets/subnet-details/subnet-changelog.php +++ b/public/app/subnets/subnet-details/subnet-changelog.php @@ -60,7 +60,7 @@ foreach($clogs as $l) { $l = (array) $l; # format diff - $l['cdiff'] = str_replace("\n", "
      ", $l['cdiff']); + $l['cdiff'] = str_replace("\n", "
      ", (string) $l['cdiff']); # set class for badge if($l['cresult']=="success") { $bclass='alert-success'; } @@ -108,7 +108,7 @@ foreach($clogsSlaves as $l) { $l = (array) $l; # format diff - $l['cdiff'] = str_replace("\n", "
      ", $l['cdiff']); + $l['cdiff'] = str_replace("\n", "
      ", (string) $l['cdiff']); print ""; print " $l[real_name]"; @@ -152,7 +152,7 @@ $l = (array) $l; # format diff if(!is_null($l['cdiff'])) - $l['cdiff'] = str_replace("\n", "
      ", $l['cdiff']); + $l['cdiff'] = str_replace("\n", "
      ", (string) $l['cdiff']); print ""; print " $l[real_name]"; diff --git a/public/app/subnets/subnet-details/subnet-details.php b/public/app/subnets/subnet-details/subnet-details.php index 48eb5095e..8d0d5d627 100755 --- a/public/app/subnets/subnet-details/subnet-details.php +++ b/public/app/subnets/subnet-details/subnet-details.php @@ -177,7 +177,7 @@ if(!empty($subnet['nameserverId'])) { # fetch recursive nameserver details $nameservers = $Tools->fetch_object("nameservers", "id", $subnet['nameserverId']); - print str_replace(";", ", ", $nameservers->namesrv1); + print str_replace(";", ", ", (string) $nameservers->namesrv1); //Print name of nameserver group print ' ('.$nameservers->name.')'; } @@ -508,7 +508,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $key=>$field) { if(!is_blank($subnet[$key])) { - $subnet[$key] = str_replace(["\n", "\r\n"], "
      ",$subnet[$key]); + $subnet[$key] = str_replace(["\n", "\r\n"], "
      ",(string) $subnet[$key]); $html_custom[] = ""; $html_custom[] = " ".$Tools->print_custom_field_name ($key).""; $html_custom[] = " "; diff --git a/public/app/subnets/subnet-details/subnet-graph.php b/public/app/subnets/subnet-details/subnet-graph.php index 0c286e484..80fa8f411 100755 --- a/public/app/subnets/subnet-details/subnet-graph.php +++ b/public/app/subnets/subnet-details/subnet-graph.php @@ -29,14 +29,14 @@ 0) { - $details['freehosts_percent'] = str_replace(",", ".", $details['freehosts_percent']); + $details['freehosts_percent'] = str_replace(",", ".", (string) $details['freehosts_percent']); print "{ label: '"._('Free')."', data: $details[freehosts_percent], color: '$unused_color' }, "; # free hosts } # than all other percentages foreach($Subnets->address_types as $t) { $type_percent = $t['type']."_percent"; if(isset($details[$type_percent]) && $details[$type_percent]>0) { - $details[$type_percent] = str_replace(",", ".", $details[$type_percent]); + $details[$type_percent] = str_replace(",", ".", (string) $details[$type_percent]); print "{ label: '"._($t['type'])."', data: ".$details[$t["type"]."_percent"].", color: '".$t['bgcolor']."' }, "; } } diff --git a/public/app/temp_share/address.php b/public/app/temp_share/address.php index 28d21539c..01c01b2a0 100644 --- a/public/app/temp_share/address.php +++ b/public/app/temp_share/address.php @@ -190,7 +190,7 @@ foreach($custom_fields as $key=>$field) { if(!is_blank($address[$key])) { - $address[$key] = str_replace(["\n", "\r\n"], "
      ",$address[$key]); + $address[$key] = str_replace(["\n", "\r\n"], "
      ",(string) $address[$key]); print ""; print " $key"; print " "; diff --git a/public/app/temp_share/subnet-addresses.php b/public/app/temp_share/subnet-addresses.php index 93905e53f..4a37e5832 100644 --- a/public/app/temp_share/subnet-addresses.php +++ b/public/app/temp_share/subnet-addresses.php @@ -201,7 +201,7 @@ # print info button for hover if(in_array('note', $selected_ip_fields)) { - if(!empty($addresses[$n]->note)) { print ""; } + if(!empty($addresses[$n]->note)) { print ""; } else { print ""; } } @@ -231,7 +231,7 @@ } //text elseif($myField['type']=="text") { - if(!is_blank($addresses[$n]->{$myField['name']})) { print ""; } + if(!is_blank($addresses[$n]->{$myField['name']})) { print ""; } else { print ""; } } else { diff --git a/public/app/temp_share/subnet-details.php b/public/app/temp_share/subnet-details.php index f17682939..b9ee300f5 100644 --- a/public/app/temp_share/subnet-details.php +++ b/public/app/temp_share/subnet-details.php @@ -117,7 +117,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $key=>$field) { if(!is_blank($subnet[$key])) { - $subnet[$key] = str_replace(["\n", "\r\n"], "
      ",$subnet[$key]); + $subnet[$key] = str_replace(["\n", "\r\n"], "
      ",(string) $subnet[$key]); $html_custom[] = ""; $html_custom[] = " ".$Tools->print_custom_field_name ($key).""; $html_custom[] = " "; diff --git a/public/app/tools/changelog/changelog-print.php b/public/app/tools/changelog/changelog-print.php index 670333c69..ab3647b7c 100755 --- a/public/app/tools/changelog/changelog-print.php +++ b/public/app/tools/changelog/changelog-print.php @@ -75,9 +75,9 @@ # printout if($permission > 0) { # format diff - $l['cdiff'] = str_replace("\n", "
      ",$l['cdiff']); - $l['cdiff'] = str_replace("[", "[", $l['cdiff']); - $l['cdiff'] = str_replace("]", "]", $l['cdiff']); + $l['cdiff'] = str_replace("\n", "
      ",(string) $l['cdiff']); + $l['cdiff'] = str_replace("[", "[", (string) $l['cdiff']); + $l['cdiff'] = str_replace("]", "]", (string) $l['cdiff']); # format type switch($l['ctype']) { diff --git a/public/app/tools/changelog/show-popup.php b/public/app/tools/changelog/show-popup.php index ad681decb..44ab0f32c 100644 --- a/public/app/tools/changelog/show-popup.php +++ b/public/app/tools/changelog/show-popup.php @@ -95,8 +95,8 @@ print " "; # format diff - $changelog = str_replace("\r\n", "
      ",$clog->cdiff); - $changelog = str_replace("\n", "
      ",$changelog); + $changelog = str_replace("\r\n", "
      ",(string) $clog->cdiff); + $changelog = str_replace("\n", "
      ",(string) $changelog); $changelog = array_filter(pf_explode("
      ", $changelog)); # set type diff --git a/public/app/tools/customers/customer/objects/ipaddresses.php b/public/app/tools/customers/customer/objects/ipaddresses.php index 6190ca60f..2a4320172 100644 --- a/public/app/tools/customers/customer/objects/ipaddresses.php +++ b/public/app/tools/customers/customer/objects/ipaddresses.php @@ -125,7 +125,7 @@ // print info button for hover if(in_array('note', $selected_ip_fields)) { - if(!empty($addresses[$n]->note)) { print ""; } + if(!empty($addresses[$n]->note)) { print ""; } else { print ""; } } diff --git a/public/app/tools/devices/device-details/device-addresses.php b/public/app/tools/devices/device-details/device-addresses.php index 85df59353..8cd68a509 100644 --- a/public/app/tools/devices/device-details/device-addresses.php +++ b/public/app/tools/devices/device-details/device-addresses.php @@ -73,7 +73,7 @@ # print info button for hover print ""; if(!empty($ip['note'])) { - $ip['note'] = str_replace("\n", "
      ",$ip['note']); + $ip['note'] = str_replace("\n", "
      ",(string) $ip['note']); print " "; } print ""; diff --git a/public/app/tools/documentation/index.php b/public/app/tools/documentation/index.php index db8f0cbfa..30887fbd6 100644 --- a/public/app/tools/documentation/index.php +++ b/public/app/tools/documentation/index.php @@ -66,7 +66,7 @@ } } - $html = str_replace(['', ''], '', $dom->saveHTML()); + $html = str_replace(['', ''], '', (string) $dom->saveHTML()); } } elseif (is_dir($path_doc)) { diff --git a/public/app/tools/locations/single-location.php b/public/app/tools/locations/single-location.php index a19614d80..fcb8b351a 100644 --- a/public/app/tools/locations/single-location.php +++ b/public/app/tools/locations/single-location.php @@ -92,7 +92,7 @@ print "
      "; // fields foreach($cfields as $key=>$field) { - $location->{$key} = str_replace("\n", "
      ",$location->{$key}); + $location->{$key} = str_replace("\n", "
      ",(string) $location->{$key}); // create links $location->{$key} = $Tools->create_links($location->{$key}); print ""; diff --git a/public/app/tools/logs/detail-popup.php b/public/app/tools/logs/detail-popup.php index 7c4720231..e5a4934b9 100755 --- a/public/app/tools/logs/detail-popup.php +++ b/public/app/tools/logs/detail-popup.php @@ -40,7 +40,7 @@ $userprint = $user===false ? "" : $user->real_name."(".$user->username.")"; # details format -$log['details'] = str_replace("\n", "
      ", $log['details']); +$log['details'] = str_replace("\n", "
      ", (string) $log['details']); # check if site is demo if(defined('IS_DEMO')) { $log['ipaddr'] = "x.x.x.x"; } diff --git a/public/app/tools/logs/export.php b/public/app/tools/logs/export.php index c90bff61e..d0986498d 100755 --- a/public/app/tools/logs/export.php +++ b/public/app/tools/logs/export.php @@ -97,7 +97,7 @@ } //remove breaks in details - $log['details'] = str_replace("
      ", "\n", $log['details']); + $log['details'] = str_replace("
      ", "\n", (string) $log['details']); $worksheet->write($lineCount, 0, $log['id'], $format_left); $worksheet->write($lineCount, 1, $log['severity']); diff --git a/public/app/tools/logs/show-logs.php b/public/app/tools/logs/show-logs.php index 2def4a0c9..488530b0c 100755 --- a/public/app/tools/logs/show-logs.php +++ b/public/app/tools/logs/show-logs.php @@ -100,7 +100,7 @@ } /* reformat details */ - $log['details'] = str_replace("\"", "'", $log['details']); + $log['details'] = str_replace("\"", "'", (string) $log['details']); # check if site is demo if(defined('IS_DEMO')) { $log['ipaddr'] = "x.x.x.x"; } diff --git a/public/app/tools/multicast-networks/index.php b/public/app/tools/multicast-networks/index.php index 57a32c1c5..625aff7ed 100644 --- a/public/app/tools/multicast-networks/index.php +++ b/public/app/tools/multicast-networks/index.php @@ -198,7 +198,7 @@ # print info button for hover if(in_array('note', $selected_ip_fields)) { - if(!empty($address->note)) { print ""; } + if(!empty($address->note)) { print ""; } else { print ""; } } @@ -231,7 +231,7 @@ } //text elseif($myField['type']=="text") { - if(!is_blank($address->{$myField['name']})) { print ""; } + if(!is_blank($address->{$myField['name']})) { print ""; } else { print ""; } } else { diff --git a/public/app/tools/nat/all_nats.php b/public/app/tools/nat/all_nats.php index 204879368..1f8a97a82 100644 --- a/public/app/tools/nat/all_nats.php +++ b/public/app/tools/nat/all_nats.php @@ -147,7 +147,7 @@ $policy_dst = $n->policy=="Yes" ? $n->policy_dst : "/"; // description - $n->description = is_null($n->description) ? "" : str_replace("\n", "
      ", $n->description); + $n->description = is_null($n->description) ? "" : str_replace("\n", "
      ", (string) $n->description); // port if(is_blank($n->src_port)) $n->src_port = "/"; diff --git a/public/app/tools/nat/nat_details.php b/public/app/tools/nat/nat_details.php index 800eec86f..4003b717d 100644 --- a/public/app/tools/nat/nat_details.php +++ b/public/app/tools/nat/nat_details.php @@ -69,7 +69,7 @@ } // description - $n->description = str_replace("\n", "
      ", $n->description); + $n->description = str_replace("\n", "
      ", (string) $n->description); // port if(is_blank($n->src_port)) $n->src_port = "/"; diff --git a/public/app/tools/pstn-prefixes/single-prefix-graph.php b/public/app/tools/pstn-prefixes/single-prefix-graph.php index a8a4426e9..db349e8d1 100644 --- a/public/app/tools/pstn-prefixes/single-prefix-graph.php +++ b/public/app/tools/pstn-prefixes/single-prefix-graph.php @@ -21,14 +21,14 @@ 0) { - $details['freehosts_percent'] = str_replace(",", ".", $details['freehosts_percent']); + $details['freehosts_percent'] = str_replace(",", ".", (string) $details['freehosts_percent']); print "{ label: '"._('Free')."', data: $details[freehosts_percent], color: '#ffffff' }, "; # free hosts } # than all other percentages if(isset($Subnets->address_types)) { foreach($Subnets->address_types as $t) { if($details[$t['type']."_percent"]>0) { - $details[$t['type']."_percent"] = str_replace(",", ".", $details[$t['type']."_percent"]); + $details[$t['type']."_percent"] = str_replace(",", ".", (string) $details[$t['type']."_percent"]); print "{ label: '"._($t['type'])."', data: ".$details[$t["type"]."_percent"].", color: '".$t['bgcolor']."' }, "; } } diff --git a/public/app/tools/pstn-prefixes/single-prefix-numbers.php b/public/app/tools/pstn-prefixes/single-prefix-numbers.php index b4d632f7d..ed6cc937c 100644 --- a/public/app/tools/pstn-prefixes/single-prefix-numbers.php +++ b/public/app/tools/pstn-prefixes/single-prefix-numbers.php @@ -139,7 +139,7 @@ } //text elseif($myField['type']=="text") { - if(!is_blank($n->{$myField['name']})) { print ""; } + if(!is_blank($n->{$myField['name']})) { print ""; } else { print ""; } } else { diff --git a/public/app/tools/pstn-prefixes/single-prefix.php b/public/app/tools/pstn-prefixes/single-prefix.php index 6df1a5745..1d4c49834 100644 --- a/public/app/tools/pstn-prefixes/single-prefix.php +++ b/public/app/tools/pstn-prefixes/single-prefix.php @@ -155,7 +155,7 @@ print "
      "; // fields foreach($cfields as $key=>$field) { - $prefix->{$key} = str_replace("\n", "
      ",$prefix->{$key}); + $prefix->{$key} = str_replace("\n", "
      ",(string) $prefix->{$key}); // create links $prefix->{$key} = $Tools->create_links($prefix->{$key}); print ""; diff --git a/public/app/tools/racks/print-single-rack.php b/public/app/tools/racks/print-single-rack.php index 588eb6bd2..3a897b10c 100755 --- a/public/app/tools/racks/print-single-rack.php +++ b/public/app/tools/racks/print-single-rack.php @@ -144,7 +144,7 @@ print "
      "; // fields foreach($cfields as $key=>$field) { - $rack->{$key} = str_replace("\n", "
      ",$rack->{$key}); + $rack->{$key} = str_replace("\n", "
      ",(string) $rack->{$key}); // create links $rack->{$key} = $Tools->create_links($rack->{$key}); print ""; diff --git a/public/app/tools/search/search_results/search-results_addresses.php b/public/app/tools/search/search_results/search-results_addresses.php index 306b40bd4..e2d08f232 100755 --- a/public/app/tools/search/search_results/search-results_addresses.php +++ b/public/app/tools/search/search_results/search-results_addresses.php @@ -139,7 +139,7 @@ print ' '. $line['owner'] .'' . "\n"; print ' ' . "\n"; if(!empty($line['note'])) { - $line['note'] = str_replace("\n", "
      ",$line['note']); + $line['note'] = str_replace("\n", "
      ",(string) $line['note']); print '' . "\n"; } print ''. "\n"; @@ -150,7 +150,7 @@ elseif (in_array('note', $selected_ip_fields)) { print '' . "\n"; if(!empty($line['note'])) { - $line['note'] = str_replace("\n", "
      ",$line['note']); + $line['note'] = str_replace("\n", "
      ",(string) $line['note']); print ' ' . "\n"; } print ''. "\n"; diff --git a/public/app/tools/vaults/vault/vault-details-general.php b/public/app/tools/vaults/vault/vault-details-general.php index d0c5e057f..6045394a4 100644 --- a/public/app/tools/vaults/vault/vault-details-general.php +++ b/public/app/tools/vaults/vault/vault-details-general.php @@ -47,7 +47,7 @@ print ""; foreach($custom_fields_v as $key=>$field) { - $vault->{$key} = str_replace("\n", "
      ",$vault->{$key}); + $vault->{$key} = str_replace("\n", "
      ",(string) $vault->{$key}); # fix for boolean if($field['type']=="tinyint(1)" || $field['type']=="boolean") { diff --git a/public/app/tools/vaults/vault/vault-item-details-general.php b/public/app/tools/vaults/vault/vault-item-details-general.php index c1466ae8a..cb549912d 100644 --- a/public/app/tools/vaults/vault/vault-item-details-general.php +++ b/public/app/tools/vaults/vault/vault-item-details-general.php @@ -59,7 +59,7 @@ print ""; foreach($custom_fields as $key=>$field) { - $vault_item->{$key} = str_replace("\n", "
      ",$vault_item->{$key}); + $vault_item->{$key} = str_replace("\n", "
      ",(string) $vault_item->{$key}); # fix for boolean if($field['type']=="tinyint(1)" || $field['type']=="boolean") { @@ -139,7 +139,7 @@ print " ".$certificate_details['subject']['CN'].""; print ""; print " "._("Alt names").""; - print " ".str_replace(",","
      ",$certificate_details['extensions']['subjectAltName']).""; + print " ".str_replace(",","
      ",(string) $certificate_details['extensions']['subjectAltName']).""; print ""; // Certificate details @@ -227,7 +227,7 @@ foreach($certificate_details['extensions'] as $ext_key=>$e) { print ""; print " ".ucwords((string) preg_replace('/(?"; - print " ".str_replace(",","
      ",$e).""; + print " ".str_replace(",","
      ",(string) $e).""; print ""; } } diff --git a/public/app/tools/vaults/vault/vault-items-certificates.php b/public/app/tools/vaults/vault/vault-items-certificates.php index 87b2f3fbf..056535bb0 100644 --- a/public/app/tools/vaults/vault/vault-items-certificates.php +++ b/public/app/tools/vaults/vault/vault-items-certificates.php @@ -85,7 +85,7 @@ print " ".$certificate['subject']['CN'].""; print " ".$validTo." ($valid_days days)"; print " ".$certificate['issuer']['O'].""; - print " ".str_replace([","], "
      ", $certificate['extensions']['subjectAltName']).""; + print " ".str_replace([","], "
      ", (string) $certificate['extensions']['subjectAltName']).""; // custom fields if(sizeof(@$custom_fields) > 0) { diff --git a/public/app/tools/vlan/vlan-details.php b/public/app/tools/vlan/vlan-details.php index 62c8df34b..4608c5440 100755 --- a/public/app/tools/vlan/vlan-details.php +++ b/public/app/tools/vlan/vlan-details.php @@ -82,7 +82,7 @@ print ""; foreach($custom_fields as $key=>$field) { - $vlan[$key] = str_replace("\n", "
      ",$vlan[$key]); + $vlan[$key] = str_replace("\n", "
      ",(string) $vlan[$key]); # fix for boolean if($field['type']=="tinyint(1)" || $field['type']=="boolean") { diff --git a/public/app/tools/vrf/vrf-details.php b/public/app/tools/vrf/vrf-details.php index 6d9a135bb..5e9996b9c 100644 --- a/public/app/tools/vrf/vrf-details.php +++ b/public/app/tools/vrf/vrf-details.php @@ -108,7 +108,7 @@ print "
      "; // fields foreach($cfields as $key=>$field) { - $vrf->{$key} = str_replace("\n", "
      ",$vrf->{$key}); + $vrf->{$key} = str_replace("\n", "
      ",(string) $vrf->{$key}); // create links $vrf->{$key} = $Tools->create_links($vrf->{$key}); print ""; diff --git a/public/app/vlan/vlan-details.php b/public/app/vlan/vlan-details.php index 9d8d70a02..e180eb907 100755 --- a/public/app/vlan/vlan-details.php +++ b/public/app/vlan/vlan-details.php @@ -56,7 +56,7 @@ print "
      "; // fields foreach($cfields as $key=>$field) { - $vlan[$key] = str_replace("\n", "
      ",$vlan[$key]); + $vlan[$key] = str_replace("\n", "
      ",(string) $vlan[$key]); // create links $vlan[$key] = $Tools->create_links($vlan[$key]); print ""; diff --git a/public/app/vrf/vrf-details.php b/public/app/vrf/vrf-details.php index 1d9d92da0..7a860db5b 100755 --- a/public/app/vrf/vrf-details.php +++ b/public/app/vrf/vrf-details.php @@ -76,7 +76,7 @@ print "
      "; // fields foreach($cfields as $key=>$field) { - $vrf->{$key} = str_replace("\n", "
      ",$vrf->{$key}); + $vrf->{$key} = str_replace("\n", "
      ",(string) $vrf->{$key}); // create links $vrf->{$key} = $Tools->create_links($vrf->{$key}); print ""; diff --git a/public/index.php b/public/index.php index a5ee13052..b45ff1e0c 100644 --- a/public/index.php +++ b/public/index.php @@ -189,7 +189,7 @@ settings->siteTitle; ?>

      /", $title); + $title = str_replace(" / ", "/", (string) $title); $tmp = pf_explode($User->settings->siteTitle, $title); unset($tmp[0]); print implode($User->settings->siteTitle, $tmp); diff --git a/public/install/index.php b/public/install/index.php index 353cc6053..dcbd0fd7b 100644 --- a/public/install/index.php +++ b/public/install/index.php @@ -55,7 +55,7 @@ Make sure BASE directive is set for your installation. This is used to properly detect phpIPAM directory. It must be set in config.php and in .htaccess

      - Detected BASE: + Detected BASE:

      2.) Enable mod_rewrite

      diff --git a/public/upgrade/index.php b/public/upgrade/index.php index 657b3ddf2..966a2c035 100755 --- a/public/upgrade/index.php +++ b/public/upgrade/index.php @@ -54,7 +54,7 @@ Make sure BASE directive is set for your installation. This is used to properly detect phpIPAM directory. It must be set in config.php.
      - Detected BASE: + Detected BASE:

      2.) Enable mod_rewrite

      From b6ee319b7b7f4b329233a89810af694047fc58fc Mon Sep 17 00:00:00 2001 From: Gary Date: Fri, 1 May 2026 22:44:24 +0100 Subject: [PATCH 20/28] Bugfix: Rector PHP fixes * NullToStrictStringFuncCallArgRector (explode) --- functions/classes/class.Common.php | 8 +++---- functions/classes/class.DHCP.kea.php | 2 +- functions/classes/class.DNS.php | 2 +- functions/classes/class.FirewallZones.php | 6 ++--- functions/classes/class.Install.php | 2 +- functions/classes/class.Log.php | 2 +- functions/classes/class.PowerDNS.php | 12 +++++----- functions/classes/class.Rewrite.php | 6 ++--- functions/classes/class.SNMP.php | 4 ++-- functions/classes/class.Scan.php | 8 +++---- functions/classes/class.Sections.php | 4 ++-- functions/classes/class.Subnets.php | 16 ++++++------- functions/classes/class.SubnetsMenu.php | 2 +- functions/classes/class.Tools.php | 22 ++++++++--------- functions/classes/class.User.php | 12 +++++----- functions/global_functions.php | 3 --- functions/php_poly_fill.php | 24 ------------------- functions/scan/subnet-scan-icmp-execute.php | 2 +- functions/scan/subnet-scan-telnet-execute.php | 2 +- functions/scripts/discoveryCheck.php | 2 +- functions/scripts/find_untranslated_files.php | 4 ++-- functions/scripts/merge_databases.php | 10 ++++---- functions/scripts/pingCheck.php | 2 +- public/api/controllers/Circuits.php | 2 +- public/api/controllers/Responses.php | 2 +- .../check-connection.php | 2 +- .../circuits/edit-logical-circuit-submit.php | 2 +- public/app/admin/devices/edit-snmp.php | 2 +- public/app/admin/devices/edit.php | 2 +- .../admin/groups/ad-search-group-result.php | 2 +- public/app/admin/groups/edit-group-result.php | 2 +- .../import-export/import-ipaddr-check.php | 2 +- .../admin/import-export/import-load-data.php | 4 ++-- .../app/admin/import-export/import-verify.php | 4 ++-- public/app/admin/nameservers/edit.php | 4 ++-- public/app/admin/nameservers/index.php | 4 ++-- .../app/admin/powerDNS/domain-edit-result.php | 4 ++-- public/app/admin/powerDNS/record-edit.php | 4 ++-- .../app/admin/sections/edit-order-result.php | 4 ++-- .../app/admin/settings/logo/import-verify.php | 2 +- public/app/admin/settings/settings-save.php | 2 +- .../subnets/edit-nameserver-dropdown.php | 2 +- public/app/admin/subnets/edit.php | 6 ++--- .../ad-search-result-groups-membership.php | 2 +- public/app/admin/users/ad-search-result.php | 2 +- public/app/admin/users/edit-result.php | 2 +- public/app/admin/vaults/edit-result.php | 2 +- .../vaults/import-certificate-file-verify.php | 2 +- public/app/admin/version-check/index.php | 2 +- public/app/admin/vlans/edit-domain.php | 2 +- public/app/admin/vrf/edit.php | 2 +- public/app/dashboard/index.php | 2 +- public/app/dashboard/widget-popup.php | 2 +- public/app/dashboard/widgets/changelog.php | 2 +- public/app/json/section/subnets.php | 2 +- public/app/saml2/index.php | 6 ++--- .../addresses/address-details-index.php | 4 ++-- .../addresses/address-modify-submit.php | 2 +- .../app/subnets/addresses/address-modify.php | 2 +- .../subnets/addresses/mail-notify-check.php | 6 ++--- .../subnets/addresses/print-address-table.php | 2 +- .../app/subnets/import-subnet/import-file.php | 2 +- .../subnets/import-subnet/import-verify.php | 2 +- .../app/subnets/import-subnet/print-file.php | 2 +- .../subnet-scan-execute-scan-snmp-arp.php | 4 ++-- .../scan/subnet-scan-execute-scan-telnet.php | 2 +- .../scan/subnet-scan-execute-snmp-mac.php | 6 ++--- .../subnet-scan-execute-snmp-route-all.php | 4 ++-- .../subnet-scan-execute-update-snmp-arp.php | 2 +- .../subnet-scan-result-snmp-route-all.php | 2 +- public/app/temp_share/address.php | 4 ++-- public/app/temp_share/subnet-addresses.php | 4 ++-- public/app/tools/changelog/show-popup.php | 2 +- .../customer/objects/ipaddresses.php | 2 +- .../app/tools/devices/all-devices-filter.php | 2 +- .../devices/device-details/device-details.php | 6 ++--- public/app/tools/pass-change/result.php | 2 +- public/app/tools/powerDNS/domain-records.php | 2 +- public/app/tools/powerDNS/domains-print.php | 2 +- .../tools/search/search-results-export.php | 2 +- public/app/tools/search/search-results.php | 2 +- public/app/tools/temp-shares/edit-result.php | 4 ++-- public/app/tools/tools-menu.php | 2 +- public/app/tools/user-menu/user-edit.php | 2 +- public/app/tools/user-menu/widgets.php | 2 +- public/app/tools/vlan/domains.php | 2 +- public/app/tools/vrf/all_vrf.php | 2 +- public/app/tools/vrf/vrf-details.php | 2 +- public/app/vrf/vrf-details.php | 2 +- public/index.php | 2 +- 90 files changed, 155 insertions(+), 182 deletions(-) delete mode 100644 functions/php_poly_fill.php diff --git a/functions/classes/class.Common.php b/functions/classes/class.Common.php index 7793ba7eb..e6b56c1b6 100644 --- a/functions/classes/class.Common.php +++ b/functions/classes/class.Common.php @@ -159,13 +159,13 @@ public function __construct () { * Compare dotted version numbers 1.21.0 <=> 1.4.10 * * @access public - * @param string $verA + * @param mixed $verA * @param mixed $verB * @return int */ public function cmp_version_strings($verA, $verB) { - $a = array_pad(pf_explode('.', $verA), 3, 0); - $b = array_pad(pf_explode('.', $verB), 3, 0); + $a = array_pad(explode('.', (string) $verA), 3, 0); + $b = array_pad(explode('.', (string) $verB), 3, 0); if ($a[0] != $b[0]) return $a[0] < $b[0] ? -1 : 1; // 1.x.y is less than 2.x.y if (strcmp((string) $a[1], (string) $b[1]) != 0) return strcmp((string) $a[1], (string) $b[1]); // 1.21.y is less than 1.3.y @@ -1509,7 +1509,7 @@ private function create_custom_field_input_set_enum ($field, $object, $disabled_ $html = []; //parse values $field['type'] = trim(substr((string) $field['type'],0,-1)); - $tmp = substr($field['type'], 0,3)=="set" ? pf_explode(",", str_replace(["set(", "'"], "", $field['type'])) : pf_explode(",", str_replace(["enum(", "'"], "", $field['type'])); + $tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(["set(", "'"], "", $field['type'])) : explode(",", str_replace(["enum(", "'"], "", $field['type'])); //null if($field['Null']!="NO") { array_unshift($tmp, ""); } diff --git a/functions/classes/class.DHCP.kea.php b/functions/classes/class.DHCP.kea.php index 45e2056a6..3145a2a2b 100644 --- a/functions/classes/class.DHCP.kea.php +++ b/functions/classes/class.DHCP.kea.php @@ -327,7 +327,7 @@ private function get_leases_memfile ($lease_database, $type) { foreach ($leases_from_file as $l) { if(strlen($l)>1) { // to array - $l = pf_explode(",", $l); + $l = explode(",", (string) $l); // set state switch ($l[9]) { diff --git a/functions/classes/class.DNS.php b/functions/classes/class.DNS.php index b0f815717..ee88a1d23 100644 --- a/functions/classes/class.DNS.php +++ b/functions/classes/class.DNS.php @@ -150,7 +150,7 @@ private function set_nameservers ($nsid = null) { } else { // to array - $nsarray = pf_explode(";", $nameservers->namesrv1); + $nsarray = explode(";", (string) $nameservers->namesrv1); // check against dead NSes foreach ($nsarray as $k=>$nsserv) { $nsserv = trim($nsserv); diff --git a/functions/classes/class.FirewallZones.php b/functions/classes/class.FirewallZones.php index d5962e175..e8bb2c626 100644 --- a/functions/classes/class.FirewallZones.php +++ b/functions/classes/class.FirewallZones.php @@ -1078,7 +1078,7 @@ public function generate_address_object ($id,$dnsName) { } break; case 'patternHost': - $hostName = pf_explode('.', $dnsName); + $hostName = explode('.', (string) $dnsName); $firewallAddressObject = $firewallAddressObject.$hostName[0]; break; case 'patternFQDN': @@ -1133,7 +1133,7 @@ public function update_address_object ($subnetId,$IPId,$dnsName) { } break; case 'patternHost': - $hostName = pf_explode('.', $dnsName); + $hostName = explode('.', (string) $dnsName); $firewallAddressObject = $firewallAddressObject.$hostName[0]; break; case 'patternFQDN': @@ -1211,7 +1211,7 @@ public function update_address_objects ($subnetId) { } break; case 'patternHost': - $hostName = pf_explode('.', $ipaddress->hostname); + $hostName = explode('.', (string) $ipaddress->hostname); $firewallAddressObject = $firewallAddressObject.$hostName[0]; break; case 'patternFQDN': diff --git a/functions/classes/class.Install.php b/functions/classes/class.Install.php index ae8cb377a..68485691e 100644 --- a/functions/classes/class.Install.php +++ b/functions/classes/class.Install.php @@ -179,7 +179,7 @@ private function install_database_execute ($migrate = false) { } # formulate queries - $queries = array_filter(pf_explode(";\n", $query)); + $queries = array_filter(explode(";\n", (string) $query)); # append version $queries[] = "UPDATE `settings` SET `version` = '".VERSION."'"; diff --git a/functions/classes/class.Log.php b/functions/classes/class.Log.php index 83e9b964e..7e08c8f5e 100644 --- a/functions/classes/class.Log.php +++ b/functions/classes/class.Log.php @@ -1839,7 +1839,7 @@ public function changelog_send_mail ($changelog) { $content[] = ""; // add changelog $changelog = str_replace("\r\n", "
      ",$changelog); - $changelog = array_filter(pf_explode("
      ", $changelog)); + $changelog = array_filter(explode("
      ", $changelog)); $content[] = ""; foreach ($changelog as $c) { diff --git a/functions/classes/class.PowerDNS.php b/functions/classes/class.PowerDNS.php index 4d920e329..ee7cac98d 100644 --- a/functions/classes/class.PowerDNS.php +++ b/functions/classes/class.PowerDNS.php @@ -1060,7 +1060,7 @@ private function update_soa_serial ($domain_id, $serial = false) { else { $soa = $soa[0]; } // update serial it not autoserial - $soa_serial = pf_explode(" ", $soa->content); + $soa_serial = explode(" ", (string) $soa->content); $soa_serial[2] = $this->db_settings->autoserial=="Yes" ? 0 : (int) $soa_serial[2]+1; // if serail set override it @@ -1114,7 +1114,7 @@ public function create_default_records ($values, $checkOnly = false) { // content $soa = []; - $soa[] = array_shift(pf_explode(";", $values['ns'])); + $soa[] = array_shift(explode(";", (string) $values['ns'])); $soa[] = str_replace ("@", ".", (string) $values['hostmaster']); $soa[] = date("Ymd")."00"; $soa[] = $this->validate_refresh ($values['refresh']); @@ -1126,7 +1126,7 @@ public function create_default_records ($values, $checkOnly = false) { $records[] = $this->formulate_new_record ($this->lastId, $values['name'], "SOA", implode(" ", $soa), $values['ttl'], null, 0, $checkOnly); // formulate NS records - $ns = pf_explode(";", $values['ns']); + $ns = explode(";", (string) $values['ns']); if (sizeof($ns)>0) { foreach($ns as $s) { // validate @@ -1464,7 +1464,7 @@ public function get_ptr_zone_name_v4 ($ip, $mask) { $bits = $mask<24 ? 2 : 1; // to array - $zone = pf_explode(".", $ip); + $zone = explode(".", (string) $ip); // create name if ($bits==1) { return $zone[2].".".$zone[1].".".$zone[0].".in-addr.arpa"; } @@ -1508,7 +1508,7 @@ public function get_ip_ptr_name ($ip) { // set zone prefix and reverse content if ($this->identify_address ($ip)=="IPv4") { $prefix = ".in-addr.arpa"; - $zone = array_reverse(pf_explode(".", $ip)); + $zone = array_reverse(explode(".", (string) $ip)); } else { // PEAR for IPv6 @@ -1518,7 +1518,7 @@ public function get_ip_ptr_name ($ip) { $ip = $this->Net_IPv6->removeNetmaskSpec($ip); // to array - $ip = pf_explode(":", $ip); + $ip = explode(":", $ip); // if 0 than add 4 nulls foreach ($ip as $k=>$i) { diff --git a/functions/classes/class.Rewrite.php b/functions/classes/class.Rewrite.php index e1dcaafc6..8ab67dfad 100644 --- a/functions/classes/class.Rewrite.php +++ b/functions/classes/class.Rewrite.php @@ -133,10 +133,10 @@ private function process_request_uri () { // ignore for direct access if(strpos((string) $_SERVER['REQUEST_URI'], "index.php")===false) { if(BASE!="/") { - $this->uri_parts = array_values(array_filter(pf_explode("/", str_replace((string) BASE, "", (string) $_SERVER['REQUEST_URI'])))); + $this->uri_parts = array_values(array_filter(explode("/", str_replace((string) BASE, "", (string) $_SERVER['REQUEST_URI'])))); } else { - $this->uri_parts = array_values(array_filter(pf_explode("/", $_SERVER['REQUEST_URI']))); + $this->uri_parts = array_values(array_filter(explode("/", (string) $_SERVER['REQUEST_URI']))); } // urldecode uri_parts @@ -208,7 +208,7 @@ private function create_get_params_ui () { */ private function append_qsa () { if(strpos((string) $_SERVER['REQUEST_URI'], "?")!==false) { - $parts = pf_explode("?", $_SERVER['REQUEST_URI']); + $parts = explode("?", (string) $_SERVER['REQUEST_URI']); $parts = $parts[1]; // parse parse_str ($parts, $out); diff --git a/functions/classes/class.SNMP.php b/functions/classes/class.SNMP.php index 685934215..c5b96dd9c 100644 --- a/functions/classes/class.SNMP.php +++ b/functions/classes/class.SNMP.php @@ -767,7 +767,7 @@ private function get_vlan_table () { foreach ($res1 as $k=>$r) { // set number $k = str_replace($this->snmp_oids['CISCO-VTP-MIB::vtpVlanName'].'.1.', "", (string) $k); - $k = array_pop(pf_explode(".", $k)); + $k = array_pop(explode(".", $k)); // set value $r = trim(str_replace("\"","",substr((string) $r, strpos((string) $r, ":")+2))); $res[$k] = $r; @@ -790,7 +790,7 @@ private function decode_mplsVpnVrfName($oid) { // the first octet is the string length, and subsequent octets are // the ASCII codes of each character. // For example, “vpn1” is represented as 4.118.112.110.49. - $a = array_values(array_filter(pf_explode('.', $oid))); + $a = array_values(array_filter(explode('.', $oid))); if (($a[0]+1) != sizeof($a)) return $oid; diff --git a/functions/classes/class.Scan.php b/functions/classes/class.Scan.php index 8e9aa1122..86a75ec3b 100644 --- a/functions/classes/class.Scan.php +++ b/functions/classes/class.Scan.php @@ -347,7 +347,7 @@ protected function ping_address_method_ping($address) { # for IPv6 remove wait if ($this->identify_address($address) == "IPv6") { - $cmd = pf_explode(" ", $cmd); + $cmd = explode(" ", $cmd); unset($cmd[3], $cmd[4]); $cmd = implode(" ", $cmd); } @@ -475,7 +475,7 @@ public function ping_address_method_fping($address) { */ private function save_fping_rtt ($line) { // 173.192.112.30 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 160/160/160 - $tmp = pf_explode(" ",$line); + $tmp = explode(" ",(string) $line); # save rtt if (is_array($tmp) && isset($tmp[7])) @@ -515,7 +515,7 @@ public function ping_address_method_fping_subnet ($subnet_cidr, $return_result = if (!$match || $matches[1] == 100) continue; - $tmp = pf_explode(" ", $line); + $tmp = explode(" ", $line); $out[] = $tmp[0]; } } @@ -720,7 +720,7 @@ public function update_address_tag ($address_id, $tag_id = 2, $old_tag_id = null */ public function telnet_address ($address, $port) { # set all ports - $ports = pf_explode(",", str_replace(";",",",(string) $port)); + $ports = explode(",", str_replace(";",",",(string) $port)); # default response is dead $retval = 1; //try each port until one is alive diff --git a/functions/classes/class.Sections.php b/functions/classes/class.Sections.php index 801b2a00c..0a5d2ab05 100644 --- a/functions/classes/class.Sections.php +++ b/functions/classes/class.Sections.php @@ -361,7 +361,7 @@ public function fetch_section_domains ($sectionId) { } else { //array - if(in_array($sectionId, pf_explode(";", $d->permissions))) { + if(in_array($sectionId, explode(";", (string) $d->permissions))) { $permitted[] = $d->id; } } @@ -391,7 +391,7 @@ public function fetch_section_nameserver_sets ($sectionId) { } else { //array - if(in_array($sectionId, pf_explode(";", $n->permissions))) { + if(in_array($sectionId, explode(";", (string) $n->permissions))) { $permitted[] = $n->id; } } diff --git a/functions/classes/class.Subnets.php b/functions/classes/class.Subnets.php index 5c0d4da39..f3c8ba7d9 100644 --- a/functions/classes/class.Subnets.php +++ b/functions/classes/class.Subnets.php @@ -1070,7 +1070,7 @@ public function get_ipv4_masks () { $out[$mask]->wildcard = long2ip(~ip2long($net->netmask)); //0.0.255.255 // binary - $parts = pf_explode(".", $net->netmask); + $parts = explode(".", (string) $net->netmask); foreach($parts as $k=>$p) { $parts[$k] = str_pad(decbin($p),8, 0); } $out[$mask]->binary = implode(".", $parts); } @@ -1105,7 +1105,7 @@ public function get_ipv4_masks_for_subnet ($subnet_mask = "32") { $out[$mask]->wildcard = long2ip(~ip2long($net->netmask)); //0.0.255.255 // binary - $parts = pf_explode(".", $net->netmask); + $parts = explode(".", (string) $net->netmask); foreach($parts as $k=>$p) { $parts[$k] = str_pad(decbin($p),8, 0); } $out[$mask]->binary = implode(".", $parts); } @@ -2853,7 +2853,7 @@ public function create_multicast_mac ($address) { // ipv4 if ($this->identify_address ($address)=="IPv4") { // to array - $mac_tmp = pf_explode(".", $address); + $mac_tmp = explode(".", (string) $address); // check 3rd octet if ($mac_tmp[1]>=128) { $mac_tmp[1]=$mac_tmp[1]-128; } // create mac @@ -2865,7 +2865,7 @@ public function create_multicast_mac ($address) { //expand $expanded = $this->Net_IPv6->uncompress($address); // to array - $mac_tmp = pf_explode(":", $expanded); + $mac_tmp = explode(":", $expanded); $mac = strtolower("33:33:".str_pad(dechex($mac_tmp[4]),2,"0",STR_PAD_LEFT).":".str_pad(dechex($mac_tmp[5]),2,"0",STR_PAD_LEFT).":".str_pad(dechex($mac_tmp[6]),2,"0",STR_PAD_LEFT).":".str_pad(dechex($mac_tmp[7]),2,"0",STR_PAD_LEFT)); } else { @@ -2970,7 +2970,7 @@ private function multicast_address_exists ($mac, $sectionId, $vlanId, $unique_re public function validate_multicast_mac ($mac, $sectionId, $vlanId, $unique_required="vlan", $address_id = 0) { // first put it to common format (1) $mac = $this->reformat_mac_address ($mac); - $mac_delimited = pf_explode(":", $mac); + $mac_delimited = explode(":", $mac); // we permit empty if (is_blank($mac)) { return true; @@ -3565,7 +3565,7 @@ public function resolve_ripe_arin ($subnet) { // set subnet allocations $this->define_ripe_arin_subnets (); // take only first bit of ip address to match /8 delegations - $subnet_check = reset(pf_explode(".", $subnet)); + $subnet_check = reset(explode(".", $subnet)); // ripe or arin? if (in_array($subnet_check, $this->ripe)) { return $this->query_ripe ($subnet); } elseif (in_array($subnet_check, $this->arin)) { return $this->query_arin ($subnet); } @@ -3719,7 +3719,7 @@ public function ripe_fetch_subnets ($as) { while (!feof($ripe_connection)) { $out .= fgets($ripe_connection); } //parse it - $out = pf_explode("\n", $out); + $out = explode("\n", $out); //we only want lines starting with route or route6 $subnet = []; @@ -3728,7 +3728,7 @@ public function ripe_fetch_subnets ($as) { //replace route6 with route $line = str_replace("route6:", "route:", $line); //only take IP address - $line = pf_explode("route:", $line); + $line = explode("route:", $line); $line = trim($line[1]); //set result $subnet[] = $line; diff --git a/functions/classes/class.SubnetsMenu.php b/functions/classes/class.SubnetsMenu.php index 05ca904c6..6164b8570 100644 --- a/functions/classes/class.SubnetsMenu.php +++ b/functions/classes/class.SubnetsMenu.php @@ -52,7 +52,7 @@ public function __construct($Subnets, $expanded, $expandall, $selected) { $this->Subnets = $Subnets; $this->Subnets->get_Settings(); if (isset($expanded)) { - $expanded = array_filter(pf_explode("|", $expanded)); + $expanded = array_filter(explode("|", $expanded)); // Store expanded subnets/folders to allow fast index lookups. foreach($expanded as $e) $this->expanded[$e] = 1; } diff --git a/functions/classes/class.Tools.php b/functions/classes/class.Tools.php index a3776605c..1290b1e9d 100644 --- a/functions/classes/class.Tools.php +++ b/functions/classes/class.Tools.php @@ -568,7 +568,7 @@ public function reformat_IPv4_for_search ($address) { # else calculate options else { # if subnet is not provided maybe wildcard is, so explode it to array - $address = pf_explode(".", $address); + $address = explode(".", $address); # remove empty foreach($address as $k=>$a) { if (is_blank($a)) unset($address[$k]); @@ -804,7 +804,7 @@ public function fetch_schema_version() { $dbversion = strstr($schema, 'UPDATE `settings` SET `dbversion` ='); $dbversion = strstr($dbversion, ';', true); - $dbversion = pf_explode("=", $dbversion); + $dbversion = explode("=", (string) $dbversion); return intval($dbversion[1]); } @@ -825,7 +825,7 @@ public function fetch_standard_fields ($table) { $definition = trim(strstr($definition, ";" . "\n", true)); # get each line to array - $definition = pf_explode("\n", $definition); + $definition = explode("\n", $definition); # go through,if it begins with ` use it ! $out = []; @@ -850,7 +850,7 @@ public function fetch_standard_tables () { $schema = $this->read_db_schema(); # get definitions to array, explode with CREATE TABLE ` - $creates = pf_explode("CREATE TABLE `", $schema); + $creates = explode("CREATE TABLE `", $schema); # fill tables array $tables = []; foreach($creates as $k=>$c) { @@ -1418,7 +1418,7 @@ public function get_field_fix ($table, $field) { $file = trim(strstr($file, "# Dump of table", true)); //get proper line - $file = pf_explode("\n", $file); + $file = explode("\n", $file); foreach($file as $k=>$l) { if(strpos(trim($l), "$field`")==1) { $res = trim($l, ","); @@ -1514,7 +1514,7 @@ private function get_schema_indexes () { $schema = $this->read_db_schema(); # get definitions to array, explode with CREATE TABLE ` - $creates = pf_explode("CREATE TABLE `", $schema); + $creates = explode("CREATE TABLE `", $schema); $indexes = []; foreach($creates as $k=>$c) { @@ -1523,7 +1523,7 @@ private function get_schema_indexes () { $table = strstr($c, "`", true); - $definitions = pf_explode("\n", $c); + $definitions = explode("\n", $c); foreach($definitions as $definition) { if (preg_match('/(KEY|UNIQUE KEY) +`(.*)` +\(/', $definition, $matches)) { $indexes[$table][] = $matches[2]; @@ -1596,7 +1596,7 @@ private function fix_missing_index ($table, $index_name) { $file = trim(strstr($file, "# Dump of table", true)); //get proper line - $file = pf_explode("\n", $file); + $file = explode("\n", $file); $line = false; foreach($file as $k=>$l) { @@ -1956,7 +1956,7 @@ public function reverse_IPv6 ($addresses, $pflen=128) { //uncompress $uncompressed = $this->Net_IPv6->removeNetmaskSpec($this->Net_IPv6->uncompress($addresses)); $len = $pflen / 4; - $parts = pf_explode(':', $uncompressed); + $parts = explode(':', $uncompressed); $res = ''; foreach($parts as $part) { $res .= str_pad($part, 4, '0', STR_PAD_LEFT); @@ -2047,7 +2047,7 @@ public function translate_nat_objects_for_display ($json_objects, $nat_id = fals $out = []; // set ping statuses for warning and offline $this->get_settings(); - $statuses = pf_explode(";", $this->settings->pingStatus); + $statuses = explode(";", (string) $this->settings->pingStatus); // check if(is_array($objects)) { if(sizeof($objects)>0) { @@ -2844,7 +2844,7 @@ public function calculate_prefix_usage_sort_numbers ($numbers) { * @return mixed */ public function explode_filtered($delimiter, $string) { - $ret = pf_explode($delimiter, $string); + $ret = explode($delimiter, $string); if (!is_array($ret)) return false; return array_filter($ret); diff --git a/functions/classes/class.User.php b/functions/classes/class.User.php index 7b926b514..6c1b73d63 100644 --- a/functions/classes/class.User.php +++ b/functions/classes/class.User.php @@ -668,7 +668,7 @@ public function fetch_favourite_subnets () { # ok else { # store to array - $subnets = pf_explode(";", $this->user->favourite_subnets); + $subnets = explode(";", (string) $this->user->favourite_subnets); $subnets = array_filter($subnets); if(sizeof($subnets)>0) { @@ -719,7 +719,7 @@ public function edit_favourite($action, $subnetId) { */ private function remove_favourite ($subnetId) { # set old favourite subnets - $old_favourites = pf_explode(";", $this->user->favourite_subnets); + $old_favourites = explode(";", (string) $this->user->favourite_subnets); # set new $new_favourites = implode(";", array_diff($old_favourites, [$subnetId])); # update @@ -739,7 +739,7 @@ private function remove_favourite ($subnetId) { */ private function add_favourite ($subnetId) { # set old favourite subnets - $old_favourites = pf_explode(";", $this->user->favourite_subnets); + $old_favourites = explode(";", (string) $this->user->favourite_subnets); $old_favourites = is_array($old_favourites) ? $old_favourites : []; # set new $new_favourites = implode(";",array_merge([$subnetId], $old_favourites)); @@ -760,7 +760,7 @@ private function add_favourite ($subnetId) { */ public function is_subnet_favourite ($subnetId) { # check if in array - $subnets = pf_explode(";", $this->user->favourite_subnets); + $subnets = explode(";", (string) $this->user->favourite_subnets); $subnets = array_filter($subnets); # result return in_array($subnetId, $subnets) ? true : false; @@ -1037,7 +1037,7 @@ private function directory_connect ($authparams) { $dirparams['base_dn'] = @$authparams['base_dn']; $dirparams['ad_port'] = @$authparams['ad_port']; $dirparams['account_suffix'] = @$authparams['account_suffix']; - $dirparams['domain_controllers'] = pf_explode(";", str_replace(" ", "", (string) $authparams['domain_controllers'])); + $dirparams['domain_controllers'] = explode(";", str_replace(" ", "", (string) $authparams['domain_controllers'])); // set ssl and tls separate for ldap and AD if ($this->ldap) { // set ssl and tls @@ -1964,7 +1964,7 @@ public function get_l2domain_permissions ($l2domain) { $max_permission = 0; - $ids = pf_explode(";", $valid_sections); + $ids = explode(";", (string) $valid_sections); foreach($ids as $id) { $section = $this->fetch_object("sections", "id", $id); diff --git a/functions/global_functions.php b/functions/global_functions.php index 7e3ac7d62..49a6b9086 100644 --- a/functions/global_functions.php +++ b/functions/global_functions.php @@ -251,6 +251,3 @@ function gmp_pow2(int $exp) : GMP { gmp_setbit($result, $exp); return $result; } - -// Include backwards compatibility wrapper functions. -require_once __DIR__ . '/php_poly_fill.php'; diff --git a/functions/php_poly_fill.php b/functions/php_poly_fill.php deleted file mode 100644 index c04a3ce37..000000000 --- a/functions/php_poly_fill.php +++ /dev/null @@ -1,24 +0,0 @@ -fping_result as $l) { //split - $field = array_filter(pf_explode(" ", $l)); + $field = array_filter(explode(" ", (string) $l)); //create result $out['alive'][] = $Subnets->transform_to_decimal($field[0]); } diff --git a/functions/scan/subnet-scan-telnet-execute.php b/functions/scan/subnet-scan-telnet-execute.php index 9c96b70dc..b6eb8eb8c 100755 --- a/functions/scan/subnet-scan-telnet-execute.php +++ b/functions/scan/subnet-scan-telnet-execute.php @@ -58,7 +58,7 @@ /* test */ -$ports = pf_explode(";", $argv[2]); +$ports = explode(";", $argv[2]); $out = []; diff --git a/functions/scripts/discoveryCheck.php b/functions/scripts/discoveryCheck.php index 9532a0d2e..30114df10 100755 --- a/functions/scripts/discoveryCheck.php +++ b/functions/scripts/discoveryCheck.php @@ -50,7 +50,7 @@ } // set ping statuses -$statuses = pf_explode(";", $Scan->settings->pingStatus); +$statuses = explode(";", (string) $Scan->settings->pingStatus); // set mail override flag if (!isset($config['discovery_check_send_mail'])) { $config['discovery_check_send_mail'] = true; diff --git a/functions/scripts/find_untranslated_files.php b/functions/scripts/find_untranslated_files.php index 08fb1639c..286c5e479 100755 --- a/functions/scripts/find_untranslated_files.php +++ b/functions/scripts/find_untranslated_files.php @@ -13,7 +13,7 @@ require_once __DIR__ . '/../functions.php'; // search for all translated words and put them to array -$untranslated = pf_explode("\n",shell_exec("cd " . __DIR__ . "/../../ && grep -r '_(' * ")); +$untranslated = explode("\n",(string) shell_exec("cd " . __DIR__ . "/../../ && grep -r '_(' * ")); // loop and search foreach ($untranslated as $u) { // find string @@ -39,7 +39,7 @@ // search all existing translations -$untranslated = pf_explode("\n",shell_exec("cd " . __DIR__ . "/../../ && more functions/locale/en/LC_MESSAGES/phpipam.po")); +$untranslated = explode("\n",(string) shell_exec("cd " . __DIR__ . "/../../ && more functions/locale/en/LC_MESSAGES/phpipam.po")); // loop and create foreach ($untranslated as $u) { // search for string diff --git a/functions/scripts/merge_databases.php b/functions/scripts/merge_databases.php index c1c9f599f..79d187df9 100755 --- a/functions/scripts/merge_databases.php +++ b/functions/scripts/merge_databases.php @@ -225,7 +225,7 @@ } // sections if(strlen((string) $value_obj->sections)>1) { - $sections = pf_explode(";", $value_obj->sections); + $sections = explode(";", (string) $value_obj->sections); $sections_new = []; foreach ($sections as $k=>$v) { $sections_new[$highest_ids_append["sections"] + $k] = $v; @@ -271,7 +271,7 @@ } // favourite subnets if(!is_blank($value_obj->favourite_subnets)) { - $fs_tmp = pf_explode(";", $value_obj->favourite_subnets); + $fs_tmp = explode(";", (string) $value_obj->favourite_subnets); $fs_new = []; foreach ($fs_tmp as $gid) { $fs_new[] = $gid+$highest_ids_append["subnets"]; @@ -299,7 +299,7 @@ $new_data[$table][$lk]->id = $highest_ids_append[$table] + $value_obj->id; // permissions if(!is_blank($value_obj->permissions)) { - $fs_tmp = pf_explode(";", $value_obj->permissions); + $fs_tmp = explode(";", (string) $value_obj->permissions); $fs_new = []; foreach ($fs_tmp as $gid) { $fs_new[] = $gid+$highest_ids_append["sections"]; @@ -315,7 +315,7 @@ $new_data[$table][$lk]->vrfId = $highest_ids_append[$table] + $value_obj->vrfId; // sections if(!is_blank($value_obj->sections)) { - $fs_tmp = pf_explode(";", $value_obj->sections); + $fs_tmp = explode(";", (string) $value_obj->sections); $fs_new = []; foreach ($fs_tmp as $gid) { $fs_new[] = $gid+$highest_ids_append["sections"]; @@ -331,7 +331,7 @@ $new_data[$table][$lk]->id = $highest_ids_append[$table] + $value_obj->id; // permissions if(!is_blank($value_obj->permissions)) { - $fs_tmp = pf_explode(";", $value_obj->permissions); + $fs_tmp = explode(";", (string) $value_obj->permissions); $fs_new = []; foreach ($fs_tmp as $gid) { $fs_new[] = $gid+$highest_ids_append["sections"]; diff --git a/functions/scripts/pingCheck.php b/functions/scripts/pingCheck.php index 5966ee135..117d56c38 100755 --- a/functions/scripts/pingCheck.php +++ b/functions/scripts/pingCheck.php @@ -59,7 +59,7 @@ } // set ping statuses -$statuses = pf_explode(";", $Scan->settings->pingStatus); +$statuses = explode(";", (string) $Scan->settings->pingStatus); // set mail override flag if (!isset($config['ping_check_send_mail'])) { $config['ping_check_send_mail'] = true; diff --git a/public/api/controllers/Circuits.php b/public/api/controllers/Circuits.php index f5dae49bc..a0f37cda1 100644 --- a/public/api/controllers/Circuits.php +++ b/public/api/controllers/Circuits.php @@ -433,7 +433,7 @@ private function validate_cid ($action, $old_object) { private function validate_circuit_type ($action="add") { if(isset($this->_params->type)) { $type_desc = $this->Database->getFieldInfo ("circuits", "type"); - $all_types = pf_explode(",", str_replace(["enum","(",")","'"], "",(string) $type_desc->Type)); + $all_types = explode(",", str_replace(["enum","(",")","'"], "",(string) $type_desc->Type)); if(!in_array($this->_params->type, $all_types)) { $this->Response->throw_exception(400, "Invalid circuit type"); } } else { diff --git a/public/api/controllers/Responses.php b/public/api/controllers/Responses.php index 74fb4c759..35c52099d 100644 --- a/public/api/controllers/Responses.php +++ b/public/api/controllers/Responses.php @@ -82,7 +82,7 @@ public function formulate_result ($result, $time = false, $nest_custom_fields = public function validate_content_type () { // remove charset if provided if(isset($_SERVER['CONTENT_TYPE'])) - $_SERVER['CONTENT_TYPE'] = array_shift(pf_explode(";", $_SERVER['CONTENT_TYPE'])); + $_SERVER['CONTENT_TYPE'] = array_shift(explode(";", (string) $_SERVER['CONTENT_TYPE'])); // not set, presume json if( !isset($_SERVER['CONTENT_TYPE']) || strlen((string) @$_SERVER['CONTENT_TYPE'])==0 ) {} // post diff --git a/public/app/admin/authentication-methods/check-connection.php b/public/app/admin/authentication-methods/check-connection.php index 56826c44f..eaf5e06a5 100644 --- a/public/app/admin/authentication-methods/check-connection.php +++ b/public/app/admin/authentication-methods/check-connection.php @@ -27,7 +27,7 @@ # AD? if($auth_settings->type=="AD" || $auth_settings->type=="LDAP" || $auth_settings->type=="NetIQ") { # set controllers - $controllers = pf_explode(";", str_replace(" ", "", (string) $parameters->domain_controllers)); + $controllers = explode(";", str_replace(" ", "", (string) $parameters->domain_controllers)); //open connection try { diff --git a/public/app/admin/circuits/edit-logical-circuit-submit.php b/public/app/admin/circuits/edit-logical-circuit-submit.php index 1841dd889..5dcd6ce46 100644 --- a/public/app/admin/circuits/edit-logical-circuit-submit.php +++ b/public/app/admin/circuits/edit-logical-circuit-submit.php @@ -40,7 +40,7 @@ # Validate to make sure there aren't duplicates of the same circuit in the list of circuit ids # Create list of member circuit IDs for mapping $POST->circuit_list = str_replace("undefined.", "", (string) $POST->circuit_list); -$id_list = $POST->circuit_list!=="" ? pf_explode("." , rtrim((string) $POST->circuit_list,".")) : []; +$id_list = $POST->circuit_list!=="" ? explode("." , rtrim((string) $POST->circuit_list,".")) : []; if(sizeof($id_list ) != sizeof(array_unique($id_list))){ $Result->show("danger", _('Remove duplicates of circuit').'!', true); } if($POST->action == "add" && sizeof($id_list) == 0){ $Result->show("danger", _('No circuits selected').'!', true); } diff --git a/public/app/admin/devices/edit-snmp.php b/public/app/admin/devices/edit-snmp.php index 70d523f33..cae1905ae 100644 --- a/public/app/admin/devices/edit-snmp.php +++ b/public/app/admin/devices/edit-snmp.php @@ -215,7 +215,7 @@ '. "\n"; diff --git a/public/app/admin/powerDNS/domain-edit-result.php b/public/app/admin/powerDNS/domain-edit-result.php index bb9354516..3beae319a 100644 --- a/public/app/admin/powerDNS/domain-edit-result.php +++ b/public/app/admin/powerDNS/domain-edit-result.php @@ -41,7 +41,7 @@ // if multiple masters if (strpos((string) $POST->master, ",")!==false) { // to array and trim, check each - $masters = array_filter(pf_explode(",", $POST->master)); + $masters = array_filter(explode(",", (string) $POST->master)); foreach ($masters as $m) { if(!filter_var($m, FILTER_VALIDATE_IP)) { $Result->show("danger", _("Master must be an IP address"). " - ". $m, true); } } @@ -64,7 +64,7 @@ else { if (strpos((string) $POST->master, ",")!==false) { // to array and trim, check each - $masters = array_filter(pf_explode(",", $POST->master)); + $masters = array_filter(explode(",", (string) $POST->master)); foreach ($masters as $m) { if(!filter_var($m, FILTER_VALIDATE_IP)) { $Result->show("danger", _("Master must be an IP address"). " - ". $m, true); } } diff --git a/public/app/admin/powerDNS/record-edit.php b/public/app/admin/powerDNS/record-edit.php index fee644e4b..20eb55a61 100644 --- a/public/app/admin/powerDNS/record-edit.php +++ b/public/app/admin/powerDNS/record-edit.php @@ -52,11 +52,11 @@ if ($all_domains!==false) { // Reverse the hostname, this fixes #1471 and #2374 - $r_hostdomain = implode(".", array_reverse(array_slice(pf_explode(".", $POST->domain_id), 1))); + $r_hostdomain = implode(".", array_reverse(array_slice(explode(".", (string) $POST->domain_id), 1))); foreach($all_domains as $dk=>$domain_s) { // Reverse the domain and compare it reversed, this fixes #1471 and #2374 - $r_domain = implode(".", array_reverse(pf_explode(".", $domain_s->name))); + $r_domain = implode(".", array_reverse(explode(".", (string) $domain_s->name))); if (substr($r_hostdomain, 0, strlen($r_domain)) == $r_domain) { $matches[$dk] = $domain_s; diff --git a/public/app/admin/sections/edit-order-result.php b/public/app/admin/sections/edit-order-result.php index d8bc075ac..054d480ea 100755 --- a/public/app/admin/sections/edit-order-result.php +++ b/public/app/admin/sections/edit-order-result.php @@ -20,9 +20,9 @@ $User->check_maintaneance_mode (); # create array of ordering -$otmp = pf_explode(";", $POST->position); +$otmp = explode(";", (string) $POST->position); foreach($otmp as $ot) { - $ptmp = pf_explode(":", $ot); + $ptmp = explode(":", $ot); $order[$ptmp[0]] = $ptmp[1]; } diff --git a/public/app/admin/settings/logo/import-verify.php b/public/app/admin/settings/logo/import-verify.php index 7995e38c7..bc3c39743 100644 --- a/public/app/admin/settings/logo/import-verify.php +++ b/public/app/admin/settings/logo/import-verify.php @@ -21,7 +21,7 @@ /* get extension */ $filename = $_FILES['file']['name']; -$filename = pf_explode(".", $filename); +$filename = explode(".", (string) $filename); $filename = end($filename); /* list of permitted file extensions */ diff --git a/public/app/admin/settings/settings-save.php b/public/app/admin/settings/settings-save.php index 3d21482ba..be5bd09a9 100755 --- a/public/app/admin/settings/settings-save.php +++ b/public/app/admin/settings/settings-save.php @@ -34,7 +34,7 @@ //verify ping status fields $POST->pingStatus = str_replace(" ", "", (string) $POST->pingStatus); //remove possible spaces $POST->pingStatus = str_replace(",", ";", (string) $POST->pingStatus); //change possible , for ; -$statuses = pf_explode(";", $POST->pingStatus); +$statuses = explode(";", $POST->pingStatus); if(sizeof($statuses)!=2) { $Result->show("danger", _("Invalid ping status intervals"), true); } if(!is_numeric($statuses[0]) || !is_numeric($statuses[1])) { $Result->show("danger", _("Invalid ping status intervals"), true); } diff --git a/public/app/admin/subnets/edit-nameserver-dropdown.php b/public/app/admin/subnets/edit-nameserver-dropdown.php index d6daf14d6..7bd341c56 100755 --- a/public/app/admin/subnets/edit-nameserver-dropdown.php +++ b/public/app/admin/subnets/edit-nameserver-dropdown.php @@ -57,7 +57,7 @@ foreach($n as $ns) { // set print $printNS = "$ns->name"; - $printNS .= " (" . array_shift(pf_explode(";",$ns->namesrv1)).",...)"; + $printNS .= " (" . array_shift(explode(";",(string) $ns->namesrv1)).",...)"; /* selected? */ if(@$subnet_old_details['nameserverId']==$ns->id) { print ''. "\n"; } diff --git a/public/app/admin/subnets/edit.php b/public/app/admin/subnets/edit.php index b30ca0331..5e9e82796 100755 --- a/public/app/admin/subnets/edit.php +++ b/public/app/admin/subnets/edit.php @@ -184,7 +184,7 @@ # reset CIDR if $showDropMenuFull // if ($showDropMenuFull && strlen(@$dropdown_menu)>2) { - // $cidr = pf_explode("\n",$dropdown_menu); + // $cidr = explode("\n",$dropdown_menu); // $cidr = substr(strip_tags($cidr[1]), 2); // //validate // if ($Subnets->verify_cidr_address($cidr)===false) { unset($cidr); }; @@ -277,7 +277,7 @@ if ($devices!==false) { foreach($devices as $device) { //check if permitted in this section! - $sections = pf_explode(";", $device->sections); + $sections = explode(";", (string) $device->sections); if(in_array($POST->sectionId, $sections)) { //if same if($device->id == @$subnet_old_details['device']) { print ''. "\n"; } @@ -335,7 +335,7 @@ if(is_array($vrfs)) { foreach($vrfs as $vrf) { // set permitted - $permitted_sections = pf_explode(";", $vrf->sections); + $permitted_sections = explode(";", (string) $vrf->sections); // section must be in array if (is_blank($vrf->sections) || in_array($POST->sectionId, $permitted_sections)) { //cast diff --git a/public/app/admin/users/ad-search-result-groups-membership.php b/public/app/admin/users/ad-search-result-groups-membership.php index 39e24edf2..b3858b789 100644 --- a/public/app/admin/users/ad-search-result-groups-membership.php +++ b/public/app/admin/users/ad-search-result-groups-membership.php @@ -36,7 +36,7 @@ $options = [ 'base_dn'=>$params->base_dn, 'account_suffix'=>$params->account_suffix, - 'domain_controllers'=>pf_explode(";",$params->domain_controllers), + 'domain_controllers'=>explode(";",(string) $params->domain_controllers), 'use_ssl'=>$params->use_ssl, 'use_tls'=>$params->use_tls, 'ad_port'=>$params->ad_port diff --git a/public/app/admin/users/ad-search-result.php b/public/app/admin/users/ad-search-result.php index 4b42e923e..4ce0eef6a 100755 --- a/public/app/admin/users/ad-search-result.php +++ b/public/app/admin/users/ad-search-result.php @@ -42,7 +42,7 @@ $options = [ 'base_dn'=>$params->base_dn, 'account_suffix'=>$params->account_suffix, - 'domain_controllers'=>pf_explode(";", str_replace(" ", "", (string) $params->domain_controllers)), + 'domain_controllers'=>explode(";", str_replace(" ", "", (string) $params->domain_controllers)), 'ad_port'=>$params->ad_port ]; diff --git a/public/app/admin/users/edit-result.php b/public/app/admin/users/edit-result.php index 16743ed0f..b3f7dfdb2 100755 --- a/public/app/admin/users/edit-result.php +++ b/public/app/admin/users/edit-result.php @@ -57,7 +57,7 @@ //enforce password policy $policy = (db_json_decode($User->settings->passwordPolicy, true)); - $Password_check->set_requirements ($policy, pf_explode(",",$policy['allowedSymbols'])); + $Password_check->set_requirements ($policy, explode(",",(string) $policy['allowedSymbols'])); if (!$Password_check->validate ($POST->password1)) { $Result->show("danger alert-danger ", _('Password validation errors').":
      - ".implode("
      - ", $Password_check->get_errors ()), true); } //hash passowrd diff --git a/public/app/admin/vaults/edit-result.php b/public/app/admin/vaults/edit-result.php index 800d69db4..2dc5931f7 100644 --- a/public/app/admin/vaults/edit-result.php +++ b/public/app/admin/vaults/edit-result.php @@ -45,7 +45,7 @@ //enforce password policy $policy = (db_json_decode($User->settings->passwordPolicy, true)); - $Password_check->set_requirements ($policy, pf_explode(",",$policy['allowedSymbols'])); + $Password_check->set_requirements ($policy, explode(",",(string) $policy['allowedSymbols'])); if (!$Password_check->validate ($POST->secret)) { $Result->show("danger alert-danger ", _('Secret validation errors').":
      - ".implode("
      - ", $Password_check->get_errors ()), true); } } diff --git a/public/app/admin/vaults/import-certificate-file-verify.php b/public/app/admin/vaults/import-certificate-file-verify.php index f6de8123c..e5eaa1ed5 100644 --- a/public/app/admin/vaults/import-certificate-file-verify.php +++ b/public/app/admin/vaults/import-certificate-file-verify.php @@ -24,7 +24,7 @@ /* get extension */ $filename = $_FILES['file']['name']; -$filename = pf_explode(".", $filename); +$filename = explode(".", (string) $filename); $filename = end($filename); /* list of permitted file extensions */ diff --git a/public/app/admin/version-check/index.php b/public/app/admin/version-check/index.php index 9b98318fe..c6981266b 100755 --- a/public/app/admin/version-check/index.php +++ b/public/app/admin/version-check/index.php @@ -99,7 +99,7 @@ // loop foreach ($commit_log as $commit) { // lines to array - $lines = pf_explode("\n", $commit); + $lines = explode("\n", $commit); // commit unset($out); $out['commit'] = $lines[0]; diff --git a/public/app/admin/vlans/edit-domain.php b/public/app/admin/vlans/edit-domain.php index 6e200a1ba..312a07693 100644 --- a/public/app/admin/vlans/edit-domain.php +++ b/public/app/admin/vlans/edit-domain.php @@ -79,7 +79,7 @@ # select sections $sections = $Sections->fetch_all_sections(); # reformat domains sections to array - $domain_sections = pf_explode(";", @$l2_domain['permissions']); + $domain_sections = explode(";", (string) @$l2_domain['permissions']); $domain_sections = is_array($domain_sections) ? $domain_sections : []; // loop if($sections!==false) { diff --git a/public/app/admin/vrf/edit.php b/public/app/admin/vrf/edit.php index 698a54dcd..02b4356b7 100755 --- a/public/app/admin/vrf/edit.php +++ b/public/app/admin/vrf/edit.php @@ -121,7 +121,7 @@ # select sections $sections = $Sections->fetch_all_sections(); # reformat domains sections to array - $vrf_sections = pf_explode(";", $vrf->sections); + $vrf_sections = explode(";", (string) $vrf->sections); $vrf_sections = is_array($vrf_sections) ? $vrf_sections : []; // loop if($sections!==false) { diff --git a/public/app/dashboard/index.php b/public/app/dashboard/index.php index 1280fd947..3c95467f1 100755 --- a/public/app/dashboard/index.php +++ b/public/app/dashboard/index.php @@ -93,7 +93,7 @@ $widgets = (array) $widgets; # show user-selected widgets -$uwidgets = array_filter(pf_explode(";",$User->user->widgets)); +$uwidgets = array_filter(explode(";",(string) $User->user->widgets)); # if user has no groups and is not admin print warning if ($User->is_admin(false)!==true && (is_blank($User->user->groups) || $User->user->groups==="null") ) { diff --git a/public/app/dashboard/widget-popup.php b/public/app/dashboard/widget-popup.php index 0b36188c1..705172946 100755 --- a/public/app/dashboard/widget-popup.php +++ b/public/app/dashboard/widget-popup.php @@ -13,7 +13,7 @@ $User->check_user_session (false); # user widgets form database -$uwidgets = pf_explode(";",$User->user->widgets); //selected +$uwidgets = explode(";",(string) $User->user->widgets); //selected $uwidgets = array_filter((array) $uwidgets); # fetch all widgets diff --git a/public/app/dashboard/widgets/changelog.php b/public/app/dashboard/widgets/changelog.php index 75639323c..8ddcdc04c 100755 --- a/public/app/dashboard/widgets/changelog.php +++ b/public/app/dashboard/widgets/changelog.php @@ -77,7 +77,7 @@ $changelog = str_replace("\r\n", "
      ",(string) $l['cdiff']); $changelog = str_replace("\n", "
      ",(string) $changelog); $changelog = htmlentities($changelog); - $changelog = array_filter(pf_explode("
      ", $changelog)); + $changelog = array_filter(explode("
      ", $changelog)); $diff = []; diff --git a/public/app/json/section/subnets.php b/public/app/json/section/subnets.php index 5a153590d..f4ae98753 100644 --- a/public/app/json/section/subnets.php +++ b/public/app/json/section/subnets.php @@ -37,7 +37,7 @@ function complete_search_cidr($search_cidr) { return $search_cidr; # Complete the 'search' cidr by guessing the mask, IPv4 only... - $ipv4 = array_filter(pf_explode('.', $search_cidr), 'strlen'); + $ipv4 = array_filter(explode('.', $search_cidr), 'strlen'); $search_cidr = implode('.', $ipv4); switch (sizeof($ipv4)) { diff --git a/public/app/saml2/index.php b/public/app/saml2/index.php index f19eea219..915a998d5 100644 --- a/public/app/saml2/index.php +++ b/public/app/saml2/index.php @@ -180,7 +180,7 @@ $values["role"] = filter_var($auth->getAttribute("is_admin")[0], FILTER_VALIDATE_BOOLEAN) ? "Administrator" : "User"; // Parse groups - $saml_groups = array_map('trim', pf_explode(',', $auth->getAttribute("groups")[0])) ?: []; + $saml_groups = array_map('trim', explode(',', (string) $auth->getAttribute("groups")[0])) ?: []; $ug = []; foreach ($Tools->fetch_all_objects("userGroups", "g_id") as $g) { @@ -192,9 +192,9 @@ //parse modules $saml_modules = []; - foreach (pf_explode(',', $auth->getAttribute("modules")[0]) as $entry) { + foreach (explode(',', (string) $auth->getAttribute("modules")[0]) as $entry) { if (strpos($entry, ":") !== false) { - list($module_name, $module_perm) = array_map('trim', pf_explode(':', $entry)) ?: ['', 0]; + list($module_name, $module_perm) = array_map('trim', explode(':', $entry)) ?: ['', 0]; $saml_modules[$module_name] = filter_var($module_perm, FILTER_VALIDATE_INT, ["options" => ["default" => 0, "min_range" => 0, "max_range" => 3]]); } } diff --git a/public/app/subnets/addresses/address-details-index.php b/public/app/subnets/addresses/address-details-index.php index fd1881838..baeaf771c 100644 --- a/public/app/subnets/addresses/address-details-index.php +++ b/public/app/subnets/addresses/address-details-index.php @@ -27,13 +27,13 @@ # set selected address fields array $selected_ip_fields = $User->settings->IPfilter; -$selected_ip_fields = pf_explode(";", $selected_ip_fields); //format to array +$selected_ip_fields = explode(";", (string) $selected_ip_fields); //format to array $selected_ip_fields_size = in_array('state', $selected_ip_fields) ? (sizeof($selected_ip_fields)-1) : sizeof($selected_ip_fields); //set size of selected fields if($selected_ip_fields_size==1 && is_blank($selected_ip_fields[0])) { $selected_ip_fields_size = 0; } //fix for 0 # set ping statuses -$statuses = pf_explode(";", $User->settings->pingStatus); +$statuses = explode(";", (string) $User->settings->pingStatus); # permissions $subnet_permission = $Subnets->check_permission($User->user, $subnet['id']); diff --git a/public/app/subnets/addresses/address-modify-submit.php b/public/app/subnets/addresses/address-modify-submit.php index 51fe6ab4c..2b69058a2 100644 --- a/public/app/subnets/addresses/address-modify-submit.php +++ b/public/app/subnets/addresses/address-modify-submit.php @@ -150,7 +150,7 @@ $POST->ip_addr = str_replace(" ", "", (string) $POST->ip_addr); # get start and stop of range - $range = pf_explode("-", $POST->ip_addr); + $range = explode("-", $POST->ip_addr); $POST->start = $range[0]; $POST->stop = $range[1]; diff --git a/public/app/subnets/addresses/address-modify.php b/public/app/subnets/addresses/address-modify.php index c26c6aa1c..dafd1c581 100644 --- a/public/app/subnets/addresses/address-modify.php +++ b/public/app/subnets/addresses/address-modify.php @@ -509,7 +509,7 @@ function validate_mac (ip, mac, sectionId, vlanId, id) { foreach($devices as $device) { $device = (array) $device; //check if permitted in this section! - $sections=pf_explode(";", $device['sections']); + $sections=explode(";", (string) $device['sections']); if(in_array($subnet['sectionId'], $sections)) { //if same if($device['id'] == $address['switch']) { print ''. "\n"; } diff --git a/public/app/subnets/addresses/mail-notify-check.php b/public/app/subnets/addresses/mail-notify-check.php index 675be0fd2..6554f26b2 100644 --- a/public/app/subnets/addresses/mail-notify-check.php +++ b/public/app/subnets/addresses/mail-notify-check.php @@ -19,7 +19,7 @@ $User->check_user_session(); # verify each recipient -foreach (pf_explode(",", $POST->recipients) as $rec) { +foreach (explode(",", (string) $POST->recipients) as $rec) { if(!filter_var(trim($rec), FILTER_VALIDATE_EMAIL)) { $Result->show("danger", _("Invalid email address")." - ".$rec, true); } @@ -39,7 +39,7 @@ // set html content $content[] = "
      snmp_queries); + $queries = explode(";", (string) $device->snmp_queries); $queries = is_array($queries) ? $queries : []; // loop foreach($Snmp->snmp_queries as $k=>$m) { diff --git a/public/app/admin/devices/edit.php b/public/app/admin/devices/edit.php index e216092ad..6753ed1a2 100755 --- a/public/app/admin/devices/edit.php +++ b/public/app/admin/devices/edit.php @@ -257,7 +257,7 @@ $sections = $Sections->fetch_all_sections(); # reformat device sections to array - $deviceSections = pf_explode(";", @$device['sections']); + $deviceSections = explode(";", (string) @$device['sections']); $deviceSections = is_array($deviceSections) ? $deviceSections : []; if ($sections!==false) { diff --git a/public/app/admin/groups/ad-search-group-result.php b/public/app/admin/groups/ad-search-group-result.php index fad0e064c..f8257c2bb 100644 --- a/public/app/admin/groups/ad-search-group-result.php +++ b/public/app/admin/groups/ad-search-group-result.php @@ -50,7 +50,7 @@ $options = [ 'base_dn'=>$params->base_dn, 'account_suffix'=>$params->account_suffix, - 'domain_controllers'=>pf_explode(";",$params->domain_controllers), + 'domain_controllers'=>explode(";",(string) $params->domain_controllers), 'use_ssl'=>$params->use_ssl, 'use_tls'=>$params->use_tls, 'ad_port'=>$params->ad_port diff --git a/public/app/admin/groups/edit-group-result.php b/public/app/admin/groups/edit-group-result.php index 3787c73a8..ae7cb7ba3 100755 --- a/public/app/admin/groups/edit-group-result.php +++ b/public/app/admin/groups/edit-group-result.php @@ -61,7 +61,7 @@ // save id $gid = $Admin->lastId; // to array - $gmembers = pf_explode(";", $POST->gmembers); + $gmembers = explode(";", (string) $POST->gmembers); // check foreach ($gmembers as $gm) { // check if user exists diff --git a/public/app/admin/import-export/import-ipaddr-check.php b/public/app/admin/import-export/import-ipaddr-check.php index a4922d869..5335f4168 100644 --- a/public/app/admin/import-export/import-ipaddr-check.php +++ b/public/app/admin/import-export/import-ipaddr-check.php @@ -108,7 +108,7 @@ if ($devices!==false) { foreach($devices as $c_dev) { $c_dev = (array) $c_dev; - $c_dev_sections=pf_explode(";", $c_dev['sections']); + $c_dev_sections=explode(";", (string) $c_dev['sections']); # Populate each section with the devices it has foreach($c_dev_sections as $c_dev_sect) { $device_data[$c_dev_sect][$c_dev['hostname']] = $c_dev;} } diff --git a/public/app/admin/import-export/import-load-data.php b/public/app/admin/import-export/import-load-data.php index 886378c9e..09f10e29a 100644 --- a/public/app/admin/import-export/import-load-data.php +++ b/public/app/admin/import-export/import-load-data.php @@ -17,8 +17,8 @@ # admin check $User->is_admin(); -$expfields = pf_explode("|",$GET->expfields); -$reqfields = pf_explode("|",$GET->reqfields); +$expfields = explode("|",(string) $GET->expfields); +$reqfields = explode("|",(string) $GET->reqfields); if (isset($GET->filetype)) { $filetype = $GET->filetype; } else { diff --git a/public/app/admin/import-export/import-verify.php b/public/app/admin/import-export/import-verify.php index 03a93f4fa..350c07cbc 100644 --- a/public/app/admin/import-export/import-verify.php +++ b/public/app/admin/import-export/import-verify.php @@ -21,8 +21,8 @@ /* get extension */ $filename = $_FILES['file']['name']; -$expfields = pf_explode("|",$POST->expfields); -$file_exp = pf_explode(".", $filename); +$expfields = explode("|",(string) $POST->expfields); +$file_exp = explode(".", (string) $filename); $filetype = strtolower(end($file_exp)); /* list of permitted file extensions */ diff --git a/public/app/admin/nameservers/edit.php b/public/app/admin/nameservers/edit.php index 29c0c3f85..e01061cbd 100755 --- a/public/app/admin/nameservers/edit.php +++ b/public/app/admin/nameservers/edit.php @@ -39,7 +39,7 @@ $readonly = $POST->action=="delete" ? "readonly" : ""; # set nameservers -$nameservers->namesrv1 = !is_string($nameservers->namesrv1) ? [" "] : pf_explode(";", $nameservers->namesrv1); +$nameservers->namesrv1 = !is_string($nameservers->namesrv1) ? [" "] : explode(";", $nameservers->namesrv1); ?> @@ -114,7 +114,7 @@ # select sections $sections = $Sections->fetch_all_sections(); # reformat domains sections to array - $nameservers_sections = pf_explode(";", $nameservers->permissions); + $nameservers_sections = explode(";", (string) $nameservers->permissions); $nameservers_sections = is_array($nameservers_sections) ? $nameservers_sections : []; // loop if ($sections !== false) { diff --git a/public/app/admin/nameservers/index.php b/public/app/admin/nameservers/index.php index 4f34d2261..a7204415e 100755 --- a/public/app/admin/nameservers/index.php +++ b/public/app/admin/nameservers/index.php @@ -48,7 +48,7 @@ // sections if (!is_null($nameservers['permissions'])) { - $sections = array_filter(pf_explode(";", $nameservers['permissions'])); + $sections = array_filter(explode(";", (string) $nameservers['permissions'])); // some if (sizeof($sections)>0) { foreach($sections as $id) { @@ -69,7 +69,7 @@ } // merge all nmeservers - $all_nameservers = pf_explode(";", $nameservers['namesrv1']); + $all_nameservers = explode(";", (string) $nameservers['namesrv1']); //print details print '
      "; $content[] = ""; - foreach(pf_explode("\r\n", $POST->content) as $c) { + foreach(explode("\r\n", (string) $POST->content) as $c) { $content[] = ""; } $content[] = ""; @@ -54,7 +54,7 @@ $content_plain = implode("\r\n",$content_plain); $phpipam_mail->Php_mailer->setFrom($mail_settings->mAdminMail, $mail_settings->mAdminName); - foreach(pf_explode(",", $POST->recipients) as $r) { + foreach(explode(",", (string) $POST->recipients) as $r) { $phpipam_mail->Php_mailer->addAddress(addslashes(trim($r))); } $phpipam_mail->Php_mailer->Subject = $subject; diff --git a/public/app/subnets/addresses/print-address-table.php b/public/app/subnets/addresses/print-address-table.php index d454ef795..0f59fc1f3 100644 --- a/public/app/subnets/addresses/print-address-table.php +++ b/public/app/subnets/addresses/print-address-table.php @@ -120,7 +120,7 @@ function unset_array_value(&$array, $value) { } # set ping statuses for warning and offline -$statuses = pf_explode(";", $User->settings->pingStatus); +$statuses = explode(";", (string) $User->settings->pingStatus); # Set $zone if(in_array('firewallAddressObject', $selected_ip_fields)) { diff --git a/public/app/subnets/import-subnet/import-file.php b/public/app/subnets/import-subnet/import-file.php index 9d5995438..046981926 100755 --- a/public/app/subnets/import-subnet/import-file.php +++ b/public/app/subnets/import-subnet/import-file.php @@ -31,7 +31,7 @@ is_numeric($POST->subnetId) ? : $Result->show("danger", _("Invalid subnet ID") ,true); # set filetype -$filetype = pf_explode(".", $POST->filetype); +$filetype = explode(".", (string) $POST->filetype); $filetype = end($filetype); # get custom fields diff --git a/public/app/subnets/import-subnet/import-verify.php b/public/app/subnets/import-subnet/import-verify.php index 4c9334259..857ae0f42 100755 --- a/public/app/subnets/import-subnet/import-verify.php +++ b/public/app/subnets/import-subnet/import-verify.php @@ -19,7 +19,7 @@ /* get extension */ $filename = $_FILES['file']['name']; -$filename = pf_explode(".", $filename); +$filename = explode(".", (string) $filename); $filename = end($filename); // no / in filename ! diff --git a/public/app/subnets/import-subnet/print-file.php b/public/app/subnets/import-subnet/print-file.php index 3fb9a5a4b..a175e45f5 100755 --- a/public/app/subnets/import-subnet/print-file.php +++ b/public/app/subnets/import-subnet/print-file.php @@ -19,7 +19,7 @@ $User->check_user_session(); # set filetype -$filetype = pf_explode(".", $POST->filetype); +$filetype = explode(".", (string) $POST->filetype); $filetype = end($filetype); # check integer diff --git a/public/app/subnets/scan/subnet-scan-execute-scan-snmp-arp.php b/public/app/subnets/scan/subnet-scan-execute-scan-snmp-arp.php index 095b0bffc..eeec90e35 100644 --- a/public/app/subnets/scan/subnet-scan-execute-scan-snmp-arp.php +++ b/public/app/subnets/scan/subnet-scan-execute-scan-snmp-arp.php @@ -37,7 +37,7 @@ # set selected address fields array $selected_ip_fields = $User->settings->IPfilter; -$selected_ip_fields = pf_explode(";", $selected_ip_fields); +$selected_ip_fields = explode(";", (string) $selected_ip_fields); # fetch devices that use get_routing_table query $devices_used = $Tools->fetch_multiple_objects ("devices", "snmp_queries", "%get_arp_table%", "id", true, true); @@ -46,7 +46,7 @@ if ($devices_used !== false) { foreach ($devices_used as $d) { // get possible sections - $permitted_sections = pf_explode(";", $d->sections); + $permitted_sections = explode(";", (string) $d->sections); // check if (in_array($subnet->sectionId, $permitted_sections)) { $permitted_devices[] = $d; diff --git a/public/app/subnets/scan/subnet-scan-execute-scan-telnet.php b/public/app/subnets/scan/subnet-scan-execute-scan-telnet.php index a23b40a2b..815d4c0e9 100755 --- a/public/app/subnets/scan/subnet-scan-execute-scan-telnet.php +++ b/public/app/subnets/scan/subnet-scan-execute-scan-telnet.php @@ -11,7 +11,7 @@ if(empty($POST->port)) { $Result->show("danger", _('Please enter ports to scan').'!', true); } //verify ports -$pcheck = pf_explode(";", str_replace(",",";",(string) $POST->port)); +$pcheck = explode(";", str_replace(",",";",(string) $POST->port)); foreach($pcheck as $p) { if(!is_numeric($p)) { $Result->show("danger", _("Invalid port").' ('.$p.')', true); diff --git a/public/app/subnets/scan/subnet-scan-execute-snmp-mac.php b/public/app/subnets/scan/subnet-scan-execute-snmp-mac.php index e37be6a50..1496b19c3 100644 --- a/public/app/subnets/scan/subnet-scan-execute-snmp-mac.php +++ b/public/app/subnets/scan/subnet-scan-execute-snmp-mac.php @@ -41,7 +41,7 @@ # set selected address fields array $selected_ip_fields = $User->settings->IPfilter; -$selected_ip_fields = pf_explode(";", $selected_ip_fields); +$selected_ip_fields = explode(";", (string) $selected_ip_fields); # fetch devices that use get_routing_table query $devices_used_arp = $Tools->fetch_multiple_objects ("devices", "snmp_queries", "%get_arp_table%", "id", true, true); @@ -51,7 +51,7 @@ if ($devices_used_arp !== false) { foreach ($devices_used_arp as $d) { // get possible sections - $permitted_sections = pf_explode(";", $d->sections); + $permitted_sections = explode(";", (string) $d->sections); // check if (in_array($subnet->sectionId, $permitted_sections)) { $permitted_devices_arp[] = $d; @@ -62,7 +62,7 @@ if ($devices_used_mac !== false) { foreach ($devices_used_mac as $d) { // get possible sections - $permitted_sections = pf_explode(";", $d->sections); + $permitted_sections = explode(";", (string) $d->sections); // check if (in_array($subnet->sectionId, $permitted_sections)) { $permitted_devices_mac[] = $d; diff --git a/public/app/subnets/scan/subnet-scan-execute-snmp-route-all.php b/public/app/subnets/scan/subnet-scan-execute-snmp-route-all.php index 7fcf6045b..a7b6bf98f 100644 --- a/public/app/subnets/scan/subnet-scan-execute-snmp-route-all.php +++ b/public/app/subnets/scan/subnet-scan-execute-snmp-route-all.php @@ -249,7 +249,7 @@ if(!empty($vrfs)) { foreach($vrfs as $vrf) { // set permitted - $permitted_sections = pf_explode(";", $vrf->sections); + $permitted_sections = explode(";", (string) $vrf->sections); // section must be in array if (is_blank($vrf->sections) || in_array($POST->sectionId, $permitted_sections)) { //cast @@ -276,7 +276,7 @@ foreach($n as $ns) { // set print $printNS = "$ns->name"; - $printNS .= " (" . array_shift(pf_explode(";",$ns->namesrv1)).",...)"; + $printNS .= " (" . array_shift(explode(";",(string) $ns->namesrv1)).",...)"; print ''. "\n"; } } diff --git a/public/app/subnets/scan/subnet-scan-execute-update-snmp-arp.php b/public/app/subnets/scan/subnet-scan-execute-update-snmp-arp.php index 17da07b7f..66e78f9d1 100644 --- a/public/app/subnets/scan/subnet-scan-execute-update-snmp-arp.php +++ b/public/app/subnets/scan/subnet-scan-execute-update-snmp-arp.php @@ -41,7 +41,7 @@ if ($devices_used !== false) { foreach ($devices_used as $d) { // get possible sections - $permitted_sections = pf_explode(";", $d->sections); + $permitted_sections = explode(";", (string) $d->sections); // check if (in_array($subnet->sectionId, $permitted_sections)) { $permitted_devices[] = $d; diff --git a/public/app/subnets/scan/subnet-scan-result-snmp-route-all.php b/public/app/subnets/scan/subnet-scan-result-snmp-route-all.php index 031dc4c30..d785f1fa1 100644 --- a/public/app/subnets/scan/subnet-scan-result-snmp-route-all.php +++ b/public/app/subnets/scan/subnet-scan-result-snmp-route-all.php @@ -22,7 +22,7 @@ # loop foreach ($POST as $k=>$p) { # explode - $k = pf_explode("-", $k); + $k = explode("-", (string) $k); # numeric if (is_numeric($k[1])) { // output array diff --git a/public/app/temp_share/address.php b/public/app/temp_share/address.php index 01c01b2a0..643e40777 100644 --- a/public/app/temp_share/address.php +++ b/public/app/temp_share/address.php @@ -15,13 +15,13 @@ # set selected address fields array $selected_ip_fields = $settings->IPfilter; -$selected_ip_fields = pf_explode(";", $selected_ip_fields); //format to array +$selected_ip_fields = explode(";", (string) $selected_ip_fields); //format to array $selected_ip_fields_size = in_array('state', $selected_ip_fields) ? (sizeof($selected_ip_fields)-1) : sizeof($selected_ip_fields); //set size of selected fields if($selected_ip_fields_size==1 && is_blank($selected_ip_fields[0])) { $selected_ip_fields_size = 0; } //fix for 0 # set ping statuses -$statuses = pf_explode(";", $settings->pingStatus); +$statuses = explode(";", (string) $settings->pingStatus); # checks if(sizeof($subnet)==0) { $Result->show("danger", _('Subnet does not exist'), true); } //subnet doesn't exist diff --git a/public/app/temp_share/subnet-addresses.php b/public/app/temp_share/subnet-addresses.php index 4a37e5832..27e0685dd 100644 --- a/public/app/temp_share/subnet-addresses.php +++ b/public/app/temp_share/subnet-addresses.php @@ -19,7 +19,7 @@ # set selected address fields array $selected_ip_fields = $settings->IPfilter; -$selected_ip_fields = pf_explode(";", $selected_ip_fields); //format to array +$selected_ip_fields = explode(";", (string) $selected_ip_fields); //format to array $selected_ip_fields_size = in_array('state', $selected_ip_fields) ? (sizeof($selected_ip_fields)-1) : sizeof($selected_ip_fields); //set size of selected fields if($selected_ip_fields_size==1 && is_blank($selected_ip_fields[0])) { $selected_ip_fields_size = 0; } //fix for 0 @@ -61,7 +61,7 @@ # set page limit for pagination $page_limit = 100000000; # set ping statuses for warning and offline -$statuses = pf_explode(";", $settings->pingStatus); +$statuses = explode(";", (string) $settings->pingStatus); ?> diff --git a/public/app/tools/changelog/show-popup.php b/public/app/tools/changelog/show-popup.php index 44ab0f32c..1f1dfbb63 100644 --- a/public/app/tools/changelog/show-popup.php +++ b/public/app/tools/changelog/show-popup.php @@ -97,7 +97,7 @@ # format diff $changelog = str_replace("\r\n", "
      ",(string) $clog->cdiff); $changelog = str_replace("\n", "
      ",(string) $changelog); - $changelog = array_filter(pf_explode("
      ", $changelog)); + $changelog = array_filter(explode("
      ", $changelog)); # set type if($clog->ctype=="ip_addr") { $type = "address"; } diff --git a/public/app/tools/customers/customer/objects/ipaddresses.php b/public/app/tools/customers/customer/objects/ipaddresses.php index 2a4320172..d900c8e67 100644 --- a/public/app/tools/customers/customer/objects/ipaddresses.php +++ b/public/app/tools/customers/customer/objects/ipaddresses.php @@ -34,7 +34,7 @@ if($selected_ip_fields_size==1 && is_blank($selected_ip_fields[0])) { $selected_ip_fields_size = 0; } //fix for 0 # set ping statuses for warning and offline -$statuses = pf_explode(";", $User->settings->pingStatus); +$statuses = explode(";", (string) $User->settings->pingStatus); ?> diff --git a/public/app/tools/devices/all-devices-filter.php b/public/app/tools/devices/all-devices-filter.php index e6475d7d7..9c7fda73a 100644 --- a/public/app/tools/devices/all-devices-filter.php +++ b/public/app/tools/devices/all-devices-filter.php @@ -30,7 +30,7 @@ $section = $Database->getObjectQuery("sections", "select id,name from `sections` where `name` = ?", [$GET->sPage]); // check in which section device can be foreach ($devices as $k=>$d) { - $device_section_ids = pf_explode(";", $d->sections); + $device_section_ids = explode(";", (string) $d->sections); if (!in_array($section->id, $device_section_ids)) { unset($devices[$k]); diff --git a/public/app/tools/devices/device-details/device-details.php b/public/app/tools/devices/device-details/device-details.php index d3b75b33f..67a903c65 100755 --- a/public/app/tools/devices/device-details/device-details.php +++ b/public/app/tools/devices/device-details/device-details.php @@ -112,7 +112,7 @@ print " '; print " "; - if (strpos((string) $domain->master, ";") !== false) {$master = pf_explode(";", $domain->master);} else { $master = [$domain->master];} + if (strpos((string) $domain->master, ";") !== false) {$master = explode(";", (string) $domain->master);} else { $master = [$domain->master];} print ""; print ""; print " "; print " "; @@ -155,7 +155,7 @@ //add print ""; print ""; print ""; diff --git a/public/app/admin/device-types/index.php b/public/app/admin/device-types/index.php index 9334761f7..4bf786010 100755 --- a/public/app/admin/device-types/index.php +++ b/public/app/admin/device-types/index.php @@ -49,8 +49,8 @@ //print details print ''. "\n"; - print ' '. "\n"; - print ' '. "\n"; + print ' '. "\n"; + print ' '. "\n"; print ' '. "\n"; print ' '. "\n"; diff --git a/public/app/admin/import-export/import-devices-check.php b/public/app/admin/import-export/import-devices-check.php index 8af7ace1d..8733962a4 100644 --- a/public/app/admin/import-export/import-devices-check.php +++ b/public/app/admin/import-export/import-devices-check.php @@ -152,6 +152,6 @@ $rows.=""; foreach ($expfields as $cfield) { $rows.= ""; } - $rows.= ""; + $rows.= ""; } diff --git a/public/app/admin/import-export/import-devtype-check.php b/public/app/admin/import-export/import-devtype-check.php index 28d88a1b9..86c67416b 100644 --- a/public/app/admin/import-export/import-devtype-check.php +++ b/public/app/admin/import-export/import-devtype-check.php @@ -67,6 +67,6 @@ $rows.=" - "; + "; } diff --git a/public/app/admin/import-export/import-ipaddr-check.php b/public/app/admin/import-export/import-ipaddr-check.php index 5335f4168..7df989c0d 100644 --- a/public/app/admin/import-export/import-ipaddr-check.php +++ b/public/app/admin/import-export/import-ipaddr-check.php @@ -300,6 +300,6 @@ foreach ($expfields as $cfield) { $rows .= ""; } - $rows.= ""; + $rows.= ""; } diff --git a/public/app/admin/import-export/import-l2dom-check.php b/public/app/admin/import-export/import-l2dom-check.php index cc71b1331..40d74228e 100644 --- a/public/app/admin/import-export/import-l2dom-check.php +++ b/public/app/admin/import-export/import-l2dom-check.php @@ -75,6 +75,6 @@ $rows.=" - "; + "; } diff --git a/public/app/admin/import-export/import-subnets-check.php b/public/app/admin/import-export/import-subnets-check.php index a5e346754..a6cd364d2 100644 --- a/public/app/admin/import-export/import-subnets-check.php +++ b/public/app/admin/import-export/import-subnets-check.php @@ -230,6 +230,6 @@ $rows.=""; foreach ($expfields as $cfield) { $rows.= ""; } - $rows.= ""; + $rows.= ""; } diff --git a/public/app/admin/import-export/import-vlan-check.php b/public/app/admin/import-export/import-vlan-check.php index 4d0c28603..bb70bd796 100644 --- a/public/app/admin/import-export/import-vlan-check.php +++ b/public/app/admin/import-export/import-vlan-check.php @@ -118,5 +118,5 @@ ".$cfieldtds." - "; + "; } diff --git a/public/app/admin/import-export/import-vrf-check.php b/public/app/admin/import-export/import-vrf-check.php index 2c3a9b0fb..88e5e62d1 100644 --- a/public/app/admin/import-export/import-vrf-check.php +++ b/public/app/admin/import-export/import-vrf-check.php @@ -82,6 +82,6 @@ $rows.=""; foreach ($expfields as $cfield) { $rows.= ""; } - $rows.= ""; + $rows.= ""; } diff --git a/public/app/admin/users/edit.php b/public/app/admin/users/edit.php index 46034bf7a..feeb7df7d 100755 --- a/public/app/admin/users/edit.php +++ b/public/app/admin/users/edit.php @@ -382,7 +382,7 @@ foreach ($perm_modules as $key=>$name) { // print row print ""; - print " "; + print " "; print " '. "\n"; } - else { print ' '. "\n"; } + else { print ' '. "\n"; } # disabled $disabled = $user['disabled']=="Yes" ? ""._("Disabled")."" : ""; diff --git a/public/app/admin/users/print-user/mail.php b/public/app/admin/users/print-user/mail.php index 84a5d199c..dd0ceb2b2 100644 --- a/public/app/admin/users/print-user/mail.php +++ b/public/app/admin/users/print-user/mail.php @@ -3,9 +3,9 @@ - + - + \ No newline at end of file diff --git a/public/app/admin/users/print_module_permissions.php b/public/app/admin/users/print_module_permissions.php index ad20c6fb2..cfc79114c 100644 --- a/public/app/admin/users/print_module_permissions.php +++ b/public/app/admin/users/print_module_permissions.php @@ -37,7 +37,7 @@ print '
    • '; // title print ""; - print ""._($perm_names[$key]).""; + print ""._((string) $perm_names[$key]).""; print ""; // perms print ' '; @@ -55,7 +55,7 @@ print "
    • $User->mail_font_style$subject
      $User->mail_font_style $c
      $User->mail_font_style_light Sent by user ".$User->user->real_name." at ".date('Y/m/d H:i')."
      ". _('Sections').':"; if(!is_blank($device['hostname'])) { - $section_ids = pf_explode(";", $device['sections']); + $section_ids = explode(";", (string) $device['sections']); foreach($section_ids as $k=>$id) { $section = $Sections->fetch_section(null, $id); if (!is_object($section)) { @@ -288,13 +288,13 @@ if ($rack!==false) { if ($User->settings->rackImageFormat=='svg') { // back - if($rack->hasBack!="0") + if($rack->hasBack!="0") print " "; // front print " "; } else { // back - if($rack->hasBack!="0") + if($rack->hasBack!="0") print " "; // front print " "; diff --git a/public/app/tools/pass-change/result.php b/public/app/tools/pass-change/result.php index f85ada545..4bd3881f1 100755 --- a/public/app/tools/pass-change/result.php +++ b/public/app/tools/pass-change/result.php @@ -22,7 +22,7 @@ # Enforce password policy $policy = (db_json_decode($User->settings->passwordPolicy, true)); -$Password_check->set_requirements($policy, pf_explode(",",$policy['allowedSymbols'])); +$Password_check->set_requirements($policy, explode(",",(string) $policy['allowedSymbols'])); if (!$Password_check->validate ($POST->ipampassword1)) { $Result->show("danger alert-danger ", _('Password validation errors').":
      - ".implode("
      - ", $Password_check->get_errors ()), true); } if($POST->ipampassword1!=$POST->ipampassword2) { $Result->show("danger", _("New passwords do not match"), true); } diff --git a/public/app/tools/powerDNS/domain-records.php b/public/app/tools/powerDNS/domain-records.php index e3d4a9909..299a75a30 100644 --- a/public/app/tools/powerDNS/domain-records.php +++ b/public/app/tools/powerDNS/domain-records.php @@ -71,7 +71,7 @@ if ($domain->type == "SLAVE") { // master servers print "
      " . _("Master servers") . ":"; foreach ($master as $k => $m) { diff --git a/public/app/tools/powerDNS/domains-print.php b/public/app/tools/powerDNS/domains-print.php index 4e357e219..d0d8cfbf4 100644 --- a/public/app/tools/powerDNS/domains-print.php +++ b/public/app/tools/powerDNS/domains-print.php @@ -126,7 +126,7 @@ // get SOA record $soa = $PowerDNS->fetch_domain_records_by_type($d->id, "SOA"); if (is_object($soa)) { - $serial = pf_explode(" ", $soa[0]->content); + $serial = explode(" ", (string) $soa[0]->content); $serial = $serial[2]; } else { $serial = ''; diff --git a/public/app/tools/search/search-results-export.php b/public/app/tools/search/search-results-export.php index ab220e04b..74e0f2c73 100755 --- a/public/app/tools/search/search-results-export.php +++ b/public/app/tools/search/search-results-export.php @@ -71,7 +71,7 @@ # set selected address fields array $selected_ip_fields = $User->settings->IPfilter; -$selected_ip_fields = pf_explode(";", $selected_ip_fields); +$selected_ip_fields = explode(";", (string) $selected_ip_fields); # set col size $fieldSize = sizeof($selected_ip_fields); diff --git a/public/app/tools/search/search-results.php b/public/app/tools/search/search-results.php index 7069f653e..8410c01ff 100755 --- a/public/app/tools/search/search-results.php +++ b/public/app/tools/search/search-results.php @@ -31,7 +31,7 @@ # set selected address fields array $selected_ip_fields = $User->settings->IPfilter; -$selected_ip_fields = pf_explode(";", $selected_ip_fields); +$selected_ip_fields = explode(";", (string) $selected_ip_fields); // all are off? if (is_blank($GET->addresses) && is_blank($GET->subnets) && is_blank($GET->vlans) && is_blank($GET->vrf) && is_blank($GET->pstn) && is_blank($GET->circuits) && is_blank($GET->customers) && is_blank($GET->devices)) { diff --git a/public/app/tools/temp-shares/edit-result.php b/public/app/tools/temp-shares/edit-result.php index c7b967d35..649c49f23 100644 --- a/public/app/tools/temp-shares/edit-result.php +++ b/public/app/tools/temp-shares/edit-result.php @@ -26,7 +26,7 @@ if($POST->validity>date("Y-m-d H:i:s", strtotime("+ 7 days"))) { $Result->show("danger", _("1 week is max validity time"), true); } # verify each recipient if(!is_blank($POST->email)) { - foreach (pf_explode(",", $POST->email) as $rec) { + foreach (explode(",", (string) $POST->email) as $rec) { if(!filter_var(trim($rec), FILTER_VALIDATE_EMAIL)) { $Result->show("danger", _("Invalid email address")." - ".$rec, true); } } } @@ -106,7 +106,7 @@ $content_plain = implode("\r\n",$content_plain); $phpipam_mail->Php_mailer->setFrom($mail_settings->mAdminMail, $mail_settings->mAdminName); - foreach(pf_explode(",", $POST->email) as $r) { + foreach(explode(",", (string) $POST->email) as $r) { $phpipam_mail->Php_mailer->addAddress(addslashes(trim($r))); } $phpipam_mail->Php_mailer->Subject = "New ipam share created"; diff --git a/public/app/tools/tools-menu.php b/public/app/tools/tools-menu.php index 01fe8886e..3a361331f 100755 --- a/public/app/tools/tools-menu.php +++ b/public/app/tools/tools-menu.php @@ -24,7 +24,7 @@ # print print "
    • "; # multiple hrefs ? - $href = pf_explode("/", $t['href']); + $href = explode("/", (string) $t['href']); if(sizeof($href)>0) { if(isset($href[1])) print "".$t['name'].""; diff --git a/public/app/tools/user-menu/user-edit.php b/public/app/tools/user-menu/user-edit.php index 51df66325..1b254ba97 100755 --- a/public/app/tools/user-menu/user-edit.php +++ b/public/app/tools/user-menu/user-edit.php @@ -36,7 +36,7 @@ if ($POST->password1 != $POST->password2) { $Result->show("danger alert-absolute", _('Passwords do not match!'), true); } # validate pass against policy $policy = (db_json_decode($User->settings->passwordPolicy, true)); - $Password_check->set_requirements ($policy, pf_explode(",",$policy['allowedSymbols'])); + $Password_check->set_requirements ($policy, explode(",",(string) $policy['allowedSymbols'])); if (!$Password_check->validate ($POST->password1)) { $Result->show("danger alert-danger ", _('Password validation errors').":
      - ".implode("
      - ", $Password_check->get_errors ()), true); } } diff --git a/public/app/tools/user-menu/widgets.php b/public/app/tools/user-menu/widgets.php index de8171e45..21a105635 100644 --- a/public/app/tools/user-menu/widgets.php +++ b/public/app/tools/user-menu/widgets.php @@ -41,7 +41,7 @@ # show all widgets, sortable //user widgets form database -$user_widgets = pf_explode(";",$User->user->widgets); //selected +$user_widgets = explode(";",(string) $User->user->widgets); //selected $user_widgets = array_filter($user_widgets); print "
        "; diff --git a/public/app/tools/vlan/domains.php b/public/app/tools/vlan/domains.php index e22c3f5ce..cd4a9dc5d 100644 --- a/public/app/tools/vlan/domains.php +++ b/public/app/tools/vlan/domains.php @@ -63,7 +63,7 @@ else { //explode $sec = []; - $sections_tmp = pf_explode(";", $domain->permissions); + $sections_tmp = explode(";", (string) $domain->permissions); foreach($sections_tmp as $t) { //fetch section $tmp_section = $Sections->fetch_section(null, $t); diff --git a/public/app/tools/vrf/all_vrf.php b/public/app/tools/vrf/all_vrf.php index 90b430b73..e39f63b32 100755 --- a/public/app/tools/vrf/all_vrf.php +++ b/public/app/tools/vrf/all_vrf.php @@ -87,7 +87,7 @@ else { //explode $sec = []; - $sections_tmp = pf_explode(";", $vrf['sections']); + $sections_tmp = explode(";", (string) $vrf['sections']); foreach($sections_tmp as $t) { //fetch section $tmp_section = $Sections->fetch_section(null, $t); diff --git a/public/app/tools/vrf/vrf-details.php b/public/app/tools/vrf/vrf-details.php index 5e9996b9c..b14f76b7a 100644 --- a/public/app/tools/vrf/vrf-details.php +++ b/public/app/tools/vrf/vrf-details.php @@ -61,7 +61,7 @@ } else { //explode - $sections_tmp = pf_explode(";", $vrf->sections); + $sections_tmp = explode(";", (string) $vrf->sections); foreach($sections_tmp as $t) { //fetch section $tmp_section = $Sections->fetch_section(null, $t); diff --git a/public/app/vrf/vrf-details.php b/public/app/vrf/vrf-details.php index 7a860db5b..b2acc76f7 100755 --- a/public/app/vrf/vrf-details.php +++ b/public/app/vrf/vrf-details.php @@ -53,7 +53,7 @@ } else { //explode - $sections_tmp = pf_explode(";", $vrf->sections); + $sections_tmp = explode(";", (string) $vrf->sections); foreach($sections_tmp as $t) { //fetch section $tmp_section = $Sections->fetch_section(null, $t); diff --git a/public/index.php b/public/index.php index b45ff1e0c..08d91d8f5 100644 --- a/public/index.php +++ b/public/index.php @@ -190,7 +190,7 @@

        /", (string) $title); - $tmp = pf_explode($User->settings->siteTitle, $title); + $tmp = explode((string) $User->settings->siteTitle, $title); unset($tmp[0]); print implode($User->settings->siteTitle, $tmp); ?> From e0844b0714821be78fd8012e7b8bbae8d9184bfa Mon Sep 17 00:00:00 2001 From: Gary Date: Fri, 1 May 2026 22:52:13 +0100 Subject: [PATCH 21/28] Update Docs --- UPDATE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UPDATE.md b/UPDATE.md index daa6eae61..e11cfba45 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -73,11 +73,11 @@ Enter password: Backup your `config.php` file containing database connection settings for phpIPAM. -# Prepare for composer package management changes [ *upgrading from phpIPAM < v1.9.0 ] +# Prepare for composer package management changes [ * upgrading from phpIPAM < v1.9.0 ] phpIPAM versions prior to 1.9.0 use a mix of git submodule and [composer](https://getcomposer.org/) packages installed in the `functions` sub-directory. -phpIPAM version 1.9.0 and above switched to [composer](https://getcomposer.org/) exclusively for package management in the root directory. +phpIPAM version 1.9.0 and above switched to [composer](https://getcomposer.org/) exclusively for package management in the project root directory. Before you upgrade to 1.9.0 or above from 1.8.x or below, remove legacy git submodules by running `git submodule deinit`. @@ -121,7 +121,7 @@ If you are using `master` branch on GitHub simply pull the latest stable release [root@ipam:/var/www/phpipam]$ composer install --no-dev --no-scripts ``` -## git on specific branch [ * phpIPAM >= v1.9.0 ] +## git on specific branch [ * phpIPAM >= v1.9.0 ] If you use specific branch, pull down new code, switch to desired branch and update dependencies; @@ -134,7 +134,7 @@ If you use specific branch, pull down new code, switch to desired branch and upd [root@ipam:/var/www/phpipam]$ composer install --no-dev --no-scripts ``` -## git on specific branch [ * phpIPAM <= v1.8.0 ] +## git on specific branch [ * phpIPAM < v1.9.0 ] If you use specific branch, pull down new code, switch to desired branch and update dependencies; @@ -162,7 +162,7 @@ To manually extract new phpipam release head over to [https://github.com/phpipam [root@ipam:/var/www/phpipam]$ composer install --no-dev --no-scripts ``` -# Update webserver configuration [ *upgrading from phpIPAM < v1.9.0 ] +# Update webserver configuration [ * upgrading from phpIPAM < v1.9.0 ] phpIPAM v1.9.0 relocated all HTML application code from the project root directory into the \"public\" sub-directory. From 83e960332837e40d4383ceb58916aeae60cce88b Mon Sep 17 00:00:00 2001 From: Gary Date: Sat, 2 May 2026 09:33:19 +0100 Subject: [PATCH 22/28] Update CHANGELOG and Roadmap --- misc/CHANGELOG | 5 ++++- misc/Roadmap | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/misc/CHANGELOG b/misc/CHANGELOG index 61932d462..14b1d0fd7 100755 --- a/misc/CHANGELOG +++ b/misc/CHANGELOG @@ -7,7 +7,10 @@ Enhancements, changes: ---------------------------- - + Remove support for mcrypt; + + Minimum PHP version raised to 8.2.0; + + HTML files moved to 'public' folder (see UPDATING.md); + + Removed git submodules, full migrarion to composer (see UPDATING.md); + + Removed support for mcrypt; == 1.8.0 diff --git a/misc/Roadmap b/misc/Roadmap index 1611eaa0c..502236e12 100755 --- a/misc/Roadmap +++ b/misc/Roadmap @@ -1,4 +1,4 @@ -Feature candidates for 1.8: +Feature candidates for 1.9: --------------------------- Prio1 features / enhancements: @@ -10,10 +10,6 @@ Prio1 features / enhancements: - 2FA enhancements - After code saved require confirmation with TOTP - Other enhancements based on Jeff reported bugs - - Composer: - - Move requirements from gitmodules to composer - - new requirements via composer - - Add checks etc - Webhooks support - send data via json to external URL / script - API From 5c1f171831dfcc68916f3b12af7e7f3cb9862cdd Mon Sep 17 00:00:00 2001 From: Gary Date: Sat, 2 May 2026 17:18:59 +0100 Subject: [PATCH 23/28] Feature: Add check for functions/vendor folder Nudge users to follow upgrade process in UPGRADE.md. --- UPDATE.md | 4 ++-- functions/checks/check_php_build.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/UPDATE.md b/UPDATE.md index e11cfba45..b3bb826a7 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -4,7 +4,7 @@ In general upgrading phpIPAM is a 6 step process: 1. Check PHP requirements 1. Backup database and `config.php` configuration file -1. Prepare for composer package management changes [ *upgrading from phpIPAM < v1.9.0 ] +1. Prepare for composer package management [ *upgrading from phpIPAM < v1.9.0 ] 1. Upgrade phpIPAM code 1. Update webserver configuration [ *upgrading from phpIPAM < v1.9.0 ] 1. Upgrade phpIPAM database. @@ -73,7 +73,7 @@ Enter password: Backup your `config.php` file containing database connection settings for phpIPAM. -# Prepare for composer package management changes [ * upgrading from phpIPAM < v1.9.0 ] +# Prepare for composer package management [ * upgrading from phpIPAM < v1.9.0 ] phpIPAM versions prior to 1.9.0 use a mix of git submodule and [composer](https://getcomposer.org/) packages installed in the `functions` sub-directory. diff --git a/functions/checks/check_php_build.php b/functions/checks/check_php_build.php index 86a6b7294..c5e59f703 100755 --- a/functions/checks/check_php_build.php +++ b/functions/checks/check_php_build.php @@ -132,6 +132,10 @@ $error[] = '


      ' . "\n"; $error[] = _('Please recompile PHP to include missing functions and restart Apache.'); } +elseif ( is_dir(__DIR__ . '/../vendor') ) { + $error[] = "" . _("'functions/vendor' folder found") . ":

      "; + $error[] = _("Please follow the \"Prepare for composer package management\" instructions in UPDATE.md to resolve this issue."); +} elseif ( !empty($missingPkg) ) { $error[] = ""._('The following composer issues are present').":

      "; $error[] = '
        ' . "\n"; From 7962192e5bae915faa21e24f6b984c1c78f9b957 Mon Sep 17 00:00:00 2001 From: Gary Date: Sat, 2 May 2026 22:39:59 +0100 Subject: [PATCH 24/28] Bugfix: Rector PHP fixes * NullToStrictStringFuncCallArgRector (gexttext, _) --- functions/classes/class.Addresses.php | 2 +- functions/classes/class.Common.php | 2 +- public/app/admin/custom-fields/index.php | 4 ++-- public/app/admin/device-types/index.php | 4 ++-- .../app/admin/import-export/import-devices-check.php | 2 +- .../app/admin/import-export/import-devtype-check.php | 2 +- .../app/admin/import-export/import-ipaddr-check.php | 2 +- .../app/admin/import-export/import-l2dom-check.php | 2 +- .../app/admin/import-export/import-subnets-check.php | 2 +- public/app/admin/import-export/import-vlan-check.php | 2 +- public/app/admin/import-export/import-vrf-check.php | 2 +- public/app/admin/users/edit.php | 2 +- public/app/admin/users/print-all.php | 2 +- public/app/admin/users/print-user/mail.php | 4 ++-- public/app/admin/users/print_module_permissions.php | 4 ++-- public/app/admin/widgets/index.php | 10 +++++----- public/app/dashboard/widget-popup.php | 4 ++-- public/app/sections/user-menu.php | 4 ++-- public/app/subnets/addresses/address-modify.php | 4 ++-- public/app/subnets/addresses/mail-notify.php | 2 +- public/app/subnets/mail-notify-subnet.php | 2 +- public/app/subnets/subnet-details/subnet-graph.php | 2 +- public/app/tools/changelog/show-popup.php | 12 ++++++------ public/app/tools/circuits/options.php | 4 ++-- public/app/tools/devices/index.php | 2 +- public/app/tools/pstn-prefixes/edit-number.php | 4 ++-- .../app/tools/pstn-prefixes/single-prefix-graph.php | 2 +- public/app/tools/racks/show-rack-popup.php | 2 +- public/app/tools/search/search-results-export.php | 2 +- 29 files changed, 47 insertions(+), 47 deletions(-) diff --git a/functions/classes/class.Addresses.php b/functions/classes/class.Addresses.php index 1a876d517..38901df99 100644 --- a/functions/classes/class.Addresses.php +++ b/functions/classes/class.Addresses.php @@ -121,7 +121,7 @@ public function address_type_format_tag ($state) { } else { if($this->address_types[$state]['showtag']==1) { - return ""; + return ""; } } } diff --git a/functions/classes/class.Common.php b/functions/classes/class.Common.php index e6b56c1b6..ed92cd307 100644 --- a/functions/classes/class.Common.php +++ b/functions/classes/class.Common.php @@ -1059,7 +1059,7 @@ public function get_post_action() { $valid_actions = $this->get_valid_actions(); if (in_array($action, $valid_actions)) { - return escape_input(ucwords(_($action))); + return escape_input(ucwords(_((string) $action))); } else { return _('Invalid $_POST action'); } diff --git a/public/app/admin/custom-fields/index.php b/public/app/admin/custom-fields/index.php index d92c1c72d..79ede8d75 100755 --- a/public/app/admin/custom-fields/index.php +++ b/public/app/admin/custom-fields/index.php @@ -86,7 +86,7 @@ //title print "
    • "; - print "
      "._($title)."
      "; + print "
      "._((string) $title)."
      "; print "
      "; - print " "; + print " "; print "
      '. _($type->tname) .''. _($type->tdescription) .''. _((string) $type->tname) .''. _((string) $type->tdescription) .''. $type->bgcolor .''. $type->fgcolor .'
      ".$cdata[$cfield].""._($cdata['msg'])."
      "._((string) $cdata['msg'])."
      ".$cdata['tname']." ".$cdata['tdescription'].""._($cdata['msg'])."
      "._((string) $cdata['msg'])."
      " . (isset($cdata[$cfield]) ? escape_input($cdata[$cfield]) : "") . ""._($cdata['msg'])."
      "._((string) $cdata['msg'])."
      ".$cdata['name']." ".$cdata['description'].""._($cdata['msg'])."
      "._((string) $cdata['msg'])."
      ".$cdata[$cfield].""._($cdata['msg'])."
      "._((string) $cdata['msg'])."
      ".$cdata['description']." ".$cdata['domain'].""._($cdata['msg'])."
      "._((string) $cdata['msg'])."
      ".$cdata[$cfield].""._($cdata['msg'])."
      "._((string) $cdata['msg'])."
      "._($name).""._((string) $name).""; print " '._('._('._(
      role == "Administrator" ? _($user->mailNotify) : _("No"); ?>role == "Administrator" ? _((string) $user->mailNotify) : _("No"); ?>
      role == "Administrator" ? _($user->mailChangelog) : _("No"); ?>role == "Administrator" ? _((string) $user->mailChangelog) : _("No"); ?>
      "; foreach ($user as $key=>$u) { if(strpos((string) $key, "perm_")!==false && array_key_exists((string) $key, $perm_names)) { - print ""; + print ""; } } print "
      "._($perm_names[$key])."".$User->print_permission_badge($user[$key])."
      "._((string) $perm_names[$key])."".$User->print_permission_badge($user[$key])."
      "; diff --git a/public/app/admin/widgets/index.php b/public/app/admin/widgets/index.php index 464827246..d8fe0eb66 100755 --- a/public/app/admin/widgets/index.php +++ b/public/app/admin/widgets/index.php @@ -62,12 +62,12 @@ else { $vPrint = ""._('Invalid').""; } print ""; - print " "._($w['wtitle']).""; - print " "._($w['wdescription']).""; + print " "._((string) $w['wtitle']).""; + print " "._((string) $w['wdescription']).""; print " $w[wfile].php"; - print " "._($w['wadminonly']).""; - print " "._($w['wactive']).""; - print " "._($w['wparams']).""; + print " "._((string) $w['wadminonly']).""; + print " "._((string) $w['wactive']).""; + print " "._((string) $w['wparams']).""; print " $vPrint"; print " "; print "
      "; diff --git a/public/app/dashboard/widget-popup.php b/public/app/dashboard/widget-popup.php index 705172946..d6183807a 100755 --- a/public/app/dashboard/widget-popup.php +++ b/public/app/dashboard/widget-popup.php @@ -37,8 +37,8 @@ # size fix if(is_blank($wtmp['wsize'])) { $wtmp['wsize']=6; } print "
    • "; - print " "._($wtmp['wtitle']); - print "
      "._($wtmp['wdescription'])."
      "; + print " "._((string) $wtmp['wtitle']); + print "
      "._((string) $wtmp['wdescription'])."
      "; print "
    • \n"; $m++; } diff --git a/public/app/sections/user-menu.php b/public/app/sections/user-menu.php index b3e73acb6..2006f3446 100755 --- a/public/app/sections/user-menu.php +++ b/public/app/sections/user-menu.php @@ -72,7 +72,7 @@ ,real_name; ?>
      "> user->real_name; ?>
      - user->role); ?>
      + user->role); ?>
      "> @@ -80,7 +80,7 @@ ">, user->real_name; ?>
      - user->role); ?>
      + user->role); ?>
      "> diff --git a/public/app/subnets/addresses/address-modify.php b/public/app/subnets/addresses/address-modify.php index dafd1c581..ee1e43b98 100644 --- a/public/app/subnets/addresses/address-modify.php +++ b/public/app/subnets/addresses/address-modify.php @@ -310,8 +310,8 @@ function validate_mac (ip, mac, sectionId, vlanId, id) { print ' '. "\n"; print ' '. "\n"; diff --git a/public/app/subnets/addresses/mail-notify.php b/public/app/subnets/addresses/mail-notify.php index 90694f1a8..f20251a53 100644 --- a/public/app/subnets/addresses/mail-notify.php +++ b/public/app/subnets/addresses/mail-notify.php @@ -93,7 +93,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $custom_field) { if(!empty($address[$custom_field['name']])) { - $content[] = "• ". _($custom_field['name']).":\t".$address[$custom_field['name']]; + $content[] = "• ". _((string) $custom_field['name']).":\t".$address[$custom_field['name']]; } } } diff --git a/public/app/subnets/mail-notify-subnet.php b/public/app/subnets/mail-notify-subnet.php index 7154f6db9..e17cf25d8 100644 --- a/public/app/subnets/mail-notify-subnet.php +++ b/public/app/subnets/mail-notify-subnet.php @@ -69,7 +69,7 @@ if(sizeof($custom_fields) > 0) { foreach($custom_fields as $custom_field) { if(!empty($address[$custom_field['name']])) { - $content[] = "• ". _($custom_field['name']).":\t".$address[$custom_field['name']]; + $content[] = "• ". _((string) $custom_field['name']).":\t".$address[$custom_field['name']]; } } } diff --git a/public/app/subnets/subnet-details/subnet-graph.php b/public/app/subnets/subnet-details/subnet-graph.php index 80fa8f411..2cb3f14e3 100755 --- a/public/app/subnets/subnet-details/subnet-graph.php +++ b/public/app/subnets/subnet-details/subnet-graph.php @@ -37,7 +37,7 @@ $type_percent = $t['type']."_percent"; if(isset($details[$type_percent]) && $details[$type_percent]>0) { $details[$type_percent] = str_replace(",", ".", (string) $details[$type_percent]); - print "{ label: '"._($t['type'])."', data: ".$details[$t["type"]."_percent"].", color: '".$t['bgcolor']."' }, "; + print "{ label: '"._((string) $t['type'])."', data: ".$details[$t["type"]."_percent"].", color: '".$t['bgcolor']."' }, "; } } ?> diff --git a/public/app/tools/changelog/show-popup.php b/public/app/tools/changelog/show-popup.php index 1f1dfbb63..e5ae9726f 100644 --- a/public/app/tools/changelog/show-popup.php +++ b/public/app/tools/changelog/show-popup.php @@ -61,12 +61,12 @@ print " "._('Object').""; print " "; // print object details - if(is_blank($clog->tid)) { print _($type)." "._("Deleted").""; } - elseif($type=="IP address") { print _($type)." (".$Subnets->transform_address ($clog->ip_addr, "dotted").")";} - elseif($type=="Subnet") { print _($type)." (".$Subnets->transform_address ($clog->ip_addr, "dotted")."/$clog->mask)";} - elseif($type=="Folder") { print _($type)." ($clog->sDescription)"; } - elseif($type=="Section") { print _($type)." ($clog->sDescription)"; } - else { print _($type); } + if(is_blank($clog->tid)) { print _((string) $type)." "._("Deleted").""; } + elseif($type=="IP address") { print _((string) $type)." (".$Subnets->transform_address ($clog->ip_addr, "dotted").")";} + elseif($type=="Subnet") { print _((string) $type)." (".$Subnets->transform_address ($clog->ip_addr, "dotted")."/$clog->mask)";} + elseif($type=="Folder") { print _((string) $type)." ($clog->sDescription)"; } + elseif($type=="Section") { print _((string) $type)." ($clog->sDescription)"; } + else { print _((string) $type); } print ""; print ""; diff --git a/public/app/tools/circuits/options.php b/public/app/tools/circuits/options.php index c564302c3..11191cf56 100644 --- a/public/app/tools/circuits/options.php +++ b/public/app/tools/circuits/options.php @@ -99,7 +99,7 @@ //title print " "; print " "; - print "
      "._($title)."
      "; + print "
      "._((string) $title)."
      "; print " "; print " "; @@ -168,7 +168,7 @@ //add print ""; print ""; - print " "; + print " "; print ""; print ""; diff --git a/public/app/tools/devices/index.php b/public/app/tools/devices/index.php index 034afbe67..005ec2527 100755 --- a/public/app/tools/devices/index.php +++ b/public/app/tools/devices/index.php @@ -45,7 +45,7 @@

      - hostname); ?>


      + hostname); ?>
      diff --git a/public/app/tools/pstn-prefixes/edit-number.php b/public/app/tools/pstn-prefixes/edit-number.php index 3e36cd2d2..e4c44c203 100644 --- a/public/app/tools/pstn-prefixes/edit-number.php +++ b/public/app/tools/pstn-prefixes/edit-number.php @@ -140,8 +140,8 @@ print ' '; print ' '; diff --git a/public/app/tools/pstn-prefixes/single-prefix-graph.php b/public/app/tools/pstn-prefixes/single-prefix-graph.php index db349e8d1..9da9b6f4a 100644 --- a/public/app/tools/pstn-prefixes/single-prefix-graph.php +++ b/public/app/tools/pstn-prefixes/single-prefix-graph.php @@ -29,7 +29,7 @@ foreach($Subnets->address_types as $t) { if($details[$t['type']."_percent"]>0) { $details[$t['type']."_percent"] = str_replace(",", ".", (string) $details[$t['type']."_percent"]); - print "{ label: '"._($t['type'])."', data: ".$details[$t["type"]."_percent"].", color: '".$t['bgcolor']."' }, "; + print "{ label: '"._((string) $t['type'])."', data: ".$details[$t["type"]."_percent"].", color: '".$t['bgcolor']."' }, "; } } } diff --git a/public/app/tools/racks/show-rack-popup.php b/public/app/tools/racks/show-rack-popup.php index 28fb6b2ee..0e313af50 100755 --- a/public/app/tools/racks/show-rack-popup.php +++ b/public/app/tools/racks/show-rack-popup.php @@ -44,7 +44,7 @@
      show("danger", _($error), true, true, false, true); + $Result->show("danger", _((string) $error), true, true, false, true); } else { ?> diff --git a/public/app/tools/search/search-results-export.php b/public/app/tools/search/search-results-export.php index 74e0f2c73..8657ec928 100755 --- a/public/app/tools/search/search-results-export.php +++ b/public/app/tools/search/search-results-export.php @@ -230,7 +230,7 @@ $worksheet->write($lineCount, $x, $Subnets->transform_to_dotted($ip['ip_addr']), $format_left); $x++; # state if(in_array('state', $selected_ip_fields)) { - $worksheet->write($lineCount, $x, _($Addresses->address_type_index_to_type ($ip['state'])) ); $x++; + $worksheet->write($lineCount, $x, _((string) $Addresses->address_type_index_to_type ($ip['state'])) ); $x++; } $worksheet->write($lineCount, $x, $ip['description']); $x++; $worksheet->write($lineCount, $x, $ip['hostname']); $x++; From 57f126a0601e021d7de564d46cdb4bee55ce4ccf Mon Sep 17 00:00:00 2001 From: Gary Date: Mon, 4 May 2026 13:24:40 +0100 Subject: [PATCH 25/28] Bugfix: Don't show errors when generating captcha --- public/app/login/captchashow.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/app/login/captchashow.php b/public/app/login/captchashow.php index 4cb8c0c08..38d9ca26b 100644 --- a/public/app/login/captchashow.php +++ b/public/app/login/captchashow.php @@ -9,6 +9,9 @@ // defines Securimage class require_once __DIR__ . '/../../../functions/functions.php'; +# Don't corrupt output with php errors! +disable_php_errors(); + // Create a user $_SESSION to store captcha code $Database = new Database_PDO; $User = new User ($Database); From 9918a9e5734ac10418c447fa24d2373e48335ab4 Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 6 May 2026 17:58:35 +0100 Subject: [PATCH 26/28] Bugfix: Rack dropdown fails to populate while editing a device Fixes #4602 --- misc/CHANGELOG | 1 + public/app/admin/devices/edit-rack-dropdown.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/misc/CHANGELOG b/misc/CHANGELOG index 14b1d0fd7..0ac91a722 100755 --- a/misc/CHANGELOG +++ b/misc/CHANGELOG @@ -4,6 +4,7 @@ ---------------------------- + PHP8 compatibility fixes; + Rack SVG image errors (#4595); + + Rack dropdown fails to populate while editing a device (#4602); Enhancements, changes: ---------------------------- diff --git a/public/app/admin/devices/edit-rack-dropdown.php b/public/app/admin/devices/edit-rack-dropdown.php index 20822b323..970f9dadb 100644 --- a/public/app/admin/devices/edit-rack-dropdown.php +++ b/public/app/admin/devices/edit-rack-dropdown.php @@ -1,6 +1,16 @@ check_user_session(); # perm check popup @@ -22,7 +32,7 @@ # show only for numeric (set) rackid if($POST->rackid>0 || @$device['rack']>0) { # load objects for ajax-loaded stuff - if(!isset($User) || !is_object($User)) { + if($ajax_loaded) { # initialize user object $Database = new Database_PDO; $User = new User ($Database); From 858344e10ed223c4b367aa76f62cada4c7ace3de Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 6 May 2026 18:25:06 +0100 Subject: [PATCH 27/28] Make the FullDepth checkbox into a toggle Closes #4603 Co-Authored-By: @riversdev0 --- .../app/admin/devices/edit-rack-dropdown.php | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/public/app/admin/devices/edit-rack-dropdown.php b/public/app/admin/devices/edit-rack-dropdown.php index 970f9dadb..767478b10 100644 --- a/public/app/admin/devices/edit-rack-dropdown.php +++ b/public/app/admin/devices/edit-rack-dropdown.php @@ -33,15 +33,6 @@ if($POST->rackid>0 || @$device['rack']>0) { # load objects for ajax-loaded stuff if($ajax_loaded) { - # initialize user object - $Database = new Database_PDO; - $User = new User ($Database); - $Racks = new phpipam_rack ($Database); - $Result = new Result (); - - # verify that user is logged in - $User->check_user_session(); - # validate in inputs if(!is_numeric($POST->rackid)) { print "".$Result->show ("danger", _("Invalid ID"), false, false, true).""; die(); } # fetch rack @@ -76,6 +67,23 @@ // available spaces list($available, $available_back) = $Racks->free_u($rack, $rack_devices, $rack_contents, $device); ?> + From b470de22d4a9cfd7e5bc711dadeaa228297c184c Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 6 May 2026 18:52:10 +0100 Subject: [PATCH 28/28] Bugfix: Rector PHP fixes * NullToStrictStringFuncCallArgRector (strpos) --- functions/classes/class.Common.php | 4 ++-- functions/classes/class.Tools.php | 4 ++-- public/app/admin/vaults/import-certificate-file-verify.php | 2 +- public/app/tools/documentation/index.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions/classes/class.Common.php b/functions/classes/class.Common.php index ed92cd307..d2839f11d 100644 --- a/functions/classes/class.Common.php +++ b/functions/classes/class.Common.php @@ -731,8 +731,8 @@ public function verify_checkbox ($field) { */ public function identify_address ($address) { # dotted representation - if (strpos($address, ':') !== false) return 'IPv6'; - if (strpos($address, '.') !== false) return 'IPv4'; + if (strpos((string) $address, ':') !== false) return 'IPv6'; + if (strpos((string) $address, '.') !== false) return 'IPv4'; # numeric representation if (is_numeric($address)) { if($address <= 4294967295) return 'IPv4'; // 4294967295 = '255.255.255.255' diff --git a/functions/classes/class.Tools.php b/functions/classes/class.Tools.php index 1290b1e9d..37f853c9e 100644 --- a/functions/classes/class.Tools.php +++ b/functions/classes/class.Tools.php @@ -628,7 +628,7 @@ public function reformat_IPv6_for_search ($address) { } else { # fake mask - if (strpos($address, "/")==0) { $address .= "/128"; } + if (strpos((string) $address, "/")==0) { $address .= "/128"; } # parse address $parsed = $this->Net_IPv6->parseAddress($address); @@ -833,7 +833,7 @@ public function fetch_standard_fields ($table) { $d = trim($d); if(strpos(trim($d), "`")==0) { $d = strstr(trim($d, "`"), "`", true); - $out[] = substr($d, strpos($d, "`")); + $out[] = substr($d, strpos((string) $d, "`")); } } # return array of fields diff --git a/public/app/admin/vaults/import-certificate-file-verify.php b/public/app/admin/vaults/import-certificate-file-verify.php index e5eaa1ed5..ac4229bd7 100644 --- a/public/app/admin/vaults/import-certificate-file-verify.php +++ b/public/app/admin/vaults/import-certificate-file-verify.php @@ -49,7 +49,7 @@ // process cer if($filename=="cer" || $filename=="pem" || $filename=="crt") { // detect BEGIN CERTIFICATE - if(strpos(file_get_contents($_FILES["file"]["tmp_name"]), "BEGIN CERTIFICATE")!==false) { + if(strpos((string) file_get_contents($_FILES["file"]["tmp_name"]), "BEGIN CERTIFICATE")!==false) { $certificate = trim(file_get_contents($_FILES["file"]["tmp_name"])); } // binary diff --git a/public/app/tools/documentation/index.php b/public/app/tools/documentation/index.php index 30887fbd6..b75ca2865 100644 --- a/public/app/tools/documentation/index.php +++ b/public/app/tools/documentation/index.php @@ -25,7 +25,7 @@ $path_doc = realpath("$path_root/$document"); $html = ""; -if (strpos($path_doc, (string) $path_root) !== 0) { +if (strpos((string) $path_doc, (string) $path_root) !== 0) { $Result->show("danger", _('Requested resource is not inside doc directory'), true); }