From f3d5217b16e98e6c6d68a5286d6c9a1f4328b929 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 12 Nov 2018 21:03:27 +0100 Subject: [PATCH] login: support eol in text configuration files --- auth.inc.php | 2 +- login/edit.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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."; } -- 2.30.0