In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 1) <?php
modules/handles/include/handles.php 2) /*
modules/handles/include/handles.php 3) This file belongs to the Webinterface of schokokeks.org Hosting
modules/handles/include/handles.php 4)
|
Copyright year update
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 5) Written 2008-2018 by schokokeks.org Hosting, namely
|
In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 6) Bernd Wurst <bernd@schokokeks.org>
modules/handles/include/handles.php 7) Hanno Böck <hanno@schokokeks.org>
modules/handles/include/handles.php 8)
modules/handles/include/handles.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/handles/include/handles.php 10)
modules/handles/include/handles.php 11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
modules/handles/include/handles.php 12) http://creativecommons.org/publicdomain/zero/1.0/
modules/handles/include/handles.php 13)
modules/handles/include/handles.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/handles/include/handles.php 15) */
modules/handles/include/handles.php 16)
modules/handles/include/handles.php 17) require_once('inc/debug.php');
modules/handles/include/handles.php 18) require_role(array(ROLE_CUSTOMER));
modules/handles/include/handles.php 19)
|
$usage ist ein array
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 20) /*
modules/handles/include/handles.php 21) require_once('external/http.net/domainRobotApi.php');
modules/handles/include/handles.php 22)
modules/handles/include/handles.php 23) function api_fetch_contact($nic_id)
modules/handles/include/handles.php 24) {
modules/handles/include/handles.php 25) if (! config('http.net-apikey')) {
modules/handles/include/handles.php 26) system_failure("Kein API-Key vorhanden!");
modules/handles/include/handles.php 27) }
modules/handles/include/handles.php 28) $api = new domainRobotApi(config('http.net-apikey'));
modules/handles/include/handles.php 29) }
modules/handles/include/handles.php 30) */
modules/handles/include/handles.php 31)
modules/handles/include/handles.php 32)
|
Vorbereitung für edit/new
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 33) function new_contact() {
modules/contacts/include/contacts.php 34) return array("id" => NULL,
modules/contacts/include/contacts.php 35) "state" => NULL,
modules/contacts/include/contacts.php 36) "lastchange" => time(),
modules/contacts/include/contacts.php 37) "nic_handle" => NULL,
modules/contacts/include/contacts.php 38) "nic_id" => NULL,
modules/contacts/include/contacts.php 39) "company" => NULL,
modules/contacts/include/contacts.php 40) "name" => NULL,
modules/contacts/include/contacts.php 41) "address" => NULL,
modules/contacts/include/contacts.php 42) "zip" => NULL,
modules/contacts/include/contacts.php 43) "city" => NULL,
modules/contacts/include/contacts.php 44) "country" => "DE",
modules/contacts/include/contacts.php 45) "phone" => NULL,
modules/contacts/include/contacts.php 46) "mobile" => NULL,
modules/contacts/include/contacts.php 47) "fax" => NULL,
modules/contacts/include/contacts.php 48) "email" => NULL,
modules/contacts/include/contacts.php 49) "pgp_id" => NULL,
modules/contacts/include/contacts.php 50) "pgp_key" => NULL,
modules/contacts/include/contacts.php 51) "customer" => $_SESSION['customerinfo']['customerno']);
modules/contacts/include/contacts.php 52) }
modules/contacts/include/contacts.php 53)
modules/contacts/include/contacts.php 54)
modules/contacts/include/contacts.php 55) function get_contact($id)
modules/contacts/include/contacts.php 56) {
modules/contacts/include/contacts.php 57) $args = array(
modules/contacts/include/contacts.php 58) "cid" => (int) $_SESSION['customerinfo']['customerno'],
modules/contacts/include/contacts.php 59) "id" => (int) $id);
modules/contacts/include/contacts.php 60) $result = db_query("SELECT id, state, lastchange, nic_id, nic_handle, company, name, address, zip, city, country, phone, mobile, fax, email, pgp_id, pgp_key FROM kundendaten.contacts WHERE id=:id AND customer=:cid", $args);
modules/contacts/include/contacts.php 61) if ($result->rowCount() == 0) {
modules/contacts/include/contacts.php 62) system_failure("Kontakt nicht gefunden oder gehört nicht diesem Kunden");
modules/contacts/include/contacts.php 63) }
|
Zeige bestehende Daten in d...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 64) $contact = $result->fetch();
|
Vorbereitung für edit/new
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 65) return $contact;
modules/contacts/include/contacts.php 66) }
modules/contacts/include/contacts.php 67)
|
Umbenennung Datenbank handl...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 68) function get_contacts() {
|
In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 69) $cid = (int) $_SESSION['customerinfo']['customerno'];
|
Vorbereitung für edit/new
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 70) $result = db_query("SELECT id, state, lastchange, nic_id, nic_handle, company, name, address, zip, city, country, phone, mobile, fax, email, pgp_id, pgp_key FROM kundendaten.contacts WHERE customer=? ORDER BY id", array($cid));
|
In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 71) $ret = array();
|
Umbenennung Datenbank handl...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 72) while ($contact = $result->fetch()) {
modules/contacts/include/contacts.php 73) $ret[$contact['id']] = $contact;
|
In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 74) }
modules/handles/include/handles.php 75) DEBUG($ret);
modules/handles/include/handles.php 76) return $ret;
modules/handles/include/handles.php 77) }
modules/handles/include/handles.php 78)
|
Speichern der Änderungen mö...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 79) function have_mailaddress($email)
modules/contacts/include/contacts.php 80) {
modules/contacts/include/contacts.php 81) $cid = (int) $_SESSION['customerinfo']['customerno'];
modules/contacts/include/contacts.php 82) $result = db_query("SELECT id FROM kundendaten.contacts WHERE customer=? AND email=?", array($cid, $email));
modules/contacts/include/contacts.php 83) if ($result->rowCount() > 0) {
modules/contacts/include/contacts.php 84) return true;
modules/contacts/include/contacts.php 85) }
modules/contacts/include/contacts.php 86) return false;
modules/contacts/include/contacts.php 87) }
modules/contacts/include/contacts.php 88)
|
In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 89)
|
Umbenennung Datenbank handl...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 90) function get_kundenkontakte() {
|
In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 91) $cid = (int) $_SESSION['customerinfo']['customerno'];
|
Umbenennung Datenbank handl...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 92) $result = db_query("SELECT contact_kunde, contact_extern, contact_rechnung FROM kundendaten.kunden WHERE id=?", array($cid));
|
In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 93) $res = $result->fetch();
|
Umbenennung Datenbank handl...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 94) $ret = array("kunde" => $res['contact_kunde'],
modules/contacts/include/contacts.php 95) "extern" => $res['contact_extern'],
modules/contacts/include/contacts.php 96) "rechnung" => $res['contact_rechnung']);
|
In neues Modul ausgelagert
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 97) return $ret;
modules/handles/include/handles.php 98) }
modules/handles/include/handles.php 99)
|
Speichern der Änderungen mö...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 100) function save_emailaddress($id, $email)
modules/contacts/include/contacts.php 101) {
|
Speichere E-Mail-Adresse oh...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 102) // Speichert eine E-Mail-Adresse direkt, z.B. wenn diese schonmal geprüt wurde
modules/contacts/include/contacts.php 103) $args = array("cid" => (int) $_SESSION['customerinfo']['customerno'],
modules/contacts/include/contacts.php 104) "id" => (int) $id,
modules/contacts/include/contacts.php 105) "email" => $email);
modules/contacts/include/contacts.php 106) db_query("UPDATE kundendaten.contacts SET email=:email WHERE id=:id AND customer=:cid", $args);
|
Speichern der Änderungen mö...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 107) }
modules/contacts/include/contacts.php 108)
modules/contacts/include/contacts.php 109) function save_contact($c)
modules/contacts/include/contacts.php 110) {
modules/contacts/include/contacts.php 111) for ($i=0;array_key_exists($i, $c);$i++) {
modules/contacts/include/contacts.php 112) unset($c[$i]);
modules/contacts/include/contacts.php 113) }
modules/contacts/include/contacts.php 114) unset($c['state']);
modules/contacts/include/contacts.php 115) unset($c['lastchange']);
modules/contacts/include/contacts.php 116) unset($c['nic_id']);
modules/contacts/include/contacts.php 117) unset($c['nic_handle']);
modules/contacts/include/contacts.php 118) unset($c['email']);
modules/contacts/include/contacts.php 119) $c['customer'] = (int) $_SESSION['customerinfo']['customerno'];
modules/contacts/include/contacts.php 120) if ($c['id']) {
modules/contacts/include/contacts.php 121) // Kontakt bestaht schon, Update
modules/contacts/include/contacts.php 122) db_query("UPDATE kundendaten.contacts SET company=:company, name=:name, address=:address, zip=:zip, city=:city, country=:country, phone=:phone, mobile=:mobile, fax=:fax, pgp_id=:pgp_id, pgp_key=:pgp_key WHERE id=:id AND customer=:customer", $c);
modules/contacts/include/contacts.php 123) } else {
modules/contacts/include/contacts.php 124) unset($c['id']);
modules/contacts/include/contacts.php 125) // Neu anlegen
modules/contacts/include/contacts.php 126) db_query("INSERT INTO kundendaten.contacts (customer, company, name, address, zip, city, country, phone, mobile, fax, pgp_id, pgp_key) VALUES (:customer, :company, :name, :address, :zip, :city, :country, :phone, :mobile, :fax, :pgp_id, :pgp_key)", $c);
modules/contacts/include/contacts.php 127) $c['id'] = db_insert_id();
modules/contacts/include/contacts.php 128) }
modules/contacts/include/contacts.php 129) return $c['id'];
modules/contacts/include/contacts.php 130) }
modules/contacts/include/contacts.php 131)
modules/contacts/include/contacts.php 132)
modules/contacts/include/contacts.php 133) function send_emailchange_token($id, $email)
modules/contacts/include/contacts.php 134) {
modules/contacts/include/contacts.php 135) if (! check_emailaddr($email)) {
modules/contacts/include/contacts.php 136) system_falure("Die E-Mail-Adresse scheint nicht gültig zu sein.");
modules/contacts/include/contacts.php 137) }
modules/contacts/include/contacts.php 138) $args = array("id" => (int) $id,
modules/contacts/include/contacts.php 139) "email" => $email,
modules/contacts/include/contacts.php 140) "token" => random_string(20));
modules/contacts/include/contacts.php 141)
modules/contacts/include/contacts.php 142) db_query("INSERT INTO kundendaten.mailaddress_token (token, expire, contact, email) VALUES (:token, NOW() + INTERVAL 1 DAY, :id, :email)" , $args);
modules/contacts/include/contacts.php 143) DEBUG('Token erzeugt: '.print_r($args, true));
modules/contacts/include/contacts.php 144) $message = 'Diese E-Mail-Adresse wurde angegeben als möglicher Domaininhaber oder Kundenkontakt bei schokokeks.org Hosting.
modules/contacts/include/contacts.php 145)
modules/contacts/include/contacts.php 146) Bitte bestätigen Sie mit einem Klick auf den nachfolgenden Link, dass diese E-Mail-Adresse funktioniert und verwendet werden soll:
modules/contacts/include/contacts.php 147)
modules/contacts/include/contacts.php 148) '.config('webinterface_url').'/verify'.$args['token'].'
modules/contacts/include/contacts.php 149)
modules/contacts/include/contacts.php 150) Wenn Sie diesen Link nicht innerhalb von 24 Stunden abrufen, wird Ihre Adresse gelöscht und nicht verwendet.
modules/contacts/include/contacts.php 151) Sollten Sie mit der Verwendung Ihrer E-Mail-Adresse nicht einverstanden sein, so ignorieren Sie daher bitte diese Nachricht oder teilen Sie uns dies mit.
modules/contacts/include/contacts.php 152)
modules/contacts/include/contacts.php 153) --
modules/contacts/include/contacts.php 154) schokokeks.org GbR, Bernd Wurst, Johannes Böck
modules/contacts/include/contacts.php 155) Köchersberg 32, 71540 Murrhardt
modules/contacts/include/contacts.php 156)
modules/contacts/include/contacts.php 157) https://schokokeks.org
modules/contacts/include/contacts.php 158) ';
modules/contacts/include/contacts.php 159) # send welcome message
modules/contacts/include/contacts.php 160) mail($email, '=?UTF-8?Q?Best=C3=A4tigung_Ihrer_E-Mail-Adresse?=', $message, "X-schokokeks-org-message: verify\nFrom: ".config('company_name').' <'.config('adminmail').">\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\n");
modules/contacts/include/contacts.php 161)
modules/contacts/include/contacts.php 162) }
|
E-Mail-Adresse verifizieren...
Bernd Wurst authored 6 years ago
|
modules/handles/include/handles.php 163)
|
Umbenennung Datenbank handl...
Bernd Wurst authored 6 years ago
|
modules/contacts/include/contacts.php 164) function update_pending($contactid) {
modules/contacts/include/contacts.php 165) $contactid = (int) $contactid;
modules/contacts/include/contacts.php 166) $result = db_query("SELECT email FROM kundendaten.mailaddress_token WHERE contact=?", array($contactid));
|