ec5ed2ed870b5374ab2c05502621d0c161c3c2d8
Bernd Wurst Neues Modul zum Prüfen der...

Bernd Wurst authored 10 years ago

1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Neues Modul zum Prüfen der...

Bernd Wurst authored 10 years ago

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) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Neues Modul zum Prüfen der...

Bernd Wurst authored 10 years ago

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('inc/debug.php');
18) require_once('inc/base.php');
19) require_once('inc/security.php');
20) require_once('inc/error.php');
21) 
Bernd Wurst Neue Version der http.net-P...

Bernd Wurst authored 8 years ago

22) require_once('httpnet.php');
Bernd Wurst Neues Modul zum Prüfen der...

Bernd Wurst authored 10 years ago

23) 
Bernd Wurst Setze neu eingetragene Doma...

Bernd Wurst authored 9 years ago

24) require_once('modules/email/include/vmail.php');
25) 
Bernd Wurst Neues Modul zum Prüfen der...

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

27) function get_domain_offer($domainname)
Bernd Wurst Neues Modul zum Prüfen der...

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

29)     $domainname = filter_input_hostname($domainname);
30)     $domainname = preg_replace('/^www\./', '', $domainname);
31) 
32)     $basename = preg_replace('/([^\.]+)\..*$/', '\1', $domainname);
33)     DEBUG('Found Basename: '.$basename);
34)     $tld = preg_replace('/^[^\.]*\./', '', $domainname);
35)     DEBUG('Found TLD: '.$tld);
36) 
37)     $cid = (int) $_SESSION['customerinfo']['customerno'];
38) 
39)     $result = db_query("SELECT id FROM kundendaten.domains WHERE domainname=:domainname AND tld=:tld", array("domainname" => $basename, "tld" => $tld));
40)     if ($result->rowCount() != 0) {
41)         warning('Diese Domain ist in unserem System bereits vorhanden und kann daher nicht noch einmal eingetragen werden.');
42)         return;
43)     }
44) 
45)     $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
46) 
47)     $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));
48)     if ($result->rowCount() != 1) {
49)         $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld=:tld AND ruecksprache='N'", array(":tld" => $tld));
50)     }
51)     if ($result->rowCount() != 1) {
52)         warning('Die Endung »'.$tld.'« steht zur automatischen Eintragung nicht zur Verfügung.');
53)         return;
54)     }
55)     $temp = $result->fetch();
56)     $data["gebuehr"] = $temp["gebuehr"];
57)     $data["setup"] = ($temp["setup"] ? $temp["setup"] : 0.0);
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

59)     $available = api_domain_available($domainname);
60)     if (! $available) {
61)         warning('Die Domain »'.$domainname.'« ist leider nicht verfügbar.');
62)         return;
63)     }
64)     return $data;
Bernd Wurst Neues Modul zum Prüfen der...

Bernd Wurst authored 10 years ago

65) }
66) 
67) 
68) 
69) function register_domain($domainname, $uid)
70) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

71)     $data = get_domain_offer($domainname);
72) 
73)     if (! $data) {
74)         // Die Include-Datei setzt eine passende Warning-Nachricht
75)         show_warnings();
76)         system_failure('Interner Fehler');
77)     }
78) 
79)     $cid = (int) $_SESSION['customerinfo']['customerno'];
80)     $useraccount = null;
81)     $available_users = list_useraccounts();
82)     foreach ($available_users as $u) {
83)         if ($uid == $u['uid']) {
84)             $useraccount = (int) $uid;
85)             break;
86)         }
87)     }
88)     if (! $useraccount) {
89)         system_failure('Kein User gesetzt');
90)     }
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

92)     $args = array(":cid" => $cid,
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

93)                 ":useraccount" => $useraccount,
94)                 ":basename" => $data['basename'],
Bernd Wurst Beim Hinzufügen einer Domai...

Bernd Wurst authored 6 years ago

95)                 ":tld" => $data['tld']);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

96)     db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail) VALUES ".
Bernd Wurst Beim Hinzufügen einer Domai...

Bernd Wurst authored 6 years ago

97)            "(:cid, :useraccount, :basename, :tld, 'regular', NULL, 1, 1, 'auto') ", $args);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

98)     $domid = db_insert_id();
99)     /*if ($data['setup']) {
100)       $args = array(":cid" => $cid, ":setup" => $data['setup'], ":text" => 'Einmalige Setup-Gebühren für Domain "'.$data['domainname'].'"');
101)       db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES (:cid, 0, CURDATE(), :setup, 1, :text, 1)", $args);
102)     }*/
103)     # Umstellen auf vmail
104)     change_domain($domid, 'virtual');
Bernd Wurst Neues Modul zum Prüfen der...

Bernd Wurst authored 10 years ago

105) }
106) 
107) function list_useraccounts()
108) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

109)     $customerno = (int) $_SESSION['customerinfo']['customerno'];
110)     $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", array($customerno));
111)     $ret = array();
112)     while ($item = $result->fetch()) {
113)         $ret[] = $item;
114)     }
115)     DEBUG($ret);
116)     return $ret;