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)
modules/contacts/include/api.php 11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
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)
|
API-Funktionen um Kontakte...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/api.php 17) require_once('contacts.php');
|
Grundlegende API-Routine
Bernd Wurst authored 6 years ago
|
modules/contacts/include/api.php 18) require_once('inc/debug.php');
|
API-Routine ausgelagert
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contactapi.php 19) require_once('inc/api.php');
|
API-Funktionen um Kontakte...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/api.php 20)
modules/contacts/include/api.php 21)
modules/contacts/include/api.php 22) function contact_to_apicontact($c)
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'];
|
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) }
|
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)
modules/contacts/include/api.php 44)
modules/contacts/include/api.php 45) function upload_contact($c)
modules/contacts/include/api.php 46) {
modules/contacts/include/api.php 47) $ac = contact_to_apicontact($c);
modules/contacts/include/api.php 48) if ($ac['id'] || $ac['handle']) {
modules/contacts/include/api.php 49) // Update
modules/contacts/include/api.php 50) $data = array("contact" => $ac);
modules/contacts/include/api.php 51) $result = api_request('contactUpdate', $data);
|
Security
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contactapi.php 52) if ($result['status'] != 'success') {
modules/contacts/include/contactapi.php 53) system_failure("Es gab ein Problem beim Hochladen der Adresse zum Domainregistrar. Das sollte nicht sein!");
modules/contacts/include/contactapi.php 54) }
|