Bernd Wurst commited on 2018-01-24 10:34:58
              Zeige 5 geänderte Dateien mit 63 Einfügungen und 9 Löschungen.
            
| ... | ... | 
                      @@ -27,7 +27,11 @@ $sesskey = $_SESSION['contacts_choose_key'];  | 
                  
| 27 | 27 | 
                         if (isset($_REQUEST['id'])) {
                       | 
                    
| 28 | 28 | 
                        $c = get_contact($_REQUEST['id']);  | 
                    
| 29 | 29 | 
                        $_SESSION[$sesskey] = $c['id'];  | 
                    
| 30 | 
                        - redirect($_SESSION['contacts_choose_redirect']);  | 
                    |
| 30 | 
                        + $redirect = $_SESSION['contacts_choose_redirect'];  | 
                    |
| 31 | 
                        + unset($_SESSION['contacts_choose_header']);  | 
                    |
| 32 | 
                        + unset($_SESSION['contacts_choose_key']);  | 
                    |
| 33 | 
                        + unset($_SESSION['contacts_choose_redirect']);  | 
                    |
| 34 | 
                        + redirect($redirect);  | 
                    |
| 31 | 35 | 
                        }  | 
                    
| 32 | 36 | 
                         | 
                    
| 33 | 37 | 
                         | 
                    
| ... | ... | 
                      @@ -20,7 +20,7 @@ use_module('contacts');
                     | 
                  
| 20 | 20 | 
                         require_once('contacts.php');
                       | 
                    
| 21 | 21 | 
                         require_once('contactapi.php');
                       | 
                    
| 22 | 22 | 
                         | 
                    
