0f4e83a18999053f547adf7a2c9129717f71833e
bernd Bessere Darstellung des Dom...

bernd authored 14 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

9) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

10) 
11) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
12) */
bernd Bessere Darstellung des Dom...

bernd authored 14 years ago

13) 
14) require_once('inc/debug.php');
15) 
bernd Mailman-Domains nur auslese...

bernd authored 14 years ago

16) 
bernd Bessere Darstellung des Dom...

bernd authored 14 years ago

17) function mailman_subdomains($domain)
18) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

19)     if (!in_array('mailman', config('modules'))) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

20)         return [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

21)     }
22)     $domain = (int) $domain;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

23)     $result = db_query("SELECT id, hostname FROM mail.mailman_domains WHERE domain=?", [$domain]);
24)     $ret = [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

25)     while ($line = $result->fetch()) {
26)         $ret[] = $line;
27)     }
28)     return $ret;
bernd Bessere Darstellung des Dom...

bernd authored 14 years ago

29) }
30) 
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

31) function dns_in_use($domain)
32) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

33)     if (!in_array('dns', config('modules'))) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

34)         return false;
35)     }
36)     $domain = (int) $domain;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

37)     $result = db_query("SELECT id FROM dns.custom_records WHERE domain=?", [$domain]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

38)     return ($result->rowCount() > 0);
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

39) }
40) 
Bernd Wurst email setting per domain test

Bernd Wurst authored 1 year ago

41) function mail_setting($domain)
42) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

43)     if (!in_array('email', config('modules'))) {
Bernd Wurst email setting per domain test

Bernd Wurst authored 1 year ago

44)         return null;
45)     }
46)     $domain = (int) $domain;
47)     $result = db_query("SELECT mail FROM kundendaten.domains WHERE id=?", [$domain]);
48)     if ($result->rowCount() < 1) {
49)         system_failure("Domain not found");
50)     }
51)     $d = $result->fetch();
Bernd Wurst Erster Entwurf nomail-Feature

Bernd Wurst authored 11 months ago

52)     if ($d['mail'] == 'nomail') {
53)         return 'nomail';
54)     } // domain shall not be used for mail
Bernd Wurst email setting per domain test

Bernd Wurst authored 1 year ago

55)     if ($d['mail'] == 'none') {
56)         return 'none';
Bernd Wurst Erster Entwurf nomail-Feature

Bernd Wurst authored 11 months ago

57)     } // manually disabled (possibly used with another operator)
Bernd Wurst email setting per domain test

Bernd Wurst authored 1 year ago

58)     $result = db_query("SELECT id FROM mail.virtual_mail_domains WHERE domain=?", [$domain]);
59)     if ($result->rowCount() > 0) {
60)         return 'vmail';
61)     }
62)     return 'manual';
63) }
64) 
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

65) 
66) function mail_in_use($domain)
67) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

68)     if (!in_array('email', config('modules'))) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

69)         return false;
70)     }
71)     $domain = (int) $domain;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

72)     $result = db_query("SELECT mail FROM kundendaten.domains WHERE id=?", [$domain]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

73)     if ($result->rowCount() < 1) {
74)         system_failure("Domain not found");
75)     }
76)     $d = $result->fetch();
Bernd Wurst Erster Entwurf nomail-Feature

Bernd Wurst authored 11 months ago

77)     if ($d['mail'] == 'none' || $d['mail'] == 'nomail') {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

78)         return false;
79)     } // manually disabled
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

80)     $result = db_query("SELECT id FROM mail.virtual_mail_domains WHERE domain=?", [$domain]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

81)     if ($result->rowCount() < 1) {
82)         return true;
83)     } // .courier
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

84)     $result = db_query("SELECT acc.id FROM mail.vmail_accounts acc LEFT JOIN mail.virtual_mail_domains dom ON (acc.domain=dom.id) WHERE dom.domain=?", [$domain]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

85)     return ($result->rowCount() > 0);
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

86) }
87) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

88) function count_vmail($domain)
89) {
Bernd Wurst Zeige Mail-Deeplink korrekt...

Bernd Wurst authored 6 years ago

90)     $domain = (int) $domain;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

