2626dd47daad110c63a82c0560b134e2364eeac3
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) 
modules/contacts/include/api.php          5) Written 2008-2018 by schokokeks.org Hosting, namely
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) 
modules/contacts/include/api.php          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.
modules/contacts/include/api.php         10) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

modules/contacts/include/contactapi.php  11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Grundlegende API-Routine

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         12) http://creativecommons.org/publicdomain/zero/1.0/
modules/contacts/include/api.php         13) 
modules/contacts/include/api.php         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.
modules/contacts/include/api.php         15) */
modules/contacts/include/api.php         16) 
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         20) 
modules/contacts/include/api.php         21) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         40) 
modules/contacts/include/api.php         41)     return $ac;
modules/contacts/include/api.php         42) }
modules/contacts/include/api.php         43) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Hanno authored 6 years ago

modules/contacts/include/contactapi.php  66) function download_contact($nic_id)
modules/contacts/include/contactapi.php  67) {
Bernd Wurst Aktualisiere Domain- und In...

Bernd Wurst authored 6 years ago

modules/contacts/include/contactapi.php  68)     $data = array("contactId" => $nic_id);
modules/contacts/include/contactapi.php  69)     $result = api_request('contactInfo', $data);
modules/contacts/include/contactapi.php  70)     if ($result['status'] != 'success') {
modules/contacts/include/contactapi.php  71)         system_failure("Abfrage nicht erfolgreich!");
modules/contacts/include/contactapi.php  72)     }
modules/contacts/include/contactapi.php  73)     $c = apicontact_to_contact($result['response']);
modules/contacts/include/contactapi.php  74)     $result = db_query("SELECT id FROM kundendaten.contacts WHERE nic_id=?", array($nic_id));
modules/contacts/include/contactapi.php  75)     if ($result->rowCount() > 0) {
modules/contacts/include/contactapi.php  76)         $data = $result->fetch();
modules/contacts/include/contactapi.php  77)         $c['id'] = $data['id'];
modules/contacts/include/contactapi.php  78)     }
modules/contacts/include/contactapi.php  79)     $id = save_contact($c);
modules/contacts/include/contactapi.php  80)     save_emailaddress($id, $c['email']);
modules/contacts/include/contactapi.php  81)     return $id;
modules/contacts/include/contactapi.php  82) }
modules/contacts/include/contactapi.php  83) 
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

modules/contacts/include/api.php         84) 
modules/contacts/include/api.php         85) function upload_contact($c)
modules/contacts/include/api.php         86) {
modules/contacts/include/api.php         87)     $ac = contact_to_apicontact($c);
modules/contacts/include/api.php         88)     if ($ac['id'] || $ac['handle']) {
modules/contacts/include/api.php         89)         // Update
Bernd Wurst Frage die Zustimmung des Do...

Bernd Wurst authored 6 years ago

modules/contacts/include/contactapi.php  90)         $data = array("contact" => $ac,
modules/contacts/include/contactapi.php  91)                 "actingAs" => "designatedAgent");
Bernd Wurst API-Funktionen um Kontakte...

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

modules/contacts/include/contactapi.php  93)         if ($result['status'] != 'success') {
modules/contacts/include/contactapi.php  94)             system_failure("Es gab ein Problem beim Hochladen der Adresse zum Domainregistrar. Das sollte nicht sein!");
modules/contacts/include/contactapi.php  95)         }