From: Mischa POSLAWSKY Date: Mon, 12 Nov 2018 20:03:27 +0000 (+0100) Subject: login: support eol in text configuration files X-Git-Tag: v3.8~6 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/f3d5217b16e98e6c6d68a5286d6c9a1f4328b929 login: support eol in text configuration files --- diff --git a/auth.inc.php b/auth.inc.php index a2db9f3..65b7f72 100644 --- a/auth.inc.php +++ b/auth.inc.php @@ -19,7 +19,7 @@ class User function rawname() { - return @file_get_contents("{$this->dir}/name.txt"); + return rtrim(@file_get_contents("{$this->dir}/name.txt")); } function name() diff --git a/login/edit.php b/login/edit.php index 99afb13..e60cf59 100644 --- a/login/edit.php +++ b/login/edit.php @@ -57,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 @@ -122,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."; }