91)     $result = db_query("SELECT acc.id FROM mail.vmail_accounts acc LEFT JOIN mail.virtual_mail_domains dom ON (acc.domain=dom.id) WHERE dom.domain=?", [$domain]);
Bernd Wurst Zeige Mail-Deeplink korrekt...

Bernd Wurst authored 6 years ago

92)     return $result->rowCount();
93) }
94) 
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

95) function web_in_use($domain)
96) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

97)     if (!in_array('vhosts', config('modules'))) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

98)         return false;
99)     }
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

100) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

101)     $domain = (int) $domain;
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

102) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

103)     $result = db_query("SELECT id FROM kundendaten.domains WHERE id=? AND webserver=1", [$domain]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

104)     if ($result->rowCount() < 1) {
105)         return false;
106)     }
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

107) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

108)     $result = db_query("SELECT id FROM vhosts.vhost WHERE domain=?", [$domain]);
109)     $result2 = db_query("SELECT id FROM vhosts.alias WHERE domain=?", [$domain]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

110)     return ($result->rowCount() > 0 || $result2->rowCount() > 0);
bernd Wirkliche nutzung der Domai...

bernd authored 14 years ago

111) }
bernd Bessere Darstellung des Dom...

bernd authored 14 years ago

112) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

113) function domain_ownerchange($fqdn, $owner, $admin_c)
Bernd Wurst Domain-Update (Ownerchange)...

Bernd Wurst authored 6 years ago

114) {
115)     $cid = (int) $_SESSION['customerinfo']['customerno'];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

116)     $dom = new Domain($fqdn);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

117)     db_query("UPDATE kundendaten.domains SET owner=?, admin_c=? WHERE id=? AND kunde=?", [$owner, $admin_c, $dom->id, $cid]);
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

118)     if (update_possible($dom->id)) {
Bernd Wurst Domain-Transfer und -Regist...

Bernd Wurst authored 6 years ago

119)         require_once('domainapi.php');
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

120)         DEBUG("Rufe Domain-API auf!");
121)         api_upload_domain($dom->fqdn);
Bernd Wurst Domain-Transfer und -Regist...

Bernd Wurst authored 6 years ago

122)     }
Bernd Wurst Domain-Update (Ownerchange)...

Bernd Wurst authored 6 years ago

123) }
124) 
bernd Bessere Darstellung des Dom...

bernd authored 14 years ago

125) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

126) function update_possible($domain)
127) {
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

128)     $dom = new Domain((int) $domain);
Hanno Böck codingstyle, spaces between...

Hanno Böck authored 1 year ago

129)     if ($dom->provider != 'terions' || $dom->billing == 'external') {
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

130)         // Domain nicht über uns verwaltet
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

131)         DEBUG("Domain nicht über uns verwaltet!");
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

132)         return false;
133)     }
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

134)     $result = db_query("SELECT aenderung_eigentuemer, ruecksprache FROM misc.domainpreise WHERE tld=?", [$dom->tld]);
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

135)     if ($result->rowCount() < 1) {
136)         // Endung nicht bei uns in der Liste erfasst
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

137)         DEBUG("Endung nicht in der Preisliste!");
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

138)         return false;
139)     }
140)     $data = $result->fetch();
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

141)     if ($data['aenderung_eigentuemer'] != null || $data['ruecksprache'] == 'Y') {
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

142)         DEBUG("Endung hat Eigenheiten (ruecksprache=Y)");
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

143)         // Endung mit speziellen Eigenheiten
144)         return false;
145)     }
Bernd Wurst Zuverlässigeres Logging bei...

Bernd Wurst authored 6 years ago

146)     DEBUG("Änderungen sollten möglich sein: {$dom->fqdn}");
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

147)     return true;
148) }
149) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

150) function unset_mailserver_lock($dom)
151) {
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

152)     $id = $dom->id;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

153)     db_query("UPDATE kundendaten.domains SET secret=NULL, mailserver_lock=0 WHERE id=?", [$id]);
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

154) }
155) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

156) function create_domain_secret($dom)
157) {
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

158)     $id = $dom->id;
159)     $secret = md5(random_string(20));
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

