X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/0c55414fd58400c3923b1b16d5b194a9916637fb..92e54cde1cabdb24dcde3937d390a5b176032be5:/login/edit.php diff --git a/login/edit.php b/login/edit.php index 9b339a2..88272e0 100644 --- a/login/edit.php +++ b/login/edit.php @@ -41,14 +41,15 @@ foreach ($cols as $col => &$colconf) { $tagname = pathinfo($tag, PATHINFO_BASENAME); $target = "$tag/{$user['name']}"; $val = file_exists($target); - $tags[$tagname] = ['value' => $val]; + $tagopt = &$colconf['values'][$tagname] ?: []; + $tagopt['value'] = $val; if (!is_writable($tag)) { continue; # locked tag directory } if ($val and !is_writable($target)) { continue; # existing file locked } - $tags[$tagname]['target'] = $target; + $tagopt['target'] = $target; } } @@ -56,7 +57,7 @@ foreach ($cols as $col => &$colconf) { $colpath = $user['dir'] . '/' . $colconf['filename']; if (file_exists($colpath)) { $colconf['value'] = $filetype != 'txt' ? '' : - file_get_contents($colpath); + rtrim(file_get_contents($colpath)); } if (file_exists($user['dir']) and !is_writable($user['dir'])) { continue; # locked parent directory @@ -121,6 +122,9 @@ if ($_POST) { } continue; } + if (@$cols[$col]['type'] != 'file') { + $val .= "\n"; # eol in text files + } if (file_put_contents($cols[$col]['target'], $val) === FALSE) { $colwarn[$col] = "Fout bij opslaan."; } @@ -172,9 +176,10 @@ foreach ($cols as $col => &$colconf) { print "\t"; printf('