Avoid empty lists of ip address in the export
authorAlexander Ebert <ebert@woltlab.com>
Tue, 22 May 2018 08:28:27 +0000 (10:28 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 22 May 2018 08:28:27 +0000 (10:28 +0200)
wcfsetup/install/files/lib/acp/action/UserExportGdprAction.class.php

index b5f86a37f8a0f9b6e19173963bac6b9186198b36..09b90dc28f1ae52b226a3550490a56773eeae007 100644 (file)
@@ -131,10 +131,6 @@ class UserExportGdprAction extends AbstractAction {
                                continue;
                        }
                        
-                       if (!isset($this->data[$package])) {
-                               $this->data[$package] = array();
-                       }
-                       
                        $ipAddresses = array();
                        foreach ($tableNames as $tableName) {
                                $ipAddresses = array_merge(
@@ -150,7 +146,10 @@ class UserExportGdprAction extends AbstractAction {
                                );
                        }
                        
-                       $this->data[$package]['ipAddresses'] = $ipAddresses;
+                       if (!empty($ipAddresses)) {
+                               if (!isset($this->data[$package])) $this->data[$package] = array();
+                               $this->data[$package]['ipAddresses'] = $ipAddresses;
+                       }
                }
                
                $this->data['@@generator'] = array(
@@ -312,6 +311,10 @@ class UserExportGdprAction extends AbstractAction {
                                if ($optionValue === '') {
                                        continue;
                                }
+                               else if ($option->optionName === 'gender' && $optionValue === '0') {
+                                       // exclude the gender if there has been no selection
+                                       continue;
+                               }
                                
                                $data[$option->optionName] = $optionValue;
                        }