Bernd Wurst commited on 2018-02-20 11:35:38
Zeige 6 geänderte Dateien mit 161 Einfügungen und 30 Löschungen.
... | ... |
@@ -48,7 +48,7 @@ if (isset($_REQUEST['domain'])) { |
48 | 48 |
redirect(''); |
49 | 49 |
} |
50 | 50 |
$avail = api_domain_available($_REQUEST['domain']); |
51 |
- if ($avail == 'available') { |
|
51 |
+ if ($avail['status'] == 'available') { |
|
52 | 52 |
output('<p class="domain-available">Die Domain '.filter_input_general($_REQUEST['domain']).' ist verfügbar!</p>'); |
53 | 53 |
# Neue Domain eintragen |
54 | 54 |
$data = get_domain_offer($_REQUEST['domain']); |
... | ... |
@@ -58,8 +58,10 @@ if (isset($_REQUEST['domain'])) { |
58 | 58 |
$form = '<p>Folgende Konditionen gelten bei Registrierung der Domain im nächsten Schritt:</p> |
59 | 59 |
<table> |
60 | 60 |
<tr><td>Domainname:</td><td><strong>'.$data['domainname'].'</strong></td></tr> |
61 |
- <tr><td>Jahresgebühr:</td><td style="text-align: right;">'.$data['gebuehr'].' €</td></tr> |
|
62 |
- <tr><td>Setup-Gebühr (einmalig):</td><td style="text-align: right;">'.$data['setup'].' €</td></tr>'; |
|
61 |
+ <tr><td>Jahresgebühr:</td><td style="text-align: right;">'.$data['gebuehr'].' €</td></tr>'; |
|
62 |
+ if ($data['setup']) { |
|
63 |
+ $form .= '<tr><td>Setup-Gebühr (einmalig):</td><td style="text-align: right;">'.$data['setup'].' €</td></tr>'; |
|
64 |
+ } |
|
63 | 65 |
$form .='</table>'; |
64 | 66 |
|
65 | 67 |
|
... | ... |
@@ -67,10 +69,13 @@ if (isset($_REQUEST['domain'])) { |
67 | 69 |
<input type="submit" name="submit" value="Ich möchte diese Domain registrieren"></p>'; |
68 | 70 |
output(html_form('domains_register', 'domainreg', '', $form)); |
69 | 71 |
output('<p>'.internal_link('domains', 'Zurück').'</p>'); |
70 |
- } elseif ($avail == 'registered' || $avail == 'alreadyRegistered') { |
|
72 |
+ } elseif ($avail['status'] == 'registered' || $avail['status'] == 'alreadyRegistered') { |
|
71 | 73 |
output('<p class="domain-unavailable">Die Domain '.filter_input_general($_REQUEST['domain']).' ist bereits vergeben.</p>'); |
72 | 74 |
|
73 | 75 |
output('<h3>Domain zu '.config('company_name').' umziehen</h3>'); |
76 |
+ if ($avail['status'] == 'registered' && $avail['transferMethod'] != 'authInfo') { |
|
77 |
+ output('<p>Diese Domainendung kann nicht automatisiert übertragen werden. Bitte wenden Sie sich an den Support.</p>'); |
|
78 |
+ } else { |
|
74 | 79 |
$data = get_domain_offer($_REQUEST['domain']); |
75 | 80 |
|
76 | 81 |
if (! $data) { |
... | ... |
@@ -81,8 +86,10 @@ if (isset($_REQUEST['domain'])) { |
81 | 86 |
$form = '<p>Folgende Konditionen gelten beim Transfer der Domain im nächsten Schritt:</p> |
82 | 87 |
<table> |
83 | 88 |
<tr><td>Domainname:</td><td><strong>'.$data['domainname'].'</strong></td></tr> |
84 |
- <tr><td>Jahresgebühr:</td><td style="text-align: right;">'.$data['gebuehr'].' €</td></tr> |
|
85 |
- <tr><td>Setup-Gebühr (einmalig):</td><td style="text-align: right;">'.$data['setup'].' €</td></tr>'; |
|
89 |
+ <tr><td>Jahresgebühr:</td><td style="text-align: right;">'.$data['gebuehr'].' €</td></tr>'; |
|
90 |
+ if ($data['setup']) { |
|
91 |
+ $form .= '<tr><td>Setup-Gebühr (einmalig):</td><td style="text-align: right;">'.$data['setup'].' €</td></tr>'; |
|
92 |
+ } |
|
86 | 93 |
$form .='</table>'; |
87 | 94 |
|
88 | 95 |
|
... | ... |
@@ -92,6 +99,7 @@ if (isset($_REQUEST['domain'])) { |
92 | 99 |
output(html_form('domains_transferin', 'domainreg', '', $form)); |
93 | 100 |
|
94 | 101 |
} |
102 |
+ } |
|
95 | 103 |
output('<h3>Diese Domain als externe Domain nutzen</h3>'); |
96 | 104 |
output('<p>Sie können diese Domain für Konfigurationen bei uns nutzen ohne einen Transfer vorzunehmen.</p> |
97 | 105 |
<p><strong>Beachten Sie:</strong> Um diese Domain nutzen zu können, benötigen Sie bei Ihrem bisherigen Domainregistrar die Möglichkeit, DNS-Records anzulegen oder die zuständigen DNS-Server zu ändern. Sie können dann entweder unsere DNS-Server nutzen oder einzelne DNS-Records auf unsere Server einrichten.</p>'); |
... | ... |
@@ -121,7 +129,7 @@ if (isset($_REQUEST['domain'])) { |
121 | 129 |
} else { |
122 | 130 |
output('<p class="domain-unavailable">Die Domain '.filter_input_general($_REQUEST['domain']).' kann nicht registriert werden.</p>'); |
123 | 131 |
|
124 |
- switch ($avail) { |
|
132 |
+ switch ($avail['status']) { |
|
125 | 133 |
case 'nameContainsForbiddenCharacter': |
126 | 134 |
output('<p>Der Domainname enthält unerlaubte Zeichen.</p>'); |
127 | 135 |
break; |
... | ... |
@@ -45,8 +45,8 @@ if (isset($_REQUEST['domain'])) { |
45 | 45 |
// An diesem Punkt ist die Domain eingetragen als extern und ggf. mit Mailserver-Lock |
46 | 46 |
// Bei der Reg-Bestätigung wird das Lock entfernt und die Daten entsprechend gesetzt, inklusive Preise. |
47 | 47 |
|
48 |
- $_SESSION['domains_domainreg_owner'] = NULL; |
|
49 |
- $_SESSION['domains_domainreg_admin_c'] = NULL; |
|
48 |
+ $_SESSION['domains_domainreg_owner'] = $dom->owner; |
|
49 |
+ $_SESSION['domains_domainreg_admin_c'] = $dom->admin_c; |
|
50 | 50 |
$_SESSION['domains_domainreg_domainname'] = $domain; |
51 | 51 |
$_SESSION['domains_domainreg_detach'] = 0; |
52 | 52 |
|
... | ... |
@@ -60,14 +60,18 @@ if (!$dom) { |
60 | 60 |
system_failure("Keine Domain"); |
61 | 61 |
} |
62 | 62 |
|
63 |
+$pricedata = get_domain_offer($dom->fqdn); |
|
64 |
+if (!$pricedata) { |
|
65 |
+ redirect('adddomain'); |
|
66 |
+} |
|
63 | 67 |
$mode=NULL; |
64 | 68 |
|
65 | 69 |
$avail = api_domain_available($dom->fqdn); |
66 |
-if ($avail == 'available') { |
|
70 |
+if ($avail['status'] == 'available') { |
|
67 | 71 |
set_domain_prereg($dom->id); |
68 | 72 |
$mode = 'reg'; |
69 | 73 |
title("Domain registrieren"); |
70 |
-} elseif ($avail == 'registered' || $avail == 'alreadyRegistered') { |
|
74 |
+} elseif ($avail['status'] == 'registered' || $avail['status'] == 'alreadyRegistered') { |
|
71 | 75 |
// FIXME: alreadyRegistered bedeutet, dass die Domain bereits über uns verwaltet wird. Das wird dann hier nicht funktionieren |
72 | 76 |
set_domain_pretransfer($dom->id); |
73 | 77 |
$mode = 'transfer'; |
... | ... |
@@ -115,6 +119,29 @@ if ($_SESSION['domains_domainreg_admin_c'] != $_SESSION['domains_domainreg_owner |
115 | 119 |
} |
116 | 120 |
|
117 | 121 |
|
122 |
+$form = ''; |
|
123 |
+if ($mode == 'transfer') { |
|
124 |
+ $form .= '<h4>Auth-Info-Code für den Transfer</h4>'; |
|
125 |
+ $form .= '<p><label for="authinfo">Auth-Info-Code für den Domainumzug:</label> <input type="text" name="authinfo" id="authinfo"></p>'; |
|
126 |
+ |
|
127 |
+} |
|
128 |
+ |
|
129 |
+$form .= '<h4>Kosten</h4>'; |
|
130 |
+ |
|
131 |
+$form .= '<p>Für die Verwaltung der Domain fallen folgende Kosten an:</p> |
|
132 |
+<table> |
|
133 |
+<tr><td>Domainname:</td><td><strong>'.$dom->fqdn.'</strong></td></tr> |
|
134 |
+<tr><td>Jahresgebühr:</td><td style="text-align: right;">'.$pricedata['gebuehr'].' €</td></tr>'; |
|
135 |
+if ($pricedata['setup']) { |
|
136 |
+ $form .= '<tr><td>Setup-Gebühr (einmalig):</td><td style="text-align: right;">'.$pricedata['setup'].' €</td></tr>'; |
|
137 |
+} |
|
138 |
+$form .='</table>'; |
|
139 |
+$form .= '<p>Der Domain-Vertrag beginnt mit Zuteilung der Domain durch die Regisrierungsstelle und läuft jeweils ein Jahr. Er verlängert sich stets automatisch um ein weiteres Jahr, wenn nicht bis 14 Tage vor Ende der Laufzeit eine Kündigung vorliegt.</p>'; |
|
140 |
+ |
|
141 |
+$form .= '<p><input type="hidden" name="domain" value="'.filter_input_general($dom->fqdn).'"> |
|
142 |
+<input type="submit" name="submit" value="Kostenpflichtigen Vertrag abschließen"></p>'; |
|
143 |
+output(html_form('domains_domainreg', 'domainreg_save', '', $form)); |
|
144 |
+output('<p>'.internal_link('domains', 'Zurück').'</p>'); |
|
118 | 145 |
|
119 | 146 |
|
120 | 147 |
|
... | ... |
@@ -0,0 +1,52 @@ |
1 |
+<?php |
|
2 |
+/* |
|
3 |
+This file belongs to the Webinterface of schokokeks.org Hosting |
|
4 |
+ |
|
5 |
+Written 2008-2018 by schokokeks.org Hosting, namely |
|
6 |
+ Bernd Wurst <bernd@schokokeks.org> |
|
7 |
+ Hanno Böck <hanno@schokokeks.org> |
|
8 |
+ |
|
9 |
+To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. |
|
10 |
+ |
|
11 |
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see |
|
12 |
+http://creativecommons.org/publicdomain/zero/1.0/ |
|
13 |
+ |
|
14 |
+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. |
|
15 |
+*/ |
|
16 |
+ |
|
17 |
+require_once("class/domain.php"); |
|
18 |
+require_once("domains.php"); |
|
19 |
+require_once("domainapi.php"); |
|
20 |
+require_role(ROLE_CUSTOMER); |
|
21 |
+check_form_token('domains_domainreg'); |
|
22 |
+ |
|
23 |
+if (! (isset($_SESSION['domains_domainreg_owner']) && $_SESSION['domains_domainreg_owner']) || |
|
24 |
+ ! (isset($_SESSION['domains_domainreg_admin_c']) && $_SESSION['domains_domainreg_admin_c']) || |
|
25 |
+ ! (isset($_SESSION['domains_domainreg_domainname']) && $_SESSION['domains_domainreg_domainname'])) { |
|
26 |
+ system_failure("Fehler im Programmablauf!"); |
|
27 |
+} |
|
28 |
+ |
|
29 |
+if (! (isset($_REQUEST['domain']) && $_REQUEST['domain']) || |
|
30 |
+ $_REQUEST['domain'] != $_SESSION['domains_domainreg_domainname']) { |
|
31 |
+ system_failure("Fehler im Programmablauf!"); |
|
32 |
+} |
|
33 |
+ |
|
34 |
+$dom = new Domain((string) $_REQUEST['domain']); |
|
35 |
+$dom->ensure_userdomain(); |
|
36 |
+ |
|
37 |
+// Speichere Kontakte |
|
38 |
+domain_ownerchange($dom->fqdn, $_SESSION['domains_domainreg_owner'], $_SESSION['domains_domainreg_admin_c']); |
|
39 |
+ |
|
40 |
+$authinfo = NULL; |
|
41 |
+if ($dom->status == 'pretransfer') { |
|
42 |
+ if (! (isset($_REQUEST['authinfo']) && $_REQUEST['authinfo'])) { |
|
43 |
+ system_failure("Kein Auth-Info-Code angegeben!"); |
|
44 |
+ } |
|
45 |
+ $authinfo = chop($_REQUEST['authinfo']); |
|
46 |
+} |
|
47 |
+ |
|
48 |
+api_register_domain($dom->fqdn, $authinfo); |
|
49 |
+ |
|
50 |
+success_msg('Die Registrierung wurde in Auftrag gegeben. Der Domain-Status sollte sich in den nächsten Minuten entsprechend ändern.'); |
|
51 |
+redirect('domains'); |
|
52 |
+ |
... | ... |
@@ -46,6 +46,12 @@ foreach ($user_domains as $domain) |
46 | 46 |
if ($domain->status == 'prereg') { |
47 | 47 |
$status = 'prereg'; |
48 | 48 |
$regdate = '<em>Registrierung nicht abgeschlossen</em>'; |
49 |
+ } elseif ($domain->status == 'transferfailed') { |
|
50 |
+ $status = 'pretransfer'; |
|
51 |
+ $regdate = '<em>Umzug gescheitert</em>'; |
|
52 |
+ } elseif ($domain->status == 'pretransfer') { |
|
53 |
+ $status = 'pretransfer'; |
|
54 |
+ $regdate = '<em>Umzug bevorstehend</em>'; |
|
49 | 55 |
} elseif ($domain->provider != 'terions') { |
50 | 56 |
$status = 'external'; |
51 | 57 |
$regdate = '<em>Extern registriert</em>'; |
... | ... |
@@ -55,6 +57,7 @@ function api_download_domain($id) { |
55 | 57 |
if ($owner != $dom['owner'] || $admin_c != $dom['admin_c']) { |
56 | 58 |
db_query("UPDATE kundendaten.domains SET owner=?, admin_c=? WHERE id=?", array($owner, $admin_c, $id)); |
57 | 59 |
} |
60 |
+ return $apidomain; |
|
58 | 61 |
} |
59 | 62 |
|
60 | 63 |
|
... | ... |
@@ -98,22 +101,64 @@ function api_upload_domain($fqdn) |
98 | 101 |
} |
99 | 102 |
|
100 | 103 |
|
104 |
+function api_register_domain($domainname, $authinfo=NULL) |
|
105 |
+{ |
|
106 |
+ $result = db_query("SELECT id,CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld)=?", array($domainname)); |
|
107 |
+ if ($result->rowCount() < 1) { |
|
108 |
+ system_failure("Unbekannte Domain"); |
|
109 |
+ } |
|
110 |
+ $dom = $result->fetch(); |
|
111 |
+ $owner = get_contact($dom['owner']); |
|
112 |
+ if (! $owner['nic_id']) { |
|
113 |
+ upload_contact($owner); |
|
114 |
+ $owner = get_contact($dom['owner']); |
|
115 |
+ } |
|
116 |
+ $admin_c = get_contact($dom['admin_c']); |
|
117 |
+ if (! $admin_c['nic_id']) { |
|
118 |
+ upload_contact($admin_c); |
|
119 |
+ $admin_c = get_contact($dom['admin_c']); |
|
120 |
+ } |
|
121 |
+ $owner = $owner['nic_id']; |
|
122 |
+ $admin_c = $admin_c['nic_id']; |
|
123 |
+ |
|
124 |
+ // Frage die Masterdomain ab, von dort übernehmen wir Nameserver und zone/tech handles |
|
125 |
+ $data = array("domainName" => config('masterdomain')); |
|
126 |
+ $result = api_request('domainInfo', $data); |
|
127 |
+ if ($result['status'] != 'success') { |
|
128 |
+ system_failure("Abfrage nicht erfolgreich!"); |
|
129 |
+ } |
|
130 |
+ $masterdomain = $result['response']; |
|
131 |
+ $newdomain = array(); |
|
132 |
+ $newdomain['name'] = $domainname; |
|
133 |
+ $newdomain['transferLockEnabled'] = true; |
|
134 |
+ $newdomain['nameservers'] = $masterdomain['nameservers']; |
|
135 |
+ $newdomain['contacts'] = $masterdomain['contacts']; |
|
136 |
+ |
|
137 |
+ foreach ($masterdomain['contacts'] as $key => $ac) { |
|
138 |
+ if ($ac['type'] == 'owner') { |
|
139 |
+ $newdomain['contacts'][$key]['contact'] = $owner; |
|
140 |
+ } |
|
141 |
+ if ($ac['type'] == 'admin') { |
|
142 |
+ $newdomain['contacts'][$key]['contact'] = $admin_c; |
|
143 |
+ } |
|
144 |
+ } |
|
145 |
+ $result = NULL; |
|
146 |
+ if ($dom['status'] == 'prereg') { |
|
147 |
+ $args = array("domain" => $newdomain); |
|
148 |
+ $result = api_request('domainCreate', $args); |
|
149 |
+ } else { |
|
150 |
+ $args = array("domain" => $newdomain, "transferData" => array("authInfo" => $authinfo)); |
|
151 |
+ $result = api_request('domainTransfer', $args); |
|
152 |
+ } |
|
153 |
+ |
|
154 |
+} |
|
155 |
+ |
|
101 | 156 |
function api_domain_available($domainname) |
102 | 157 |
{ |
103 | 158 |
$args = array("domainNames" => array($domainname)); |
104 | 159 |
$result = api_request('domainStatus', $args); |
105 | 160 |
$resp = $result["responses"][0]; |
106 |
- return $resp["status"]; |
|
107 |
- /* |
|
108 |
- alreadyRegistered You (or a sub account) already registered the domain |
|
109 |
- registered Somebody else registered domain |
|
110 |
- nameContainsForbiddenCharacter Domain name contains invalid characters |
|
111 |
- available Domain is available for registration |
|
112 |
- suffixDoesNotExist Domain suffix does not exist |
|
113 |
- suffixCannotBeRegistered You are not allowed to register a domain with this suffix |
|
114 |
- canNotCheck System is currently unable to check availability |
|
115 |
- unknown Other problems or difficulties occured |
|
116 |
- */ |
|
161 |
+ return $resp; |
|
117 | 162 |
} |
118 | 163 |
|
119 | 164 |
|
... | ... |
@@ -81,11 +81,13 @@ function web_in_use($domain) |
81 | 81 |
|
82 | 82 |
function domain_ownerchange($fqdn, $owner, $admin_c) |
83 | 83 |
{ |
84 |
- require_once('domainapi.php'); |
|
85 | 84 |
$cid = (int) $_SESSION['customerinfo']['customerno']; |
86 | 85 |
db_query("UPDATE kundendaten.domains SET owner=?, admin_c=? WHERE CONCAT_WS('.', domainname, tld)=? AND kunde=?", array($owner, $admin_c, $fqdn, $cid)); |
86 |
+ if (update_possible($fqdn)) { |
|
87 |
+ require_once('domainapi.php'); |
|
87 | 88 |
api_upload_domain($fqdn); |
88 | 89 |
} |
90 |
+} |
|
89 | 91 |
|
90 | 92 |
|
91 | 93 |
function update_possible($domain) { |
... | ... |
@@ -240,15 +242,8 @@ function get_domain_offer($domainname) |
240 | 242 |
DEBUG('Found Basename: '.$basename); |
241 | 243 |
$tld = preg_replace('/^[^\.]*\./', '', $domainname); |
242 | 244 |
DEBUG('Found TLD: '.$tld); |
243 |
- |
|
244 | 245 |
$cid = (int) $_SESSION['customerinfo']['customerno']; |
245 | 246 |
|
246 |
- $result = db_query("SELECT id FROM kundendaten.domains WHERE domainname=:domainname AND tld=:tld", array("domainname" => $basename, "tld" => $tld)); |
|
247 |
- if ($result->rowCount() != 0) { |
|
248 |
- warning('Diese Domain ist in unserem System bereits vorhanden und kann daher nicht noch einmal eingetragen werden.'); |
|
249 |
- return; |
|
250 |
- } |
|
251 |
- |
|
252 | 247 |
$data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld); |
253 | 248 |
|
254 | 249 |
$result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise_kunde WHERE kunde=:cid AND tld=:tld AND ruecksprache='N'", array(":cid" => $cid, ":tld" => $tld)); |
255 | 250 |