@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $str = htmlspecialchars(trim($str), ENT_QUOTES, 'UTF-8'); |
23 | 23 | |
24 | - if($checkEmpty && empty($str)) |
|
24 | + if ($checkEmpty && empty($str)) |
|
25 | 25 | exit('something went wrong 7'); |
26 | 26 | |
27 | 27 | return $str; |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | protected $iniFileInwx = "inwx.ini"; |
34 | 34 | protected $iniFileDomain = ""; |
35 | 35 | |
36 | - protected $inwx = []; // {apiurl, username, password} |
|
37 | - protected $domain = []; // [inwx] => {domain, subdomain}, [ddns] => {apikey} |
|
38 | - protected $IP4 = []; // {oldip, newip, id} |
|
39 | - protected $IP6 = []; // {oldip, newip, id} |
|
36 | + protected $inwx = []; // {apiurl, username, password} |
|
37 | + protected $domain = []; // [inwx] => {domain, subdomain}, [ddns] => {apikey} |
|
38 | + protected $IP4 = []; // {oldip, newip, id} |
|
39 | + protected $IP6 = []; // {oldip, newip, id} |
|
40 | 40 | |
41 | 41 | protected $domrobot; |
42 | 42 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | protected function readIni() |
61 | 61 | { |
62 | 62 | // check if ini files exists |
63 | - if(!file_exists($this->iniFilePath . $this->iniFileDomain)) |
|
63 | + if (!file_exists($this->iniFilePath . $this->iniFileDomain)) |
|
64 | 64 | exit('something went wrong 8'); |
65 | - if(!file_exists($this->iniFilePath . $this->iniFileInwx)) |
|
65 | + if (!file_exists($this->iniFilePath . $this->iniFileInwx)) |
|
66 | 66 | exit('something went wrong 1'); |
67 | 67 | |
68 | 68 | // read domain.ini |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | //read inwx.ini |
77 | 77 | $ini = parse_ini_file($this->iniFilePath . $this->iniFileInwx, TRUE); |
78 | 78 | |
79 | - $this->inwx['apiurl'] = precheck($ini['apiurl'], true); |
|
80 | - $this->inwx['username'] = precheck($ini['username'], true); |
|
81 | - $this->inwx['password'] = precheck($ini['password'], true); |
|
79 | + $this->inwx['apiurl'] = precheck($ini['apiurl'], true); |
|
80 | + $this->inwx['username'] = precheck($ini['username'], true); |
|
81 | + $this->inwx['password'] = precheck($ini['password'], true); |
|
82 | 82 | |
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | 86 | protected function checkAccess($apikey = null) |
87 | 87 | { |
88 | - if($apikey == null || $this->domain['ddns']['apikey'] !== $apikey) |
|
88 | + if ($apikey == null || $this->domain['ddns']['apikey'] !== $apikey) |
|
89 | 89 | exit('something went wrong 3'); |
90 | 90 | |
91 | 91 | return; |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | // INWX Login |
102 | 102 | $result = $this->domrobot->login($this->inwx['username'], $this->inwx['password']); |
103 | 103 | |
104 | - if(DEBUG) |
|
104 | + if (DEBUG) |
|
105 | 105 | print_r($result); |
106 | 106 | |
107 | 107 | // check result |
108 | 108 | if ($result['code'] != 1000) |
109 | 109 | { |
110 | - if(OUTPUT) |
|
110 | + if (OUTPUT) |
|
111 | 111 | exit('badauth'); |
112 | 112 | |
113 | 113 | exit('something went wrong 4'); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | $result = $this->domrobot->logout(); |
122 | 122 | |
123 | - if(DEBUG) |
|
123 | + if (DEBUG) |
|
124 | 124 | print_r($result); |
125 | 125 | |
126 | 126 | // check result |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | $result = $this->domrobot->call($object, $methode, $params); |
145 | 145 | |
146 | - if(DEBUG) |
|
146 | + if (DEBUG) |
|
147 | 147 | print_r($result); |
148 | 148 | |
149 | 149 | // check result |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | exit('something went wrong 6'); |
153 | 153 | } |
154 | 154 | |
155 | - foreach($result["resData"]["record"] as $value) |
|
155 | + foreach ($result["resData"]["record"] as $value) |
|
156 | 156 | { |
157 | - if($value['type'] == "A") |
|
157 | + if ($value['type'] == "A") |
|
158 | 158 | { |
159 | 159 | $this->IP4['id'] = $value['id']; |
160 | 160 | $this->IP4['oldip'] = $value['content']; |
161 | 161 | } |
162 | - if($value['type'] == "AAAA") |
|
162 | + if ($value['type'] == "AAAA") |
|
163 | 163 | { |
164 | 164 | $this->IP6['id'] = $value['id']; |
165 | 165 | $this->IP6['oldip'] = $value['content']; |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | |
177 | 177 | $params = array(); |
178 | 178 | |
179 | - if($type == 'ipv4') |
|
179 | + if ($type == 'ipv4') |
|
180 | 180 | { |
181 | 181 | $params['id'] = $this->IP4['id']; |
182 | 182 | $params['content'] = $this->IP4['newip']; |
183 | 183 | } |
184 | - elseif($type == 'ipv6') |
|
184 | + elseif ($type == 'ipv6') |
|
185 | 185 | { |
186 | 186 | $params['id'] = $this->IP6['id']; |
187 | 187 | $params['content'] = $this->IP6['newip']; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $result = $this->domrobot->call($object, $methode, $params); |
193 | 193 | |
194 | - if(DEBUG) |
|
194 | + if (DEBUG) |
|
195 | 195 | print_r($result); |
196 | 196 | |
197 | 197 | // check result |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | exit('something went wrong 10'); |
201 | 201 | } |
202 | 202 | |
203 | - if(OUTPUT) |
|
203 | + if (OUTPUT) |
|
204 | 204 | echo('good'); |
205 | 205 | |
206 | 206 | return; |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | |
213 | 213 | $this->inwxGetNameserverInfo(); |
214 | 214 | |
215 | - if(filter_var($ipv4, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) |
|
215 | + if (filter_var($ipv4, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) |
|
216 | 216 | { |
217 | 217 | $this->IP4['newip'] = $ipv4; |
218 | 218 | $this->inwxSetNameserverInfo('ipv4'); |
219 | 219 | } |
220 | 220 | |
221 | - if(filter_var($ipv6, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
221 | + if (filter_var($ipv6, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
222 | 222 | { |
223 | 223 | $this->IP6['newip'] = $ipv6; |
224 | 224 | $this->inwxSetNameserverInfo('ipv6'); |
@@ -15,10 +15,10 @@ |
||
15 | 15 | protected $iniFilePath = "./conf/"; |
16 | 16 | protected $iniFileInwx = "inwx.ini"; |
17 | 17 | protected $iniFileDomain = ""; |
18 | - protected $inwx = []; // {apiurl, username, password} |
|
19 | - protected $domain = []; // [inwx] => {domain, subdomain}, [ddns] => {apikey} |
|
20 | - protected $IP4 = []; // {oldip, newip, id} |
|
21 | - protected $IP6 = []; // {oldip, newip, id} |
|
18 | + protected $inwx = []; // {apiurl, username, password} |
|
19 | + protected $domain = []; // [inwx] => {domain, subdomain}, [ddns] => {apikey} |
|
20 | + protected $IP4 = []; // {oldip, newip, id} |
|
21 | + protected $IP6 = []; // {oldip, newip, id} |
|
22 | 22 | protected $domrobot; |
23 | 23 | |
24 | 24 | public function __construct($apidomain = null, $apikey = null) { |