160)     db_query("UPDATE kundendaten.domains SET secret=? WHERE id=?", [$secret, $id]);
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

161)     $dom->secret = $secret;
162)     return $secret;
163) }
164) 
Bernd Wurst Bestätige eine Domain ohne...

Bernd Wurst authored 6 years ago

165) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

166) function get_auth_dns($domainname, $tld)
167) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

168)     $domain = idn_to_ascii($domainname . "." . $tld, 0, INTL_IDNA_VARIANT_UTS46);
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

169) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

170)     $resp = shell_exec('dig @a.root-servers.net. +noall +authority -t ns ' . $tld . '.');
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

171)     $line = explode("\n", $resp, 2)[0];
172)     $NS = preg_replace("/^.*\\sIN\\s+NS\\s+(\\S+)$/", '\1', $line);
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

173) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

174)     $resp = shell_exec('dig @' . $NS . ' -t ns ' . $domain . '.');
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

175)     $lines = explode("\n", $resp);
Hanno remove whitespace in empty...

Hanno authored 6 years ago

176) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

177)     $NS = null;
178)     $NS_IP = null;
179)     $sec = null;
180)     foreach ($lines as $l) {
181)         if (preg_match("/;; AUTHORITY SECTION:.*/", $l)) {
182)             $sec = 'auth';
183)         } elseif (preg_match("/;; ADDITIONAL SECTION:.*/", $l)) {
184)             $sec = 'add';
185)         }
186)         if ($sec == 'auth' && preg_match("/^.*\\sIN\\s+NS\\s+\\S+$/", $l)) {
187)             $NS = preg_replace("/^.*\\sIN\\s+NS\\s+(\\S+)\\.$/", '\1', $l);
188)         }
189)         if ($sec == 'add' && $NS && preg_match("/^.*\\sIN\\s+A\\s+\\S+$/", $l)) {
190)             $NS_IP = preg_replace("/^.*\\sIN\\s+A\\s+(\\S+)$/", '\1', $l);
191)         }
192)     }
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

193)     return ["$NS" => $NS_IP];
Bernd Wurst Bestätige eine Domain ohne...

Bernd Wurst authored 6 years ago

194) }
195) 
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

196) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

197) function own_ns()
198) {
Bernd Wurst Zeige die Optionen zur Prüf...

Bernd Wurst authored 6 years ago

199)     $auth = dns_get_record(config('masterdomain'), DNS_NS);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

200)     $own_ns = [];
Bernd Wurst Zeige die Optionen zur Prüf...

Bernd Wurst authored 6 years ago

201)     foreach ($auth as $ns) {
202)         $own_ns[] = $ns['target'];
203)     }
204) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

205)     return $own_ns;
Bernd Wurst Zeige die Optionen zur Prüf...

Bernd Wurst authored 6 years ago

206) }
207) 
208) 
209) 
210) 
Bernd Wurst Bestätige eine Domain ohne...

Bernd Wurst authored 6 years ago

211) function has_own_ns($domainname, $tld)
212) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

213)     $nsdata = get_auth_dns($domainname, $tld);
214)     $NS = null;
215)     foreach ($nsdata as $host => $ip) {
Hanno Böck codingstyle, spaces between...

Hanno Böck authored 1 year ago

216)         $NS = $host;
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

217)     }
218)     if (in_array($NS, own_ns())) {
219)         DEBUG('Domain hat unsere DNS-Server!');
220)         return true;
221)     }
222)     return false;
Bernd Wurst Bestätige eine Domain ohne...

Bernd Wurst authored 6 years ago

223) }
224) 
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

225) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

226) function get_txt_record($hostname, $domainname, $tld)
227) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

228)     $domain = idn_to_ascii($domainname . "." . $tld, 0, INTL_IDNA_VARIANT_UTS46);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

229)     $nsdata = get_auth_dns($domainname, $tld);
230)     $NS = null;
231)     foreach ($nsdata as $host => $ip) {
232)         $NS = $host;
233)         if ($ip) {
234)             $NS = $ip;
235)         }
236)     }
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

237)     DEBUG('dig @' . $NS . ' +short -t txt ' . $hostname . '.' . $domain . '.');
238)     $resp = shell_exec('dig @' . $NS . ' +short -t txt ' . $hostname . '.' . $domain . '.');
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

