Browse code

Codingstyle PSR12 + array syntax

Hanno Böck authored on 30/10/2021 21:18:17
Showing 1 changed files
... ...
@@ -36,17 +36,17 @@ function get_domain_offer($domainname)
36 36
 
37 37
     $cid = (int) $_SESSION['customerinfo']['customerno'];
38 38
 
39
-    $result = db_query("SELECT id FROM kundendaten.domains WHERE domainname=:domainname AND tld=:tld", array("domainname" => $basename, "tld" => $tld));
39
+    $result = db_query("SELECT id FROM kundendaten.domains WHERE domainname=:domainname AND tld=:tld", ["domainname" => $basename, "tld" => $tld]);
40 40
     if ($result->rowCount() != 0) {
41 41
         warning('Diese Domain ist in unserem System bereits vorhanden und kann daher nicht noch einmal eingetragen werden.');
42 42
         return;
43 43
     }
44 44
 
45
-    $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
45
+    $data = ["domainname" => $domainname, "basename" => $basename, "tld" => $tld];
46 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));
47
+    $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise_kunde WHERE kunde=:cid AND tld=:tld AND ruecksprache='N'", [":cid" => $cid, ":tld" => $tld]);
48 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));
49
+        $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld=:tld AND ruecksprache='N'", [":tld" => $tld]);
50 50
     }
51 51
     if ($result->rowCount() != 1) {
52 52
         warning('Die Endung »'.$tld.'« steht zur automatischen Eintragung nicht zur Verfügung.');
... ...
@@ -89,10 +89,10 @@ function register_domain($domainname, $uid)
89 89
         system_failure('Kein User gesetzt');
90 90
     }
91 91
 
92
-    $args = array(":cid" => $cid,
92
+    $args = [":cid" => $cid,
93 93
                 ":useraccount" => $useraccount,
94 94
                 ":basename" => $data['basename'],
95
-                ":tld" => $data['tld']);
95
+                ":tld" => $data['tld'], ];
96 96
     db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail) VALUES ".
97 97
            "(:cid, :useraccount, :basename, :tld, 'regular', NULL, 1, 1, 'auto') ", $args);
98 98
     $domid = db_insert_id();
... ...
@@ -107,8 +107,8 @@ function register_domain($domainname, $uid)
107 107
 function list_useraccounts()
108 108
 {
109 109
     $customerno = (int) $_SESSION['customerinfo']['customerno'];
110
-    $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", array($customerno));
111
-    $ret = array();
110
+    $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", [$customerno]);
111
+    $ret = [];
112 112
     while ($item = $result->fetch()) {
113 113
         $ret[] = $item;
114 114
     }
Browse code

remove whitespace in empty lines

Hanno authored on 26/06/2018 23:36:40
Showing 1 changed files
... ...
@@ -55,7 +55,7 @@ function get_domain_offer($domainname)
55 55
     $temp = $result->fetch();
56 56
     $data["gebuehr"] = $temp["gebuehr"];
57 57
     $data["setup"] = ($temp["setup"] ? $temp["setup"] : 0.0);
58
-  
58
+
59 59
     $available = api_domain_available($domainname);
60 60
     if (! $available) {
61 61
         warning('Die Domain »'.$domainname.'« ist leider nicht verfügbar.');
... ...
@@ -88,7 +88,7 @@ function register_domain($domainname, $uid)
88 88
     if (! $useraccount) {
89 89
         system_failure('Kein User gesetzt');
90 90
     }
91
-  
91
+
92 92
     $args = array(":cid" => $cid,
93 93
                 ":useraccount" => $useraccount,
94 94
                 ":basename" => $data['basename'],
Browse code

Fix coding style with php-cs-checker, see https://cs.sensiolabs.org/

Hanno authored on 26/06/2018 13:58:19
Showing 1 changed files
... ...
@@ -8,7 +8,7 @@ Written 2008-2018 by schokokeks.org Hosting, namely
8 8
 
9 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 10
 
11
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
11
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
12 12
 http://creativecommons.org/publicdomain/zero/1.0/
13 13
 
14 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.
... ...
@@ -24,96 +24,94 @@ require_once('httpnet.php');
24 24
 require_once('modules/email/include/vmail.php');
25 25
 
26 26
 
27
-function get_domain_offer($domainname) 
27
+function get_domain_offer($domainname)
28 28
 {
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);
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);
58 58
   
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;
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;
65 65
 }
66 66
 
67 67
 
68 68
 
69 69
 function register_domain($domainname, $uid)
70 70
 {
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
-  }
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
+    }
91 91
   
