plugins: PSR12 "b", "d" and "m"

This commit is contained in:
Franco Fichtner 2019-10-07 16:27:10 +02:00
parent 0d1f9d9362
commit c3328e60c0
29 changed files with 79 additions and 49 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
Copyright (C) 2017 Fabian Franz Copyright (C) 2017 Fabian Franz

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
Copyright (C) 2017 Fabian Franz Copyright (C) 2017 Fabian Franz

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
Copyright (C) 2017 Fabian Franz Copyright (C) 2017 Fabian Franz
All rights reserved. All rights reserved.

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2019 Deciso B.V. * Copyright (C) 2019 Deciso B.V.
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2019 Deciso B.V. * Copyright (C) 2019 Deciso B.V.
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2019 Deciso B.V. * Copyright (C) 2019 Deciso B.V.
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2015 Deciso B.V. * Copyright (C) 2015 Deciso B.V.
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2015-2019 Deciso B.V. * Copyright (C) 2015-2019 Deciso B.V.
* *
@ -63,7 +64,7 @@ class SettingsController extends ApiControllerBase
*/ */
public function setAction() public function setAction()
{ {
$result = array("result"=>"failed"); $result = array("result" => "failed");
if ($this->request->isPost()) { if ($this->request->isPost()) {
// load model and update with provided data // load model and update with provided data
$mdlHelloWorld = new HelloWorld(); $mdlHelloWorld = new HelloWorld();
@ -75,7 +76,7 @@ class SettingsController extends ApiControllerBase
if (!array_key_exists("validations", $result)) { if (!array_key_exists("validations", $result)) {
$result["validations"] = array(); $result["validations"] = array();
} }
$result["validations"]["helloworld.".$msg->getField()] = $msg->getMessage(); $result["validations"]["helloworld." . $msg->getField()] = $msg->getMessage();
} }
// serialize model to config and save // serialize model to config and save

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2015-2019 Deciso B.V. * Copyright (C) 2015-2019 Deciso B.V.
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2015 Deciso B.V. * Copyright (C) 2015 Deciso B.V.
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2015 Deciso B.V. * Copyright (C) 2015 Deciso B.V.
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com> * Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com> * Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
* Copyright (C) 2019 Deciso B.V. * Copyright (C) 2019 Deciso B.V.

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com> * Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
* Copyright (C) 2019 Deciso B.V. * Copyright (C) 2019 Deciso B.V.
@ -50,7 +51,7 @@ class RecordController extends ApiMutableModelControllerBase
if ($this->request->isPost()) { if ($this->request->isPost()) {
$record = $this->getModel()->getRecord($uuid); $record = $this->getModel()->getRecord($uuid);
if ($record !== null) { if ($record !== null) {
(new Domain)->updateSerial((string)$record->domain)->serializeToConfig(); (new Domain())->updateSerial((string)$record->domain)->serializeToConfig();
Config::getInstance()->save(); Config::getInstance()->save();
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com> * Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com> * Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
* *

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com> * Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
* *

View File

@ -181,7 +181,7 @@ class updatedns
log_error("Dynamic DNS: updatedns() starting"); log_error("Dynamic DNS: updatedns() starting");
} }
$dyndnslck = lock("DDNS".$dnsID, LOCK_EX); $dyndnslck = lock("DDNS" . $dnsID, LOCK_EX);
if (!$dnsService) { if (!$dnsService) {
$this->_error(2); $this->_error(2);
@ -370,7 +370,7 @@ class updatedns
$this->_dnsWildcard = "ON"; $this->_dnsWildcard = "ON";
} }
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
$server = "https://members.dyndns.org/nic/update"; $server = "https://members.dyndns.org/nic/update";
$port = ""; $port = "";
if ($this->_dnsServer) { if ($this->_dnsServer) {
@ -379,7 +379,7 @@ class updatedns
if ($this->_dnsPort) { if ($this->_dnsPort) {
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
curl_setopt($ch, CURLOPT_URL, $server .$port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO'); curl_setopt($ch, CURLOPT_URL, $server . $port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO');
break; break;
case 'dhs': case 'dhs':
$post_data['hostscmd'] = 'edit'; $post_data['hostscmd'] = 'edit';
@ -406,7 +406,7 @@ class updatedns
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
curl_setopt($ch, CURLOPT_URL, '{$server}{$port}'); curl_setopt($ch, CURLOPT_URL, '{$server}{$port}');
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
break; break;
case 'noip': case 'noip':
@ -420,9 +420,11 @@ class updatedns
if ($this->_dnsPort) { if ($this->_dnsPort) {
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
if (($this->_dnsService == "noip-free") && if (
($this->_forceUpdateNeeded == true) && ($this->_dnsService == "noip-free") &&
($this->_dnsDummyUpdateDone == false)) { ($this->_forceUpdateNeeded == true) &&
($this->_dnsDummyUpdateDone == false)
) {
// Update the IP to a dummy value to force No-IP free accounts to see a change. // Update the IP to a dummy value to force No-IP free accounts to see a change.
$iptoset = "192.168.1.1"; $iptoset = "192.168.1.1";
$this->_dnsDummyUpdateDone = true; $this->_dnsDummyUpdateDone = true;
@ -430,11 +432,11 @@ class updatedns
} else { } else {
$iptoset = $this->_dnsIP; $iptoset = $this->_dnsIP;
} }
curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&pass=' . urlencode($this->_dnsPass) . '&hostname=' . $this->_dnsHost.'&ip=' . $iptoset); curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&pass=' . urlencode($this->_dnsPass) . '&hostname=' . $this->_dnsHost . '&ip=' . $iptoset);
break; break;
case 'easydns': case 'easydns':
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
$server = "https://members.easydns.com/dyn/dyndns.php"; $server = "https://members.easydns.com/dyn/dyndns.php";
$port = ""; $port = "";
if ($this->_dnsServer) { if ($this->_dnsServer) {
@ -446,7 +448,7 @@ class updatedns
curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=' . $this->_dnsBackMX); curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=' . $this->_dnsBackMX);
break; break;
case 'hn': case 'hn':
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
$server = "http://dup.hn.org/vanity/update"; $server = "http://dup.hn.org/vanity/update";
$port = ""; $port = "";
if ($this->_dnsServer) { if ($this->_dnsServer) {
@ -460,7 +462,7 @@ class updatedns
case 'zoneedit': case 'zoneedit':
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
$server = "https://dynamic.zoneedit.com/auth/dynamic.html"; $server = "https://dynamic.zoneedit.com/auth/dynamic.html";
$port = ""; $port = "";
@ -470,7 +472,7 @@ class updatedns
if ($this->_dnsPort) { if ($this->_dnsPort) {
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
curl_setopt($ch, CURLOPT_URL, "{$server}{$port}?host=" .$this->_dnsHost); curl_setopt($ch, CURLOPT_URL, "{$server}{$port}?host=" . $this->_dnsHost);
break; break;
case 'dyns': case 'dyns':
/* XXX HTTPS is currently broken for them */ /* XXX HTTPS is currently broken for them */
@ -508,13 +510,13 @@ class updatedns
sleep(1); sleep(1);
switch ($code) { switch ($code) {
case 100: case 100:
fputs($this->con['socket'], "LOGIN ".$this->_dnsUser." ".$this->_dnsPass."\n"); fputs($this->con['socket'], "LOGIN " . $this->_dnsUser . " " . $this->_dnsPass . "\n");
break; break;
case 225: case 225:
fputs($this->con['socket'], "DELRR ".$this->_dnsHost." A\n"); fputs($this->con['socket'], "DELRR " . $this->_dnsHost . " A\n");
break; break;
case 901: case 901:
fputs($this->con['socket'], "ADDRR ".$this->_dnsHost." A ".$this->_dnsIP."\n"); fputs($this->con['socket'], "ADDRR " . $this->_dnsHost . " A " . $this->_dnsIP . "\n");
break; break;
case 795: case 795:
fputs($this->con['socket'], "QUIT\n"); fputs($this->con['socket'], "QUIT\n");
@ -527,16 +529,16 @@ class updatedns
curl_setopt($ch, CURLOPT_URL, 'https://freedns.afraid.org/dynamic/update.php?' . $this->_dnsPass); curl_setopt($ch, CURLOPT_URL, 'https://freedns.afraid.org/dynamic/update.php?' . $this->_dnsPass);
break; break;
case 'dnsexit': case 'dnsexit':
curl_setopt($ch, CURLOPT_URL, 'https://www.dnsexit.com/RemoteUpdate.sv?login='.urlencode($this->_dnsUser). '&password='.$this->_dnsPass.'&host='.$this->_dnsHost.'&myip='.$this->_dnsIP); curl_setopt($ch, CURLOPT_URL, 'https://www.dnsexit.com/RemoteUpdate.sv?login=' . urlencode($this->_dnsUser) . '&password=' . $this->_dnsPass . '&host=' . $this->_dnsHost . '&myip=' . $this->_dnsIP);
break; break;
case 'loopia': case 'loopia':
$this->_dnsWildcard = (isset($this->_dnsWildcard) && $this->_dnsWildcard == true) ? 'ON' : 'OFF'; $this->_dnsWildcard = (isset($this->_dnsWildcard) && $this->_dnsWildcard == true) ? 'ON' : 'OFF';
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard); curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard);
break; break;
case 'staticcling': case 'staticcling':
curl_setopt($ch, CURLOPT_URL, 'https://www.staticcling.org/update.html?login='.urlencode($this->_dnsUser).'&pass='.$this->_dnsPass); curl_setopt($ch, CURLOPT_URL, 'https://www.staticcling.org/update.html?login=' . urlencode($this->_dnsUser) . '&pass=' . $this->_dnsPass);
break; break;
case 'dnsomatic': case 'dnsomatic':
/* Example syntax /* Example syntax
@ -562,7 +564,7 @@ class updatedns
if ($this->_dnsPort) { if ($this->_dnsPort) {
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NOCHG'); curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NOCHG');
break; break;
case 'namecheap': case 'namecheap':
/* Example: /* Example:
@ -570,7 +572,7 @@ class updatedns
*/ */
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$dparts = explode(".", trim($this->_dnsHost)); $dparts = explode(".", trim($this->_dnsHost));
$domain_part_count = ($dparts[count($dparts)-1] == "uk") ? 3 : 2; $domain_part_count = ($dparts[count($dparts) - 1] == "uk") ? 3 : 2;
$domain_offset = count($dparts) - $domain_part_count; $domain_offset = count($dparts) - $domain_part_count;
$hostname = implode(".", array_slice($dparts, 0, $domain_offset)); $hostname = implode(".", array_slice($dparts, 0, $domain_offset));
$domain = implode(".", array_slice($dparts, $domain_offset)); $domain = implode(".", array_slice($dparts, $domain_offset));
@ -614,7 +616,7 @@ class updatedns
$this->_dnsWildcard = "ON"; $this->_dnsWildcard = "ON";
} }
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
$server = "https://carol.selfhost.de/nic/update"; $server = "https://carol.selfhost.de/nic/update";
$port = ""; $port = "";
if ($this->_dnsServer) { if ($this->_dnsServer) {
@ -623,17 +625,17 @@ class updatedns
if ($this->_dnsPort) { if ($this->_dnsPort) {
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
curl_setopt($ch, CURLOPT_URL, $server .$port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO'); curl_setopt($ch, CURLOPT_URL, $server . $port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO');
break; break;
case 'route53': case 'route53':
case 'route53-v6': case 'route53-v6':
/* Setting Variables */ /* Setting Variables */
$hostname = "{$this->_dnsHost}."; $hostname = "{$this->_dnsHost}.";
$ZoneID = $this->_dnsZoneID; $ZoneID = $this->_dnsZoneID;
$AccessKeyId=$this->_dnsUser; $AccessKeyId = $this->_dnsUser;
$SecretAccessKey=$this->_dnsPass; $SecretAccessKey = $this->_dnsPass;
$NewIP=$this->_dnsIP; $NewIP = $this->_dnsIP;
$NewTTL=$this->_dnsTTL; $NewTTL = $this->_dnsTTL;
$RecordType = ($this->_useIPv6) ? "AAAA" : "A"; $RecordType = ($this->_useIPv6) ? "AAAA" : "A";
/* Set Amazon AWS Credentials for this record */ /* Set Amazon AWS Credentials for this record */
@ -673,10 +675,10 @@ class updatedns
} }
} }
$OldTTL=$oldTTLResult; $OldTTL = $oldTTLResult;
$OldIP=$oldIPResult; $OldIP = $oldIPResult;
} else { } else {
$OldIP=""; $OldIP = "";
} }
/* Check if we need to update DNS Record */ /* Check if we need to update DNS Record */
@ -773,13 +775,13 @@ class updatedns
break; break;
case 'eurodns': case 'eurodns':
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
$server = "https://update.eurodyndns.org/update/"; $server = "https://update.eurodyndns.org/update/";
$port = ""; $port = "";
if ($this->_dnsPort) { if ($this->_dnsPort) {
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
curl_setopt($ch, CURLOPT_URL, $server .$port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP); curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP);
break; break;
case 'gratisdns': case 'gratisdns':
$server = "https://ssl.gratisdns.dk/ddns.phtml"; $server = "https://ssl.gratisdns.dk/ddns.phtml";
@ -792,7 +794,7 @@ class updatedns
$this->_dnsWildcard = "ON"; $this->_dnsWildcard = "ON";
} }
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
$server = "https://www.ovh.com/nic/update"; $server = "https://www.ovh.com/nic/update";
$port = ""; $port = "";
if ($this->_dnsServer) { if ($this->_dnsServer) {
@ -801,11 +803,11 @@ class updatedns
if ($this->_dnsPort) { if ($this->_dnsPort) {
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
curl_setopt($ch, CURLOPT_URL, $server .$port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO'); curl_setopt($ch, CURLOPT_URL, $server . $port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO');
break; break;
case 'citynetwork': case 'citynetwork':
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
$server = 'https://dyndns.citynetwork.se/nic/update'; $server = 'https://dyndns.citynetwork.se/nic/update';
$port = ""; $port = "";
if ($this->_dnsServer) { if ($this->_dnsServer) {
@ -814,7 +816,7 @@ class updatedns
if ($this->_dnsPort) { if ($this->_dnsPort) {
$port = ":" . $this->_dnsPort; $port = ":" . $this->_dnsPort;
} }
curl_setopt($ch, CURLOPT_URL, $server .$port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP); curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP);
break; break;
case 'duckdns': case 'duckdns':
$server = "https://www.duckdns.org/update"; $server = "https://www.duckdns.org/update";
@ -827,7 +829,7 @@ class updatedns
$post_data['myip'] = $this->_dnsIP; $post_data['myip'] = $this->_dnsIP;
$post_data['offline'] = 'no'; $post_data['offline'] = 'no';
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_URL, $server); curl_setopt($ch, CURLOPT_URL, $server);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
@ -835,19 +837,19 @@ class updatedns
case 'strato': case 'strato':
$server = "https://dyndns.strato.com/nic/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}"; $server = "https://dyndns.strato.com/nic/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}";
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
curl_setopt($ch, CURLOPT_URL, $server); curl_setopt($ch, CURLOPT_URL, $server);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
break; break;
case '3322': case '3322':
$server = "http://members.3322.net/dyndns/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}"; $server = "http://members.3322.net/dyndns/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}";
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
curl_setopt($ch, CURLOPT_URL, $server); curl_setopt($ch, CURLOPT_URL, $server);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
break; break;
case 'oray': case 'oray':
$server = "http://ddns.oray.com/ph/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}"; $server = "http://ddns.oray.com/ph/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}";
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
curl_setopt($ch, CURLOPT_URL, $server); curl_setopt($ch, CURLOPT_URL, $server);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
break; break;
@ -948,7 +950,7 @@ class updatedns
break; break;
default: default:
$status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)";
$this->_debug("Unknown Response: ".$data); $this->_debug("Unknown Response: " . $data);
break; break;
} }
break; break;
@ -998,7 +1000,7 @@ class updatedns
} elseif (preg_match('/403/i', $data)) { } elseif (preg_match('/403/i', $data)) {
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Database Error - There was a server-sided database error."; $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Database Error - There was a server-sided database error.";
} elseif (preg_match('/405/i', $data)) { } elseif (preg_match('/405/i', $data)) {
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Hostname Error - The hostname (".$this->_dnsHost.") doesn't belong to you."; $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Hostname Error - The hostname (" . $this->_dnsHost . ") doesn't belong to you.";
} elseif (preg_match('/200/i', $data)) { } elseif (preg_match('/200/i', $data)) {
$status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Updated Successfully!"; $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Updated Successfully!";
$successful_update = true; $successful_update = true;
@ -1105,7 +1107,7 @@ class updatedns
$this->_dnsResultMatch = str_replace("%IP%", $this->_dnsIP, $this->_dnsResultMatch); $this->_dnsResultMatch = str_replace("%IP%", $this->_dnsIP, $this->_dnsResultMatch);
$matches = preg_split("/(?<!\\\\)\\|/", $this->_dnsResultMatch); $matches = preg_split("/(?<!\\\\)\\|/", $this->_dnsResultMatch);
foreach ($matches as $match) { foreach ($matches as $match) {
$match= str_replace("\\|", "|", $match); $match = str_replace("\\|", "|", $match);
if (strcmp($match, trim($data, "\t\n\r")) == 0) { if (strcmp($match, trim($data, "\t\n\r")) == 0) {
$successful_update = true; $successful_update = true;
} }
@ -1345,7 +1347,7 @@ class updatedns
if (file_exists($this->_cacheFile_v6)) { if (file_exists($this->_cacheFile_v6)) {
$contents = file_get_contents($this->_cacheFile_v6); $contents = file_get_contents($this->_cacheFile_v6);
list($cacheIP,$cacheTime) = explode('|', $contents); list($cacheIP,$cacheTime) = explode('|', $contents);
$this->_debug($cacheIP.'/'.$cacheTime); $this->_debug($cacheIP . '/' . $cacheTime);
$initial = false; $initial = false;
$log_error .= "Cached IPv6: {$cacheIP} "; $log_error .= "Cached IPv6: {$cacheIP} ";
} else { } else {
@ -1359,7 +1361,7 @@ class updatedns
if (file_exists($this->_cacheFile)) { if (file_exists($this->_cacheFile)) {
$contents = file_get_contents($this->_cacheFile); $contents = file_get_contents($this->_cacheFile);
list($cacheIP,$cacheTime) = explode('|', $contents); list($cacheIP,$cacheTime) = explode('|', $contents);
$this->_debug($cacheIP.'/'.$cacheTime); $this->_debug($cacheIP . '/' . $cacheTime);
$initial = false; $initial = false;
$log_error .= "Cached IP: {$cacheIP} "; $log_error .= "Cached IP: {$cacheIP} ";
} else { } else {
@ -1416,7 +1418,7 @@ class updatedns
*/ */
function _debug($data) function _debug($data)
{ {
$string = date('m-d-y h:i:s').' - ('.$this->_debugID.') - ['.$this->_dnsService.'] - '.$data."\n"; $string = date('m-d-y h:i:s') . ' - (' . $this->_debugID . ') - [' . $this->_dnsService . '] - ' . $data . "\n";
$file = fopen($this->_debugFile, 'a'); $file = fopen($this->_debugFile, 'a');
fwrite($file, $string); fwrite($file, $string);
fclose($file); fclose($file);

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace OPNsense\Postfix; namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel; use OPNsense\Base\BaseModel;

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
Copyright (C) 2017 Fabian Franz Copyright (C) 2017 Fabian Franz

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
Copyright (C) 2017 Fabian Franz Copyright (C) 2017 Fabian Franz
All rights reserved. All rights reserved.