354c05a4ddd678c49bcbba458bffa7d13482139a
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

1) <?php
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 1 year ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 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 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 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) */
13) 
14) require_once('contacts.php');
15) require_once('inc/debug.php');
16) require_once('inc/icons.php');
17) 
18) require_once('session/start.php');
19) 
20) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

21) require_role([ROLE_CUSTOMER]);
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

22) $section = 'contacts_list';
23) 
24) title("Adresse verwenden als...");
25) 
26) 
27) output(internal_link('list', 'Zurück zur Übersicht'));
28) 
29) $contact = get_contact($_REQUEST['id']);
30) $kundenkontakte = get_kundenkontakte();
31) $id = $contact['id'];
32) 
33) 
34) if (isset($_REQUEST['useas'])) {
35)     if ($_REQUEST['useas'] == 'kunde') {
36)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
37)             system_failure("Man kann eine Kunden-Adresse nicht löschen, bitte eine neue als Ersatz festlegen!");
38)         } else {
39)             set_kundenkontakt('kunde', $id);
Bernd Wurst Abstrahieren der Anzeigefun...

Bernd Wurst authored 6 years ago

40)             //redirect('useas?id='.$id);
41)             // usability: Dann kann man da eh nichts mehr machen, also zurück zur Übersicht
42)             redirect('list');
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

43)         }
44)     }
45)     if ($_REQUEST['useas'] == 'extern') {
46)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

47)             set_kundenkontakt('extern', null);
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

48)             redirect('useas?id=' . $id);
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

49)         } else {
50)             set_kundenkontakt('extern', $id);
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

51)             redirect('useas?id=' . $id);
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

52)         }
53)     }
54)     if ($_REQUEST['useas'] == 'rechnung') {
55)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

56)             set_kundenkontakt('rechnung', null);
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

57)             redirect('useas?id=' . $id);
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

58)         } else {
59)             set_kundenkontakt('rechnung', $id);
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

60)             redirect('useas?id=' . $id);
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

61)         }
62)     }
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

63)     if ($_REQUEST['useas'] == 'dataprotection') {
64)         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

65)             set_kundenkontakt('dataprotection', null);
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

66)             redirect('useas?id=' . $id);
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

67)         } else {
68)             set_kundenkontakt('dataprotection', $id);
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

69)             redirect('useas?id=' . $id);
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

70)         }
71)     }
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

72) } else {
Bernd Wurst Abstrahieren der Anzeigefun...

Bernd Wurst authored 6 years ago

73)     output(display_contact($contact));
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

74)     output('<p>' . internal_link('edit', icon_edit('Adresse bearbeiten') . " Adresse bearbeiten", 'id=' . $id) . '</p>');
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 6 months ago

75)     if ($id != $kundenkontakte['kunde'] && !is_domainholder($id)) {
Bernd Wurst UI-Änderung, man kann Konta...

Bernd Wurst authored 6 years ago

76)         // Die Stamm-Adresse kann man nicht löschen und verwendete Domain-Kontakte auch nicht
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

77)         output('<p class="delete">' . internal_link('save', "Diese Adresse löschen", 'action=delete&id=' . $id) . '</p>');
Bernd Wurst UI-Änderung, man kann Konta...

Bernd Wurst authored 6 years ago

78)     }
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

79) 
80)     output('<h4>Verwendung als Kundenkontakt</h4>');
81)     if ($id == $kundenkontakte['kunde']) {
82)         output("<p>Diese Adresse ist die Stamm-Adresse!</p>");
83)     } else {
84)         if (possible_kundenkontakt($contact)) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

85)             addnew('useas', 'Diese Adresse als Haupt-Adresse des Kontoinhabers festlegen.', 'id=' . $_REQUEST['id'] . '&useas=kunde');
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

86)         }
87)         if ($id == $kundenkontakte['extern']) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

88)             output("<p>Diese Adresse ist die Ersatz-Adresse bei Störungen. " . icon_delete() . internal_link('useas', "Zuordnung löschen", 'id=' . $_REQUEST['id'] . '&useas=extern&action=delete') . "</p>");
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

89)         } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

90)             addnew('useas', 'Diese Adresse als Ersatz-Adresse des Kontoinhabers für Störungen festlegen.', 'id=' . $_REQUEST['id'] . '&useas=extern');
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

91)         }
92)         if ($id == $kundenkontakte['rechnung']) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

93)             output("<p>Diese Adresse ist die Rechnungs-Adresse. " . icon_delete() . internal_link('useas', "Zuordnung löschen", 'id=' . $_REQUEST['id'] . '&useas=rechnung&action=delete') . "</p>");
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

94)         } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

95)             addnew('useas', 'Diese Adresse als Rechnungs-Adresse festlegen.', 'id=' . $_REQUEST['id'] . '&useas=rechnung');
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

96)         }
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

97)         if ($id == $kundenkontakte['dataprotection']) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

98)             output("<p>Diese Adresse ist die Adresse des betrieblichen Datenschutzbeauftragten. " . icon_delete() . internal_link('useas', "Zuordnung löschen", 'id=' . $_REQUEST['id'] . '&useas=dataprotection&action=delete') . "</p>");
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

99)         } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

100)             addnew('useas', 'Diese Adresse als betrieblichen Datenschutzbeauftragten benennen.', 'id=' . $_REQUEST['id'] . '&useas=dataprotection');
Bernd Wurst Verwaltung eines betrieblic...

Bernd Wurst authored 6 years ago

101)         }
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

102)     }
103) 
104) 
Bernd Wurst Security

Bernd Wurst authored 6 years ago

105)     output("<h4>Verwendung als Domaininhaber bzw. -Verwalter</h4>");
Bernd Wurst Setzen als Kundenkontakte e...

Bernd Wurst authored 6 years ago

106)     if (possible_domainholder($contact)) {
Bernd Wurst Security

Bernd Wurst authored 6 years ago

107)         $domains = domainlist_by_contact($contact);
108)         foreach ($domains as $d) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

109)             $funktion = [];
Bernd Wurst Security

Bernd Wurst authored 6 years ago

110)             if ($contact['id'] == $d->owner) {
111)                 $funktion[] = 'Inhaber';
112)             }
113)             if ($contact['id'] == $d->admin_c) {
114)                 $funktion[] = 'Verwalter';
115)             }
116)             $funktion = implode(' und ', $funktion);
117) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

118)             output('<p>Ist <strong>' . $funktion . '</strong> bei der Domain <strong>' . $d->fqdn . '</strong>. ' . internal_link('../domains/detail', icon_edit() . " Inhaber dieser Domain ändern", 'id=' . $d->id) . '</p>');
Bernd Wurst Security

Bernd Wurst authored 6 years ago

119)         }
120)     } else {
121)         output("<p>Zur Verwendung als Domaininhaber müssen Name, vollständige Adresse, E-Mail-Adresse sowie Telefonnummer angegeben sein.</p>");