+$cols = [
+ 'email' => ['label' => 'e-mailadres', 'type' => 'email'],
+];
+
+foreach ($cols as $col => &$colconf) {
+ $colpath = "$userdir/$col.txt";
+ if (file_exists($colpath)) {
+ $colconf['value'] = file_get_contents($colpath);
+ }
+ if (!is_writable($userdir)) {
+ continue; # locked parent directory
+ }
+ if (isset($colconf['value']) and !is_writable($colpath)) {
+ continue; # locked column file
+ }
+ $colconf['target'] = $colpath; # editing allowed
+}
+
+$colwarn = [];