92
-  $args = array(":cid" => $cid,
92
+    $args = array(":cid" => $cid,
93 93
                 ":useraccount" => $useraccount,
94 94
                 ":basename" => $data['basename'],
95 95
                 ":tld" => $data['tld']);
96
-  db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail) VALUES ".
96
+    db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail) VALUES ".
97 97
            "(:cid, :useraccount, :basename, :tld, 'regular', NULL, 1, 1, 'auto') ", $args);
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');
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');
105 105
 }
106 106
 
107 107
 function list_useraccounts()
108 108
 {
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
-  {
114
-    $ret[] = $item;
115
-  }
116
-  DEBUG($ret);
117
-  return $ret;
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;
118 117
 }
119
-
Browse code

Beim Hinzufügen einer Domain wird der Preis nicht mehr gesetzt, der wird jetzt gesetzt beim Eintreffen der Registrierung

Bernd Wurst authored on 22/01/2018 17:23:24
Showing 1 changed files
... ...
@@ -88,19 +88,18 @@ function register_domain($domainname, $uid)
88 88
   if (! $useraccount) {
89 89
     system_failure('Kein User gesetzt');
90 90
   }
91
-
91
+  
92 92
   $args = array(":cid" => $cid,
93 93
                 ":useraccount" => $useraccount,
94 94
                 ":basename" => $data['basename'],
95
-                ":tld" => $data['tld'],
96
-                ":gebuehr" => $data['gebuehr']);
97
-  db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail, provider, betrag, brutto) VALUES ".
98
-           "(:cid, :useraccount, :basename, :tld, 'regular', NULL, 1, 1, 'auto', 'terions', :gebuehr, 1) ", $args);
95
+                ":tld" => $data['tld']);
96
+  db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail) VALUES ".
97
+           "(:cid, :useraccount, :basename, :tld, 'regular', NULL, 1, 1, 'auto') ", $args);
99 98
   $domid = db_insert_id();
100
-  if ($data['setup']) {
99
+  /*if ($data['setup']) {
101 100
     $args = array(":cid" => $cid, ":setup" => $data['setup'], ":text" => 'Einmalige Setup-Gebühren für Domain "'.$data['domainname'].'"');
102 101
     db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES (:cid, 0, CURDATE(), :setup, 1, :text, 1)", $args);
103
-  }
102
+  }*/
104 103
   # Umstellen auf vmail
105 104
   change_domain($domid, 'virtual');
106 105
 }
Browse code

Umstellung von SOAP-API auf JSON-API

Bernd Wurst authored on 19/01/2018 23:10:13
Showing 1 changed files
... ...
@@ -56,7 +56,7 @@ function get_domain_offer($domainname)
56 56
   $data["gebuehr"] = $temp["gebuehr"];
57 57
   $data["setup"] = ($temp["setup"] ? $temp["setup"] : 0.0);
58 58
   
59
-  $available = terions_available($domainname);
59
+  $available = api_domain_available($domainname);
60 60
   if (! $available) {
61 61
     warning('Die Domain »'.$domainname.'« ist leider nicht verfügbar.');
62 62
     return;
Browse code

Duplikaterkennung beim Eintragen von Domains

Bernd Wurst authored on 14/01/2018 15:25:37
Showing 1 changed files
... ...
@@ -36,6 +36,12 @@ function get_domain_offer($domainname)
36 36
 
37 37
   $cid = (int) $_SESSION['customerinfo']['customerno'];
38 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
+
39 45
   $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
40 46
 
41 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));
Browse code

Copyright year update

Bernd Wurst authored on 13/01/2018 06:07:05
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2014 by schokokeks.org Hosting, namely
5
+Written 2008-2018 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Neue Version der http.net-Partner-API / Umstellung terions bzw. tld-systems auf http.net

Bernd Wurst authored on 06/01/2016 11:41:19
Showing 1 changed files
... ...
@@ -19,7 +19,7 @@ require_once('inc/base.php');
19 19
 require_once('inc/security.php');
20 20
 require_once('inc/error.php');
21 21
 
22
-require_once('terions.php');
22
+require_once('httpnet.php');
23 23
 
24 24
 require_once('modules/email/include/vmail.php');
25 25
 
Browse code

Setze neu eingetragene Domains auf Webinterface-Verwaltung

