Skip to content

Commit

Permalink
php8: Compatibility fixes.
Browse files Browse the repository at this point in the history
- jQuery Error! when importing or recompute subnets.  Fixes #4022
- Transation not started errors on upgrade
  • Loading branch information
GaryAllan committed Mar 1, 2024
1 parent c459430 commit 69e0e66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/admin/import-export/import-recompute-logic.php
Expand Up @@ -15,6 +15,8 @@
if (!isset($Sections)) { $Sections = new Sections ($Database); }
if (!isset($Subnets)) { $Subnets = new Subnets ($Database); }

$Params = new Params($_GET);

# Load colors and icons
include 'import-constants.php';

Expand All @@ -25,14 +27,14 @@
foreach($_GET as $key => $value) {
if (preg_match("/recomputeSection_(\d+)$/",$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);
$rlist[$matches[1]]["CVRF"] = ($_GET['recomputeSectionCVRF_'.$matches[1]] == "on" ? true : false);
$rlist[$matches[1]]["IPv4"] = ($Params->{'recomputeSectionIPv4_'.$matches[1]} == "on" ? true : false);
$rlist[$matches[1]]["IPv6"] = ($Params->{'recomputeSectionIPv6_'.$matches[1]} == "on" ? true : false);
$rlist[$matches[1]]["CVRF"] = ($Params->{'recomputeSectionCVRF_'.$matches[1]} == "on" ? true : false);
# Build hidden form inputs
$pass_inputs.="<input name='".$key."' type='hidden' value='".$value."' style='display:none;'>";
$pass_inputs.="<input name='recomputeSectionIPv4_".$matches[1]."' type='hidden' value='".$_GET['recomputeSectionIPv4_'.$matches[1]]."' style='display:none;'>";
$pass_inputs.="<input name='recomputeSectionIPv6_".$matches[1]."' type='hidden' value='".$_GET['recomputeSectionIPv6_'.$matches[1]]."' style='display:none;'>";
$pass_inputs.="<input name='recomputeSectionCVRF_".$matches[1]."' type='hidden' value='".$_GET['recomputeSectionCVRF_'.$matches[1]]."' style='display:none;'>";
$pass_inputs.="<input name='recomputeSectionIPv4_".$matches[1]."' type='hidden' value='".$Params->{'recomputeSectionIPv4_'.$matches[1]}."' style='display:none;'>";
$pass_inputs.="<input name='recomputeSectionIPv6_".$matches[1]."' type='hidden' value='".$Params->{'recomputeSectionIPv6_'.$matches[1]}."' style='display:none;'>";
$pass_inputs.="<input name='recomputeSectionCVRF_".$matches[1]."' type='hidden' value='".$Params->{'recomputeSectionCVRF_'.$matches[1]}."' style='display:none;'>";
}
}

Expand All @@ -49,8 +51,8 @@
array_splice($all_vrfs,0,0,(object) array(array('vrfId' => '0', 'name' => 'default', 'rd' => '0:0')));
foreach ($all_vrfs as $vrf) { $vrf = (array) $vrf; $vrf_name[(int)$vrf['vrfId']] = $vrf['name']; }

$rows = ""; $counters = ['edit' => 0]; $edata = [];
$recomputeHideUnchanged = ($_GET['recomputeHideUnchanged'] == "on");
$rows = ""; $counters = ['edit' => 0, 'skip' => 0]; $edata = [];
$recomputeHideUnchanged = ($Params->recomputeHideUnchanged == "on");

foreach ($rlist as $sect_id => $sect_check) {
$compute_results = $Subnets->recompute_masterIds($sect_id, $sect_check);
Expand Down
2 changes: 2 additions & 0 deletions functions/classes/class.PDO.php
Expand Up @@ -1068,6 +1068,8 @@ public function commit() {
* @return bool
*/
public function rollBack() {
if (!$this->pdo->inTransaction())
return false;
return $this->pdo->rollBack();
}
}
Expand Down

0 comments on commit 69e0e66

Please sign in to comment.