Skip to content

Commit

Permalink
Merge pull request #76 from Schnittcher/main
Browse files Browse the repository at this point in the history
Fix für Portweiterleitungen
  • Loading branch information
elueckel authored Feb 1, 2024
2 parents 358ce72 + 2c08ce7 commit c2a1bdf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions UniFi Internet Controller/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public function GetPortForwardRules(bool $printOutput = false)
}

// activate PortForwarding rule (user defined rules only!)
public function ActivatePortForwardRule(string $ruleId)
public function PortForwardRule(string $ruleId, bool $state)
{
$ControllerType = 0;
$ServerAddress = $this->ReadPropertyString("ServerAddress");
Expand Down Expand Up @@ -448,7 +448,7 @@ public function ActivatePortForwardRule(string $ruleId)

// [field] => enabled, [pattern] => true|false
$CommandToController = json_encode(array(
"enabled" => true,
"enabled" => $state,
), JSON_UNESCAPED_SLASHES);
//var_dump($CommandToController);

Expand All @@ -464,9 +464,9 @@ public function ActivatePortForwardRule(string $ruleId)
echo "\nhttps://".$ServerAddress.":".$ServerPort.$MiddlePartURL.$UnifiAPI."\n";

$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_URL, "https://".$ServerAddress.":".$ServerPort.$MiddlePartURL.$UnifiAPI);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Cookie:'.$Cookie, $X_CSRF_Token));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $CommandToController);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
Expand Down

0 comments on commit c2a1bdf

Please sign in to comment.