Bernd Wurst authored on 07/03/2015 04:50:44
Showing 1 changed files
... ...
@@ -21,6 +21,8 @@ require_once('inc/error.php');
21 21
 
22 22
 require_once('terions.php');
23 23
 
24
+require_once('modules/email/include/vmail.php');
25
+
24 26
 
25 27
 function get_domain_offer($domainname) 
26 28
 {
... ...
@@ -88,10 +90,13 @@ function register_domain($domainname, $uid)
88 90
                 ":gebuehr" => $data['gebuehr']);
89 91
   db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail, provider, betrag, brutto) VALUES ".
90 92
            "(:cid, :useraccount, :basename, :tld, 'regular', NULL, 1, 1, 'auto', 'terions', :gebuehr, 1) ", $args);
93
+  $domid = db_insert_id();
91 94
   if ($data['setup']) {
92 95
     $args = array(":cid" => $cid, ":setup" => $data['setup'], ":text" => 'Einmalige Setup-Gebühren für Domain "'.$data['domainname'].'"');
93 96
     db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES (:cid, 0, CURDATE(), :setup, 1, :text, 1)", $args);
94 97
   }
98
+  # Umstellen auf vmail
99
+  change_domain($domid, 'virtual');
95 100
 }
96 101
 
97 102
 function list_useraccounts()
Browse code

Lizenzinfos in eigenes Modul ausgelagert und Copyright auf 2014 angepasst

Bernd Wurst authored on 08/02/2014 05:45:07
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2013 by schokokeks.org Hosting, namely
5
+Written 2008-2014 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

* Weitere Module auf prepared-statements umgestellt * Warnung beim Aufruf von db_escape_string() und maybe_null() hinzugefügt

Bernd Wurst authored on 03/02/2014 16:57:44
Showing 1 changed files
... ...
@@ -36,9 +36,9 @@ function get_domain_offer($domainname)
36 36
 
37 37
   $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
38 38
 
39
-  $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise_kunde WHERE kunde={$cid} AND tld='{$tld}' AND ruecksprache='N'");
39
+  $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));
40 40
   if ($result->rowCount() != 1) {
41
-    $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld='{$tld}' AND ruecksprache='N'");
41
+    $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld=:tld AND ruecksprache='N'", array(":tld" => $tld));
42 42
   }
43 43
   if ($result->rowCount() != 1) {
44 44
     warning('Die Endung »'.$tld.'« steht zur automatischen Eintragung nicht zur Verfügung.');
... ...
@@ -81,16 +81,23 @@ function register_domain($domainname, $uid)
81 81
     system_failure('Kein User gesetzt');
82 82
   }
83 83
 
84
-  db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail, provider, betrag, brutto) VALUES ({$cid}, {$useraccount}, '{$data['basename']}', '{$data['tld']}', 'regular', NULL, 1, 1, 'auto', 'terions', {$data['gebuehr']}, 1) ");
84
+  $args = array(":cid" => $cid,
85
+                ":useraccount" => $useraccount,
86
+                ":basename" => $data['basename'],
87
+                ":tld" => $data['tld'],
88
+                ":gebuehr" => $data['gebuehr']);
89
+  db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail, provider, betrag, brutto) VALUES ".
90
+           "(:cid, :useraccount, :basename, :tld, 'regular', NULL, 1, 1, 'auto', 'terions', :gebuehr, 1) ", $args);
85 91
   if ($data['setup']) {
86
-    db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES ({$cid}, 0, CURDATE(), {$data['setup']}, 1, 'Einmalige Setup-Gebühren für Domain \"{$data['domainname']}\"', 1)");
92
+    $args = array(":cid" => $cid, ":setup" => $data['setup'], ":text" => 'Einmalige Setup-Gebühren für Domain "'.$data['domainname'].'"');
93
+    db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES (:cid, 0, CURDATE(), :setup, 1, :text, 1)", $args);
87 94
   }
88 95
 }
89 96
 
90 97
 function list_useraccounts()