239)     $TXT = trim($resp, "\n \"");
240)     DEBUG($TXT);
241)     return $TXT;
Bernd Wurst verify-Funktion um via DNS-...

Bernd Wurst authored 6 years ago

242) }
243) 
244) 
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

245) function list_useraccounts()
246) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

247)     $customerno = (int) $_SESSION['customerinfo']['customerno'];
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

248)     $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", [$customerno]);
249)     $ret = [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

250)     while ($item = $result->fetch()) {
251)         $ret[] = $item;
252)     }
253)     DEBUG($ret);
254)     return $ret;
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

255) }
256) 
257) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

258) function change_user($domain, $uid)
Bernd Wurst Änderung des betreffenden U...

Bernd Wurst authored 6 years ago

259) {
260)     $domain = new Domain($domain);
261)     $domain->ensure_customerdomain();
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

262)     $targetuser = null;
Bernd Wurst Änderung des betreffenden U...

Bernd Wurst authored 6 years ago

263)     $useraccounts = list_useraccounts();
264)     foreach ($useraccounts as $u) {
265)         if ($u['uid'] == $uid) {
266)             $targetuser = $u['uid'];
267)             break;
268)         }
269)     }
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

270)     if (!$targetuser) {
Bernd Wurst Änderung des betreffenden U...

Bernd Wurst authored 6 years ago

271)         system_failure("Ungültiger Useraccount!");
272)     }
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

273)     db_query("UPDATE kundendaten.domains SET useraccount=? WHERE id=?", [$targetuser, $domain->id]);
Bernd Wurst Änderung des betreffenden U...

Bernd Wurst authored 6 years ago

274) }
275) 
Bernd Wurst Wenn die E-Mail-Funktion ko...

Bernd Wurst authored 6 years ago

276) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

277) function get_domain_offer($tld)
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

278) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

279)     $tld = filter_input_hostname($tld);
280)     $cid = (int) $_SESSION['customerinfo']['customerno'];
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

281) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

282)     $data = ["tld" => $tld];
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

283) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

284)     $result = db_query("SELECT tld, gebuehr, `interval`, setup FROM misc.domainpreise_kunde WHERE kunde=:cid AND tld=:tld AND ruecksprache='N'", [":cid" => $cid, ":tld" => $tld]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

285)     if ($result->rowCount() != 1) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

286)         $result = db_query("SELECT tld, gebuehr, `interval`, setup FROM misc.domainpreise WHERE tld=:tld AND ruecksprache='N'", [":tld" => $tld]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

287)     }
288)     if ($result->rowCount() != 1) {
289)         return false;
290)     }
291)     $temp = $result->fetch();
292)     $data["gebuehr"] = $temp["gebuehr"];
293)     $data["interval"] = $temp["interval"];
294)     $data["setup"] = ($temp["setup"] ? $temp["setup"] : 0.0);
Hanno remove whitespace in empty...

Hanno authored 6 years ago

295) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

296)     return $data;
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

297) }
298) 
Bernd Wurst Erste Vorbereitungen für Do...

Bernd Wurst authored 6 years ago

299) function set_domain_pretransfer($domain)
300) {
301)     $cid = (int) $_SESSION['customerinfo']['customerno'];
302)     $uid = (int) $_SESSION['userinfo']['uid'];
303)     $domain = (int) $domain;
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

304)     db_query(
305)         "UPDATE kundendaten.domains SET status='pretransfer', dns=1 WHERE id=? AND kunde=?",
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

306)         [$domain, $cid]
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

307)     );
Bernd Wurst Erste Vorbereitungen für Do...

Bernd Wurst authored 6 years ago

308) }
309) 
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

310) 
Bernd Wurst Erste Vorbereitungen für Do...

Bernd Wurst authored 6 years ago

311) 
312) function set_domain_prereg($domain)
Bernd Wurst Wenn die E-Mail-Funktion ko...

Bernd Wurst authored 6 years ago

313) {
314)     $cid = (int) $_SESSION['customerinfo']['customerno'];
315)     $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Erste Vorbereitungen für Do...