| 23 | 
                        -function api_update_domain($id) {
                       | 
                    |
| 23 | 
                        +function api_download_domain($id) {
                       | 
                    |
| 24 | 24 | 
                             $result = db_query("SELECT id, CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c, registrierungsdatum, kuendigungsdatum FROM kundendaten.domains WHERE id=?", array($id));
                       | 
                    
| 25 | 25 | 
                             if ($result->rowCount() < 1) {
                       | 
                    
| 26 | 26 | 
                                 system_failure('Domain nicht gefunden');
                       | 
                    
| ... | ... | 
                      @@ -58,3 +58,43 @@ function api_update_domain($id) {
                     | 
                  
| 58 | 58 | 
                        }  | 
                    
| 59 | 59 | 
                         | 
                    
| 60 | 60 | 
                         | 
                    
| 61 | 
                        +function api_upload_domain($fqdn)  | 
                    |
| 62 | 
                        +{
                       | 
                    |
| 63 | 
                        +    $result = db_query("SELECT id,CONCAT_WS('.', domainname, tld) AS fqdn, owner, admin_c FROM kundendaten.domains WHERE CONCAT_WS('.', domainname, tld)=?", array($fqdn));
                       | 
                    |
| 64 | 
                        +    if ($result->rowCount() < 1) {
                       | 
                    |
| 65 | 
                        +        system_failure("Unbekannte Domain");
                       | 
                    |
| 66 | 
                        + }  | 
                    |
| 67 | 
                        + $dom = $result->fetch();  | 
                    |
| 68 | 
                        + $owner = get_contact($dom['owner']);  | 
                    |
| 69 | 
                        +    if (! $owner['nic_id']) {
                       | 
                    |
| 70 | 
                        + upload_contact($owner);  | 
                    |
| 71 | 
                        + $owner = get_contact($dom['owner']);  | 
                    |
| 72 | 
                        + }  | 
                    |
| 73 | 
                        + $admin_c = get_contact($dom['admin_c']);  | 
                    |
| 74 | 
                        +    if (! $admin_c['nic_id']) {
                       | 
                    |
| 75 | 
                        + upload_contact($admin_c);  | 
                    |
| 76 | 
                        + $admin_c = get_contact($dom['admin_c']);  | 
                    |
| 77 | 
                        + }  | 
                    |
| 78 | 
                        + $owner = $owner['nic_id'];  | 
                    |
| 79 | 
                        + $admin_c = $admin_c['nic_id'];  | 
                    |
| 80 | 
                        +  | 
                    |
| 81 | 
                        +    $data = array("domainName" => $dom['fqdn']);
                       | 
                    |
| 82 | 
                        +    $result = api_request('domainInfo', $data);
                       | 
                    |
| 83 | 
                        +    if ($result['status'] != 'success') {
                       | 
                    |
| 84 | 
                        +        system_failure("Abfrage nicht erfolgreich!");
                       | 
                    |
| 85 | 
                        + }  | 
                    |
| 86 | 
                        + $apidomain = $result['response'];  | 
                    |
| 87 | 
                        +    foreach ($apidomain['contacts'] as $key => $ac) {
                       | 
                    |
| 88 | 
                        +        if ($ac['type'] == 'owner') {
                       | 
                    |
| 89 | 
                        + $apidomain['contacts'][$key]['contact'] = $owner;  | 
                    |
| 90 | 
                        + }  | 
                    |
| 91 | 
                        +        if ($ac['type'] == 'admin') {
                       | 
                    |
| 92 | 
                        + $apidomain['contacts'][$key]['contact'] = $admin_c;  | 
                    |
| 93 | 
                        + }  | 
                    |
| 94 | 
                        + }  | 
                    |
| 95 | 
                        +    $args = array("domain" => $apidomain);
                       | 
                    |
| 96 | 
                        +    api_request('domainUpdate', $args);
                       | 
                    |
| 97 | 
                        +  | 
                    |
| 98 | 
                        +}  | 
                    |
| 99 | 
                        +  | 
                    |
| 100 | 
                        +  | 
                    
| ... | ... | 
                      @@ -14,8 +14,8 @@ http://creativecommons.org/publicdomain/zero/1.0/  | 
                  
| 14 | 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.  | 
                    
| 15 | 15 | 
                        */  | 
                    
| 16 | 16 | 
                         | 
                    
| 17 | 
                        -require_once('inc/base.php');
                       | 
                    |
| 18 | 17 | 
                         require_once('inc/debug.php');
                       | 
                    
| 18 | 
                        +require_once('domainapi.php');
                       | 
                    |
| 19 | 19 | 
                         | 
                    
| 20 | 20 | 
                         | 
                    
| 21 | 21 | 
                        function mailman_subdomains($domain)  | 
                    
| ... | ... | 
                      @@ -80,6 +80,13 @@ function web_in_use($domain)  | 
                  
| 80 | 80 | 
                        return ($result->rowCount() > 0 || $result2->rowCount() > 0);  | 
                    
| 81 | 81 | 
                        }  | 
                    
| 82 | 82 | 
                         | 
                    
| 83 | 
                        +function domain_ownerchange($fqdn, $owner, $admin_c)  | 
                    |
| 84 | 
                        +{
                       | 
                    |
| 85 | 
                        + $cid = (int) $_SESSION['customerinfo']['customerno'];  | 
                    |
| 86 | 
                        +    db_query("UPDATE kundendaten.domains SET owner=?, admin_c=? WHERE CONCAT_WS('.', domainname, tld)=? AND kunde=?", array($owner, $admin_c, $fqdn, $cid));
                       | 
                    |
| 87 | 
                        + api_upload_domain($fqdn);  | 
                    |
| 88 | 
                        +}  | 
                    |
| 89 | 
                        +  | 
                    |
| 83 | 90 | 
                         | 
                    
| 84 | 91 | 
                         function update_possible($domain) {
                       | 
                    
| 85 | 92 | 
                        $dom = new Domain((int) $domain);  | 
                    
| ... | ... | 
                      @@ -27,7 +27,7 @@ require_once('contacts.php');
                     | 
                  
| 27 | 27 | 
                         | 
                    
| 28 | 28 | 
                        $dom = NULL;  | 
                    
| 29 | 29 | 
                         if (isset($_REQUEST['id'])) {
                       | 
                    
| 30 | 
                        - api_update_domain($_REQUEST['id']);  | 
                    |
| 30 | 
                        + api_download_domain($_REQUEST['id']);  | 
                    |
| 31 | 31 | 
                        $dom = new Domain( (int) $_REQUEST['id']);  | 
                    
| 32 | 32 | 
                             if ($dom->provider == 'external' || $dom->provider != 'terions') {
                       | 
                    
| 33 | 33 | 
                                 system_failure("<p>Diese Domain ist extern registriert!</p>");
                       | 
                    
| ... | ... | 
                      @@ -31,9 +31,12 @@ if (!$dom) {
                     | 
                  
| 31 | 31 | 
                        }  | 
                    
| 32 | 32 | 
                         | 
                    
| 33 | 33 | 
                        DEBUG($dom);  | 
                    
| 34 | 
                        -/* DAS TUT NICHT! */  | 
                    |
| 35 | 
                        -$dom->owner = $_SESSION['domains_update_owner'];  | 
                    |
| 36 | 
                        -$dom->admin_c = $_SESSION['domains_update_admin_c'];  | 
                    |
| 37 | 
                        -$dom->save();  | 
                    |
| 34 | 
                        +domain_ownerchange($_SESSION['domains_update_domainname'], $_SESSION['domains_update_owner'], $_SESSION['domains_update_admin_c']);  | 
                    |
| 38 | 35 | 
                         | 
                    
| 39 | 
                        -print_r($_SESSION);  | 
                    |
| 36 | 
                        +  | 
                    |
| 37 | 
                        +unset($_SESSION['domains_update_domainname']);  | 
                    |
| 38 | 
                        +unset($_SESSION['domains_update_owner']);  | 
                    |
| 39 | 
                        +unset($_SESSION['domains_update_admin_c']);  | 
                    |
| 40 | 
                        +unset($_SESSION['domains_update_detach']);  | 
                    |
| 41 | 
                        +  | 
                    |
| 42 | 
                        +redirect('domains');
                       | 
                    |
| 40 | 43 |