91 98
 {
92 99
   $customerno = (int) $_SESSION['customerinfo']['customerno'];
93
-  $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde={$customerno}");
100
+  $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde=?", array($customerno));
94 101
   $ret = array();
95 102
   while ($item = $result->fetch())
96 103
   {
Browse code

Umstellung auf PDO-Datenbankverbindung

Bernd Wurst authored on 01/02/2014 18:38:23
Showing 1 changed files
... ...
@@ -15,7 +15,6 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 require_once('inc/debug.php');
18
-require_once('inc/db_connect.php');
19 18
 require_once('inc/base.php');
20 19
 require_once('inc/security.php');
21 20
 require_once('inc/error.php');
... ...
@@ -38,14 +37,14 @@ function get_domain_offer($domainname)
38 37
   $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
39 38
 
40 39
   $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise_kunde WHERE kunde={$cid} AND tld='{$tld}' AND ruecksprache='N'");
41
-  if (mysql_num_rows($result) != 1) {
40
+  if ($result->rowCount() != 1) {
42 41
     $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld='{$tld}' AND ruecksprache='N'");
43 42
   }
44
-  if (mysql_num_rows($result) != 1) {
43
+  if ($result->rowCount() != 1) {
45 44
     warning('Die Endung »'.$tld.'« steht zur automatischen Eintragung nicht zur Verfügung.');
46 45
     return;
47 46
   }
48
-  $temp = mysql_fetch_assoc($result);
47
+  $temp = $result->fetch();
49 48
   $data["gebuehr"] = $temp["gebuehr"];
50 49
   $data["setup"] = ($temp["setup"] ? $temp["setup"] : 0.0);
51 50
   
... ...
@@ -93,7 +92,7 @@ function list_useraccounts()
93 92
   $customerno = (int) $_SESSION['customerinfo']['customerno'];
94 93
   $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde={$customerno}");
95 94
   $ret = array();
96
-  while ($item = mysql_fetch_assoc($result))
95
+  while ($item = $result->fetch())
97 96
   {
98 97
     $ret[] = $item;
99 98
   }
Browse code

Ermögliche auch mehrgliedrige Endungen

Bernd Wurst authored on 25/01/2014 08:23:19
Showing 1 changed files
... ...
@@ -27,13 +27,10 @@ function get_domain_offer($domainname)
27 27
 {
28 28
   $domainname = filter_input_hostname($domainname);
29 29
   $domainname = preg_replace('/^www\./', '', $domainname);
30
-  if (preg_match('/.*\..*\..*/', $domainname)) {
31
-    warning('zu viele Punkte im Domainname');
32
-    return;
33
-  }
34
-  $basename = preg_replace('/\..*$/', '', $domainname);
30
+
31
+  $basename = preg_replace('/([^\.]+)\..*$/', '\1', $domainname);
35 32
   DEBUG('Found Basename: '.$basename);
36
-  $tld = preg_replace('/^.*\./', '', $domainname);
33
+  $tld = preg_replace('/^[^\.]*\./', '', $domainname);
37 34
   DEBUG('Found TLD: '.$tld);
38 35
 
39 36
   $cid = (int) $_SESSION['customerinfo']['customerno'];
Browse code

Lese Kunden-Sonderpreise für Domains aus

Bernd Wurst authored on 25/01/2014 08:19:25
Showing 1 changed files
... ...
@@ -36,9 +36,14 @@ function get_domain_offer($domainname)
36 36
   $tld = preg_replace('/^.*\./', '', $domainname);
37 37
   DEBUG('Found TLD: '.$tld);
38 38
 
39
+  $cid = (int) $_SESSION['customerinfo']['customerno'];
40
+
39 41
   $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
40 42
 
41
-  $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld='{$tld}' AND ruecksprache='N'");
43
+  $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise_kunde WHERE kunde={$cid} AND tld='{$tld}' AND ruecksprache='N'");
44
+  if (mysql_num_rows($result) != 1) {
45
+    $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld='{$tld}' AND ruecksprache='N'");
46
+  }
42 47
   if (mysql_num_rows($result) != 1) {
43 48
     warning('Die Endung »'.$tld.'« steht zur automatischen Eintragung nicht zur Verfügung.');
44 49
     return;
... ...
@@ -82,7 +87,7 @@ function register_domain($domainname, $uid)
82 87
 
83 88
   db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail, provider, betrag, brutto) VALUES ({$cid}, {$useraccount}, '{$data['basename']}', '{$data['tld']}', 'regular', NULL, 1, 1, 'auto', 'terions', {$data['gebuehr']}, 1) ");
84 89
   if ($data['setup']) {
85
-    db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES (({$cid}, 0, CURDATE(), {$data['setup']}, 1, 'Einmalige Setup-Gebühren für Domain \"{$data['domainname']}\"', 1)");
90
+    db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES ({$cid}, 0, CURDATE(), {$data['setup']}, 1, 'Einmalige Setup-Gebühren für Domain \"{$data['domainname']}\"', 1)");
86 91
   }
87 92
 }
88 93
 
Browse code

Neues Modul zum Prüfen der Verfügbarkeit von DOmains und Eintragung in unsere DB

Bernd Wurst authored on 25/01/2014 07:31:33
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,101 @@
1
+<?php
2
+/*
3
+This file belongs to the Webinterface of schokokeks.org Hosting
4
+
5
+Written 2008-2013 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('inc/debug.php');
18
+require_once('inc/db_connect.php');
19
+require_once('inc/base.php');
20
+require_once('inc/security.php');
21
+require_once('inc/error.php');
22
+
23
+require_once('terions.php');
24
+
25
+
26
+function get_domain_offer($domainname) 
27
+{
28
+  $domainname = filter_input_hostname($domainname);
29
+  $domainname = preg_replace('/^www\./', '', $domainname);
30
+  if (preg_match('/.*\..*\..*/', $domainname)) {
31
+    warning('zu viele Punkte im Domainname');
32
+    return;
33
+  }
34
+  $basename = preg_replace('/\..*$/', '', $domainname);
35
+  DEBUG('Found Basename: '.$basename);
36
+  $tld = preg_replace('/^.*\./', '', $domainname);
37
+  DEBUG('Found TLD: '.$tld);
38
+
39
+  $data = array("domainname" => $domainname, "basename" => $basename, "tld" => $tld);
40
+
41
+  $result = db_query("SELECT tld, gebuehr, setup FROM misc.domainpreise WHERE tld='{$tld}' AND ruecksprache='N'");
42
+  if (mysql_num_rows($result) != 1) {
43
+    warning('Die Endung »'.$tld.'« steht zur automatischen Eintragung nicht zur Verfügung.');
44
+    return;
45
+  }
46
+  $temp = mysql_fetch_assoc($result);
47
+  $data["gebuehr"] = $temp["gebuehr"];
48
+  $data["setup"] = ($temp["setup"] ? $temp["setup"] : 0.0);
49
+  
50
+  $available = terions_available($domainname);
51
+  if (! $available) {
52
+    warning('Die Domain »'.$domainname.'« ist leider nicht verfügbar.');
53
+    return;
54
+  }
55
+  return $data;
56
+}
57
+
58
+
59
+
60
+function register_domain($domainname, $uid)
61
+{
62
+  $data = get_domain_offer($domainname);
63
+
64
+  if (! $data) {
65
+    // Die Include-Datei setzt eine passende Warning-Nachricht
66
+    show_warnings();
67
+    system_failure('Interner Fehler');
68
+  }
69
+
70
+  $cid = (int) $_SESSION['customerinfo']['customerno'];
71
+  $useraccount = NULL;
72
+  $available_users = list_useraccounts();
73
+  foreach ($available_users as $u) {
74
+    if ($uid == $u['uid']) {
75
+      $useraccount = (int) $uid;
76
+      break;
77
+    } 
78
+  }
79
+  if (! $useraccount) {
80
+    system_failure('Kein User gesetzt');
81
+  }
82
+
83
+  db_query("INSERT INTO kundendaten.domains (kunde, useraccount, domainname, tld, billing, registrierungsdatum, dns,webserver, mail, provider, betrag, brutto) VALUES ({$cid}, {$useraccount}, '{$data['basename']}', '{$data['tld']}', 'regular', NULL, 1, 1, 'auto', 'terions', {$data['gebuehr']}, 1) ");
84
+  if ($data['setup']) {
85
+    db_query("INSERT INTO kundendaten.leistungen (kunde,periodisch,datum,betrag,brutto,beschreibung,anzahl) VALUES (({$cid}, 0, CURDATE(), {$data['setup']}, 1, 'Einmalige Setup-Gebühren für Domain \"{$data['domainname']}\"', 1)");
86
+  }
87
+}
88
+
89
+function list_useraccounts()
90
+{
91
+  $customerno = (int) $_SESSION['customerinfo']['customerno'];
92
+  $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde={$customerno}");
93
+  $ret = array();
94
+  while ($item = mysql_fetch_assoc($result))
95
+  {
96
+    $ret[] = $item;
97
+  }
98
+  DEBUG($ret);
99
+  return $ret;
100
+}
101
+