Skip to content

Commit

Permalink
Fixing #4866 - PHP 8.2 Support
Browse files Browse the repository at this point in the history
Using ${var} in strings is deprecated, use {$var} instead in file
  • Loading branch information
TheWitness committed Jul 20, 2022
1 parent a379b48 commit aaa502f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Cacti CHANGELOG
-issue#4853: Deprecation warnings when attempting real-time Graphs with PHP8.1
-issue#4860: Custom Timespan is lost when clicking other tree branches
-issue#4865: XML Pre-processing during Graph Creation throws error when Resource XML file inproperly formatted
-issue#4866: Using ${var} in strings is deprecated, use {$var} instead in file
-issue#4867: In Graph Management, filtering for "Device: None" shows all graphs
-feature#4820: Make it possible to only import certain components when importing packages
-feature#4825: Add update_device.php script to cli folder
Expand Down
4 changes: 2 additions & 2 deletions cli/change_device.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@

/* process snmp information */
if ($host['snmp_version'] < 0 || $host['snmp_version'] > 3) {
print "ERROR: Invalid snmp version (${host['snmp_version']})\n";
print "ERROR: Invalid snmp version ({$host['snmp_version']})\n";
exit(1);
} elseif ($host['snmp_version'] > 0) {
if ($host['snmp_port'] <= 1 || $host['snmp_port'] > 65534) {
Expand All @@ -364,7 +364,7 @@
}

if (!$quietMode) {
print "Changing device-id: $device_id to ${host['description']} (${host['hostname']}) as \"${host_templates[$host['host_template_id']]}\" using SNMP v${host['snmp_version']} with community \"${host['snmp_community']}\"\n";
print "Changing device-id: $device_id to {$host['description']} ({$host['hostname']}) as \"{$host_templates[$host['host_template_id']]}\" using SNMP v{$host['snmp_version']} with community \"{$host['snmp_community']}\"\n";
}

$host_id = api_device_save($device_id, $host['host_template_id'], $host['description'], $host['ip'],
Expand Down
4 changes: 2 additions & 2 deletions lib/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ function html_nav_bar($base_url, $max_pages, $current_page, $rows_per_page, $tot
if ($return_to != '') {//code as in get_page_list()
$nav .= "<script type='text/javascript'>function goto$page_var(pageNo) { if (typeof url_graph === 'function') { var url_add=url_graph('') } else { var url_add=''; }; $.get('" . $base_url . "header=false&" . $page_var . "='+pageNo+url_add).done(function(data) { $('#$return_to').html(data); applySkin(); }); }</script>";
} else {
$nav .= "<script type='text/javascript'>function goto${page_var}(pageNo) { if (typeof url_graph === 'function') { var url_add=url_graph('') } else { var url_add=''; }; document.location='$base_url$page_var='+pageNo+url_add }</script>";
$nav .= "<script type='text/javascript'>function goto{$page_var}(pageNo) { if (typeof url_graph === 'function') { var url_add=url_graph('') } else { var url_add=''; }; document.location='$base_url$page_var='+pageNo+url_add }</script>";
}
}
} else {
Expand Down Expand Up @@ -1410,7 +1410,7 @@ function draw_menu($user_menu = '') {
}

print "<li class='menuitem' role='menuitem' aria-haspopup='true' id='$id'><a class='menu_parent active' href='#'>$glyph<span>$header_name</span></a>";
print "<ul role='menu' id='${id}_div' style='display:block;'>";
print "<ul role='menu' id='{$id}_div' style='display:block;'>";

/* pass 2: loop through each top level item and render it */
foreach ($header_array as $item_url => $item_title) {
Expand Down
4 changes: 2 additions & 2 deletions lib/html_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ function draw_edit_control($field_name, &$field_array) {
break;
case 'checkbox_group':
if (isset($field_array['type']) && $field_array['type'] == 'flex') {
print "</td></tr><tr><td><div id='${field_name}_group' class='checkboxgroup1 flexContainer'>" . PHP_EOL;
print "</td></tr><tr><td><div id='{$field_name}_group' class='checkboxgroup1 flexContainer'>" . PHP_EOL;
} else {
print "<div id='${field_name}_group' class='checkboxgroup1'>" . PHP_EOL;
print "<div id='{$field_name}_group' class='checkboxgroup1'>" . PHP_EOL;
}

foreach ($field_array['items'] as $check_name => $check_array) {
Expand Down
2 changes: 1 addition & 1 deletion lib/html_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ function get_page_list($current_page, $pages_per_screen, $rows_per_page, $total_
if ($return_to != '') {
$url_page_select .= "<script type='text/javascript'>function goto$page_var(pageNo) { if (typeof url_graph === 'function') { var url_add=url_graph('') } else { var url_add=''; }; $.get('" . sanitize_uri($url) . "header=false&" . $page_var . "='+pageNo+url_add).done(function(data) { $('#$return_to').html(data); applySkin(); }); }</script>";
} else {
$url_page_select .= "<script type='text/javascript'>function goto${page_var}(pageNo) { if (typeof url_graph === 'function') { var url_add=url_graph('') } else { var url_add=''; }; document.location='$url$page_var='+pageNo+url_add }</script>";
$url_page_select .= "<script type='text/javascript'>function goto{$page_var}(pageNo) { if (typeof url_graph === 'function') { var url_add=url_graph('') } else { var url_add=''; }; document.location='$url$page_var='+pageNo+url_add }</script>";
}

return $url_page_select;
Expand Down

0 comments on commit aaa502f

Please sign in to comment.