Browse code

Umbenennung Datenbank handles -> contacts

Bernd Wurst authored on13/01/2018 07:12:57
Showing6 changed files
... ...
@@ -12,4 +12,4 @@ RewriteEngine On
12 12
 RewriteBase /
13 13
 RewriteRule ^go/(.*)$  dispatch.php?go=$1&%{QUERY_STRING}
14 14
 RewriteRule ^init(.*)$  go/index/initialize_useraccount?token=$1&%{QUERY_STRING} [R]
15
-RewriteRule ^verify(.*)$  go/handles/verify?token=$1&%{QUERY_STRING} [R]
15
+RewriteRule ^verify(.*)$  go/contacts/verify?token=$1&%{QUERY_STRING} [R]
16 16
similarity index 72%
17 17
rename from modules/handles/include/handles.php
18 18
rename to modules/contacts/include/contacts.php
... ...
@@ -30,32 +30,32 @@ function api_fetch_contact($nic_id)
30 30
 */
31 31
 
32 32
 
33
-function get_handles() {
33
+function get_contacts() {
34 34
     $cid = (int) $_SESSION['customerinfo']['customerno'];
35
-    $result = db_query("SELECT id, state, lastchange, nic_handle, company, name, address, zip, city, country, phone, mobile, fax, email, pgp_id FROM kundendaten.handles WHERE customer=? ORDER BY id", array($cid));
35
+    $result = db_query("SELECT id, state, lastchange, nic_handle, company, name, address, zip, city, country, phone, mobile, fax, email, pgp_id FROM kundendaten.contacts WHERE customer=? ORDER BY id", array($cid));
36 36
     $ret = array();
37
-    while ($handle = $result->fetch()) {
38
-        $ret[$handle['id']] = $handle;
37
+    while ($contact = $result->fetch()) {
38
+        $ret[$contact['id']] = $contact;
39 39
     }
40 40
     DEBUG($ret);
41 41
     return $ret;
42 42
 }
43 43
 
44 44
 
45
-function get_kundenhandles() {
45
+function get_kundenkontakte() {
46 46
     $cid = (int) $_SESSION['customerinfo']['customerno'];
47
-    $result = db_query("SELECT handle_kunde, handle_extern, handle_rechnung FROM kundendaten.kunden WHERE id=?", array($cid));
47
+    $result = db_query("SELECT contact_kunde, contact_extern, contact_rechnung FROM kundendaten.kunden WHERE id=?", array($cid));
48 48
     $res = $result->fetch();
49
-    $ret = array("kunde" => $res['handle_kunde'],
50
-                 "extern" => $res['handle_extern'],
51
-                 "rechnung" => $res['handle_rechnung']);
49
+    $ret = array("kunde" => $res['contact_kunde'],
50
+                 "extern" => $res['contact_extern'],
51
+                 "rechnung" => $res['contact_rechnung']);
52 52
     return $ret;
53 53
 }
54 54
 
55 55
 
56
-function update_pending($handleid) {
57
-    $handleid = (int) $handleid;
58
-    $result = db_query("SELECT email FROM kundendaten.mailaddress_token WHERE handle=?", array($handleid));
56
+function update_pending($contactid) {
57
+    $contactid = (int) $contactid;
58
+    $result = db_query("SELECT email FROM kundendaten.mailaddress_token WHERE contact=?", array($contactid));
59 59
     if ($result->rowCount() == 0) {
60 60
         return NULL;
61 61
     }
62 62
similarity index 83%
63 63
rename from modules/handles/include/verify.php
64 64
rename to modules/contacts/include/verify.php
... ...
@@ -19,7 +19,7 @@ function verify_mail_token($token)
19 19
 {
20 20
   db_query("DELETE FROM kundendaten.mailaddress_token WHERE expire<NOW()");
21 21
   $args = array(":token" => $token);
22
-  $result = db_query("SELECT handle, email FROM kundendaten.mailaddress_token WHERE token=:token AND expire>NOW()", $args);
22
+  $result = db_query("SELECT contact, email FROM kundendaten.mailaddress_token WHERE token=:token AND expire>NOW()", $args);
23 23
   if ($result->rowCount() > 0)
24 24
   {
25 25
     $line = $result->fetch();
... ...
@@ -33,16 +33,16 @@ function verify_mail_token($token)
33 33
 
34 34
 function update_mailaddress($daten)
35 35
 {
36
-    $handle = $daten['handle'];
36
+    $contact = $daten['contact'];
37 37
     $email = $daten['email'];
38 38
 
39 39
     if (! check_emailaddr($email)) {
40 40
         system_failure('Es ist eine ungültige Adresse hinterlegt. So wird das nichts. Bitte die Änderung von vorne machen.');
41 41
     } 
42 42
 
43
-    $args = array(':handle' => $handle,
43
+    $args = array(':contact' => $contact,
44 44
                   ':email' => $email);
45
-    db_query("UPDATE kundendaten.handles SET email=:email WHERE id=:handle", $args);
45
+    db_query("UPDATE kundendaten.contacts SET email=:email WHERE id=:contact", $args);
46 46
     
47 47
 }
48 48
 
49 49
similarity index 72%
50 50
rename from modules/handles/list.php
51 51
rename to modules/contacts/list.php
... ...
@@ -14,7 +14,7 @@ http://creativecommons.org/publicdomain/zero/1.0/
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.
15 15
 */
16 16
 
17
-require_once('handles.php');
17
+require_once('contacts.php');
18 18
 require_once('inc/debug.php');
19 19
 
20 20
 require_once('session/start.php');
... ...
@@ -25,35 +25,35 @@ require_role(array(ROLE_CUSTOMER));
25 25
 title("Adressen verwalten");
26 26
 
27 27
 
28
-$handles = get_handles();
29
-$kundenhandles = get_kundenhandles();
28
+$contacts = get_contacts();
29
+$kundenkontakte = get_kundenkontakte();
30 30
 
31 31
 output('<p>Sie haben aktuell diese Adressen gespeichert:</p>
32 32
 <table>
33 33
 <tr><th>#</th><th>Name</th><th>Adresse</th><th>E-Mail</th><th>Verwendung</th><th>Aktionen</th></tr>
34 34
 ');
35
-foreach ($handles as $id => $handle) {
36
-    $adresse = nl2br($handle['address']."\n".$handle['country'].'-'.$handle['zip'].' '.$handle['city']);
35
+foreach ($contacts as $id => $contact) {
36
+    $adresse = nl2br($contact['address']."\n".$contact['country'].'-'.$contact['zip'].' '.$contact['city']);
37 37
     $usage = array();
38
-    if ($id == $kundenhandles['kunde']) {
38
+    if ($id == $kundenkontakte['kunde']) {
39 39
         $usage[] = 'Stamm-Adresse';
40 40
     }
41
-    if ($id == $kundenhandles['extern']) {
41
+    if ($id == $kundenkontakte['extern']) {
42 42
         $usage[] = 'Ersatz-Adresse';
43 43
     }
44
-    if ($id == $kundenhandles['rechnung']) {
44
+    if ($id == $kundenkontakte['rechnung']) {
45 45
         $usage[] = 'Rechnungs-Adresse';
46 46
     }
47
-    if ($handle['nic_handle']) {
47
+    if ($contact['nic_handle']) {
48 48
         $usage[] = 'Domain-Kontakt';
49 49
     }
50 50
     $usage = join(', ', $usage);
51
-    $email = $handle['email'];
51
+    $email = $contact['email'];
52 52
     $new_email = update_pending($id);
53 53
     if ($new_email) {
54 54
         $email = "<strike>$email</strike><br/>".$new_email.footnote('Die E-Mail-Adresse wurde noch nicht bestätigt');
55 55
     }
56
-    output("<tr><td>{$handle['id']}</td><td><strong>{$handle['name']}</strong></td><td>$adresse</td><td>$email</td><td>$usage</td><td>...</td></tr>");
56
+    output("<tr><td>{$contact['id']}</td><td><strong>{$contact['name']}</strong></td><td>$adresse</td><td>$email</td><td>$usage</td><td>...</td></tr>");
57 57
 }
58 58
 output('</table>');
59 59
 output("<br />");
60 60
similarity index 87%
61 61
rename from modules/handles/menu.php
62 62
rename to modules/contacts/menu.php
... ...
@@ -19,7 +19,7 @@ $role = $_SESSION['role'];
19 19
 
20 20
 if (($role & ROLE_CUSTOMER))
21 21
 {
22
-  $menu["handles_list"] = array("label" => "Adressen verwalten", "file" => "list", "weight" => 1, "submenu" => "index_index");
22
+  $menu["contacts_list"] = array("label" => "Adressen verwalten", "file" => "list", "weight" => 1, "submenu" => "index_index");
23 23
 }
24 24
 
25 25
 ?>
26 26
similarity index 97%
27 27
rename from modules/handles/verify.php
28 28
rename to modules/contacts/verify.php
... ...
@@ -18,7 +18,7 @@ require_once('verify.php');
18 18
 require_once('inc/security.php');
19 19
 
20 20
 title("E-Mail-Adresse bestätigen");
21
-$section = 'handles_list';
21
+$section = 'contacts_list';
22 22
 
23 23
 if (isset($_REQUEST['token']))
24 24
 {