Bernd Wurst authored 6 years ago

316)     $domain = (int) $domain;
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

317)     db_query(
318)         "UPDATE kundendaten.domains SET status='prereg', dns=1 WHERE id=? AND kunde=?",
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

319)         [$domain, $cid]
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

320)     );
Bernd Wurst Wenn die E-Mail-Funktion ko...

Bernd Wurst authored 6 years ago

321) }
322) 
323) 
324) function insert_domain_external($domain, $dns = false, $mail = true)
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

325) {
326)     $cid = (int) $_SESSION['customerinfo']['customerno'];
Bernd Wurst Zeige die Optionen zur Prüf...

Bernd Wurst authored 6 years ago

327)     $uid = (int) $_SESSION['userinfo']['uid'];
Bernd Wurst Lasse die API bestimmen was...

Bernd Wurst authored 6 years ago

328)     require_once("domainapi.php");
329)     $info = api_domain_available($domain);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

330)     if (in_array($info['status'], ['nameContainsForbiddenCharacter', 'suffixDoesNotExist'])) {
Bernd Wurst Lasse die API bestimmen was...

Bernd Wurst authored 6 years ago

331)         system_failure("Diese Domain scheint ungültig zu sein!");
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

332)     }
Bernd Wurst Lasse die API bestimmen was...

Bernd Wurst authored 6 years ago

333)     $tld = $info['domainSuffix'];
334)     $domainname = str_replace(".$tld", "", $info['domainNameUnicode']);
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

335)     logger(LOG_WARNING, 'modules/domains/include/domains', 'domains', 'Inserting external domain ' . $info['domainNameUnicode'] . " DNS:{$dns} / Mail:{$mail}");
Hanno remove whitespace in empty...

Hanno authored 6 years ago

336) 
Bernd Wurst Wenn die E-Mail-Funktion ko...

Bernd Wurst authored 6 years ago

337)     db_query("INSERT INTO kundendaten.domains (status, kunde, useraccount, domainname, tld, billing, provider, dns, mail, mailserver_lock) VALUES 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

338)         ('external', ?, ?, ?, ?, 'external', 'other', 0, ?, 1)", [$cid, $uid, $domainname, $tld, ($mail ? 'auto' : 'none')]);
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

339)     $id = db_insert_id();
340)     if ($dns) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

341)         db_query("UPDATE kundendaten.domains SET dns=1 WHERE id=?", [$id]);
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

342)     }
Bernd Wurst Wenn die E-Mail-Funktion ko...

Bernd Wurst authored 6 years ago

343)     if ($mail) {
344)         $vmailserver = (int) $_SESSION['userinfo']['server'];
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

345)         db_query("INSERT INTO mail.virtual_mail_domains (domain, server) VALUES (?, ?)", [$id, $vmailserver]);
Bernd Wurst Wenn die E-Mail-Funktion ko...

Bernd Wurst authored 6 years ago

346)     }
Bernd Wurst Ermögliche das Hinzufügen e...

Bernd Wurst authored 6 years ago

347)     return $id;
348) }
349) 
Bernd Wurst allow conversion of transfe...

Bernd Wurst authored 1 year ago

350) 
351) function convert_domain_to_external($domain)
352) {
Hanno Böck codingstyle

Hanno Böck authored 1 year ago

353)     db_query(
354)         "UPDATE kundendaten.domains SET status='external', billing='external', provider='other', kuendigungsdatum=NULL, registrierungsdatum=NULL, betrag=NULL WHERE id=? AND status='transferout' AND abgerechnet_bis >= kuendigungsdatum",
355)         [$domain,]
356)     );
Bernd Wurst allow conversion of transfe...

Bernd Wurst authored 1 year ago

357) }
358) 
Bernd Wurst Transfer-Freigabe und Kündi...

Bernd Wurst authored 6 years ago

359) function delete_domain($id)
360) {
361)     $cid = (int) $_SESSION['customerinfo']['customerno'];
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

362)     logger(LOG_WARNING, 'modules/domains/include/domains', 'domains', 'Deleting domain ' . $id);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

363)     db_query("DELETE FROM kundendaten.domains WHERE id=? AND kunde=?", [$id, $cid]);