fe8d7c2025e33349ab1e51c0e906ec3ee69dcff2
Bernd Wurst Grundlegende API-Routine

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php          1) <?php
modules/contacts/include/api.php          2) /*
modules/contacts/include/api.php          3) This file belongs to the Webinterface of schokokeks.org Hosting
modules/contacts/include/api.php          4) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

modules/contacts/include/contactapi.php   5) Written by schokokeks.org Hosting, namely
Bernd Wurst Grundlegende API-Routine

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php          6)   Bernd Wurst <bernd@schokokeks.org>
modules/contacts/include/api.php          7)   Hanno Böck <hanno@schokokeks.org>
modules/contacts/include/api.php          8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

modules/contacts/include/contactapi.php   9) This code is published under a 0BSD license.
Bernd Wurst Grundlegende API-Routine

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         10) 
modules/contacts/include/api.php         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.
modules/contacts/include/api.php         12) */
modules/contacts/include/api.php         13) 
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         14) require_once('contacts.php');
Bernd Wurst Grundlegende API-Routine

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         15) require_once('inc/debug.php');
Bernd Wurst API-Routine ausgelagert

Bernd Wurst authored 6 years ago

modules/contacts/include/contactapi.php  16) require_once('inc/api.php');
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         17) 
modules/contacts/include/api.php         18) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/contacts/include/contactapi.php  19) function contact_to_apicontact($c)
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         20) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

modules/contacts/include/contactapi.php  21)     $ac = [];
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         22)     $ac['id'] = $c['nic_id'];
modules/contacts/include/api.php         23)     $ac['handle'] = $c['nic_handle'];
modules/contacts/include/api.php         24)     $ac['type'] = 'person';
modules/contacts/include/api.php         25)     $ac['name'] = $c['name'];
modules/contacts/include/api.php         26)     $ac['organization'] = $c['company'];
modules/contacts/include/api.php         27)     $ac['street'] = explode("\n", $c['address'], 3);
modules/contacts/include/api.php         28)     $ac['postalCode'] = $c['zip'];
modules/contacts/include/api.php         29)     $ac['city'] = $c['city'];
modules/contacts/include/api.php         30)     $ac['country'] = strtolower($c['country']);
modules/contacts/include/api.php         31)     $ac['emailAddress'] = $c['email'];
modules/contacts/include/api.php         32)     $ac['phoneNumber'] = $c['phone'];
modules/contacts/include/api.php         33)     $ac['faxNumber'] = $c['fax'];
Bernd Wurst Neue Darstellung der Kontak...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         34)     if ($c['state'] == 'deleted') {
modules/contacts/include/api.php         35)         $ac['hidden'] = true;
modules/contacts/include/api.php         36)     }
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         37) 
modules/contacts/include/api.php         38)     return $ac;
modules/contacts/include/api.php         39) }
modules/contacts/include/api.php         40) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/contacts/include/contactapi.php  41) function apicontact_to_contact($ac)
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

modules/contacts/include/contactapi.php  42) {
modules/contacts/include/contactapi.php  43)     $c = new_contact();
modules/contacts/include/contactapi.php  44)     $c['nic_id'] = $ac['id'];
modules/contacts/include/contactapi.php  45)     $c['nic_handle'] = $ac['handle'];
modules/contacts/include/contactapi.php  46)     $c['name'] = maybe_null($ac['name']);
modules/contacts/include/contactapi.php  47)     $c['company'] = maybe_null($ac['organization']);
modules/contacts/include/contactapi.php  48)     $c['address'] = implode("\n", $ac['street']);
modules/contacts/include/contactapi.php  49)     $c['zip'] = $ac['postalCode'];
modules/contacts/include/contactapi.php  50)     $c['city'] = $ac['city'];
modules/contacts/include/contactapi.php  51)     $c['country'] = strtoupper($ac['country']);
modules/contacts/include/contactapi.php  52)     $c['email'] = $ac['emailAddress'];
modules/contacts/include/contactapi.php  53)     $c['phone'] = $ac['phoneNumber'];
modules/contacts/include/contactapi.php  54)     $c['fax'] = maybe_null($ac['faxNumber']);
modules/contacts/include/contactapi.php  55)     if ($ac['hidden'] === true) {
modules/contacts/include/contactapi.php  56)         $c['state'] = 'deleted';
modules/contacts/include/contactapi.php  57)     }
modules/contacts/include/contactapi.php  58)     return $c;
modules/contacts/include/contactapi.php  59) }
modules/contacts/include/contactapi.php  60) 
modules/contacts/include/contactapi.php  61) 
modules/contacts/include/contactapi.php  62) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/contacts/include/contactapi.php  63) function download_contact($nic_id)
modules/contacts/include/contactapi.php  64) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

modules/contacts/include/contactapi.php  65)     $data = ["contactId" => $nic_id];
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

modules/contacts/include/contactapi.php  66)     $result = api_request('contactInfo', $data);
modules/contacts/include/contactapi.php  67)     if ($result['status'] != 'success') {
modules/contacts/include/contactapi.php  68)         system_failure("Abfrage nicht erfolgreich!");
modules/contacts/include/contactapi.php  69)     }
modules/contacts/include/contactapi.php  70)     $c = apicontact_to_contact($result['response']);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

modules/contacts/include/contactapi.php  71)     $result = db_query("SELECT id FROM kundendaten.contacts WHERE nic_id=?", [$nic_id]);
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

modules/contacts/include/contactapi.php  72)     if ($result->rowCount() > 0) {
modules/contacts/include/contactapi.php  73)         $data = $result->fetch();
modules/contacts/include/contactapi.php  74)         $c['id'] = $data['id'];
modules/contacts/include/contactapi.php  75)     }
modules/contacts/include/contactapi.php  76)     $id = save_contact($c);
modules/contacts/include/contactapi.php  77)     save_emailaddress($id, $c['email']);
modules/contacts/include/contactapi.php  78)     return $id;
modules/contacts/include/contactapi.php  79) }
modules/contacts/include/contactapi.php  80) 
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         81) 
modules/contacts/include/api.php         82) function upload_contact($c)
modules/contacts/include/api.php         83) {
modules/contacts/include/api.php         84)     $ac = contact_to_apicontact($c);
modules/contacts/include/api.php         85)     if ($ac['id'] || $ac['handle']) {
modules/contacts/include/api.php         86)         // Update
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

modules/contacts/include/contactapi.php  87)         $data = ["contact" => $ac,
Hanno Böck Neue codingstyle-rule array...

Hanno Böck authored 8 months ago

modules/contacts/include/contactapi.php  88)             "actingAs" => "designatedAgent", ];
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         89)         $result = api_request('contactUpdate', $data);
Bernd Wurst Security

Bernd Wurst authored 6 years ago

modules/contacts/include/contactapi.php  90)         if ($result['status'] != 'success') {
modules/contacts/include/contactapi.php  91)             system_failure("Es gab ein Problem beim Hochladen der Adresse zum Domainregistrar. Das sollte nicht sein!");
modules/contacts/include/contactapi.php  92)         }
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         93)     } else {
modules/contacts/include/api.php         94)         // create
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

modules/contacts/include/contactapi.php  95)         $data = ["contact" => $ac];