X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/ba81a98b01dd67cfed5ff5dc87f6b3266a0a38ab..f3d5217b16e98e6c6d68a5286d6c9a1f4328b929:/login/edit.php
diff --git a/login/edit.php b/login/edit.php
index 1d29b03..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.";
}
@@ -173,9 +176,10 @@ foreach ($cols as $col => &$colconf) {
print "\t";
printf('
', $col, ucfirst($colconf['label']));
if (@$colconf['type'] == 'file' and isset($colconf['value'])) {
+ $target = $user['dir'] . '/' . $colconf['filename'];
printf('
',
- $colconf['target'],
- 200, $colconf['target'], filemtime($colconf['target'])
+ $target,
+ 200, $target, filemtime($target)
);
}
@@ -203,7 +207,7 @@ foreach ($cols as $col => &$colconf) {
);
}
}
- else {
+ elseif (@$colconf['type'] !== 'file' or isset($colconf['target'])) {
if (isset($cols[$col]['filter'])) {
list ($targetstr, $inputstr) = $cols[$col]['filter'];
$colconf['value'] = str_replace($targetstr, $inputstr, @$colconf['value']);
@@ -216,12 +220,7 @@ foreach ($cols as $col => &$colconf) {
'value' => htmlspecialchars(@$colconf['value']),
'placeholder' => "Niet ingesteld",
'readonly' => empty($colconf['target']),
- 'pattern' => @$colconf['pattern'] ?: FALSE,
- 'size' => @$colconf['size'] ?: FALSE,
- ];
- if (@$colconf['type'] == 'file') {
- $attrs['accept'] = "image/jpeg";
- }
+ ] + (@$colconf['attr'] ?: []);
print ' $attrval) {