git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7d08d84
)
login/edit: treat avatar as jpeg images
author
Mischa POSLAWSKY
<perl@shiar.org>
Sat, 16 Jun 2018 13:05:49 +0000
(15:05 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Sat, 16 Jun 2018 19:58:28 +0000
(21:58 +0200)
login/edit.php
patch
|
blob
|
history
diff --git
a/login/edit.php
b/login/edit.php
index bb2278faf2b02f22250656a9b6f2158d8329111a..e44d0597f6ea54147758f5ebcba6c01a2e525d2c 100644
(file)
--- a/
login/edit.php
+++ b/
login/edit.php
@@
-22,9
+22,10
@@
$cols = [
];
foreach ($cols as $col => &$colconf) {
];
foreach ($cols as $col => &$colconf) {
- $colpath = "{$user['dir']}/$col.txt";
+ $filetype = @$colconf['type'] == 'file' ? 'jpg' : 'txt';
+ $colpath = "{$user['dir']}/$col.$filetype";
if (file_exists($colpath)) {
if (file_exists($colpath)) {
- $colconf['value'] =
@$colconf['type'] == 'file
' ? '' :
+ $colconf['value'] =
$filetype != 'txt
' ? '' :
file_get_contents($colpath);
}
if (file_exists($user['dir']) and !is_writable($user['dir'])) {
file_get_contents($colpath);
}
if (file_exists($user['dir']) and !is_writable($user['dir'])) {
@@
-112,6
+113,9
@@
if ($_POST) {
foreach ($cols as $col => &$colconf) {
print "\t";
printf('<label for="%s">%s:</label> ', $col, ucfirst($colconf['label']));
foreach ($cols as $col => &$colconf) {
print "\t";
printf('<label for="%s">%s:</label> ', $col, ucfirst($colconf['label']));
+ if (@$colconf['type'] == 'file' and isset($colconf['value'])) {
+ printf('<img src="/%s" /><br />', $colconf['target']);
+ }
print "<input";
if (empty($colconf['target'])) print ' readonly';
printf(' type="%s" name="%s" id="%1$s" value="%s"',
print "<input";
if (empty($colconf['target'])) print ' readonly';
printf(' type="%s" name="%s" id="%1$s" value="%s"',
@@
-119,6
+123,9
@@
foreach ($cols as $col => &$colconf) {
$col,
htmlspecialchars(@$colconf['value'])
);
$col,
htmlspecialchars(@$colconf['value'])
);
+ if (@$colconf['type'] == 'file') {
+ printf(' accept="%s"', 'image/jpeg');
+ }
print ' placeholder="Niet ingesteld"';
print " />";
print ' placeholder="Niet ingesteld"';
print " />";