git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
login/edit: generic setup of input attributes
[minimedit.git]
/
login
/
edit.php
diff --git
a/login/edit.php
b/login/edit.php
index 49b8ed8c43e821092694b4c9953cbb154f507595..99afb13a62b745cfe08068c340815aa480cb1ff4 100644
(file)
--- a/
login/edit.php
+++ b/
login/edit.php
@@
-17,7
+17,15
@@
and !empty($Place['user']) and $Place['user'] !== $User['name']) {
require_once('edit.inc.php');
foreach ($cols as $col => &$colconf) {
require_once('edit.inc.php');
foreach ($cols as $col => &$colconf) {
- $colconf['visible'] = TRUE;
+ if (isset($colconf['visible'])) {
+ if ($colconf['visible'] == 'admin' and empty($User['admin'])) {
+ $colconf['visible'] = FALSE;
+ continue;
+ }
+ }
+ else {
+ $colconf['visible'] = TRUE;
+ }
if (!isset($colconf['filename'])) {
continue; # exceptional storage
if (!isset($colconf['filename'])) {
continue; # exceptional storage
@@
-33,17
+41,15
@@
foreach ($cols as $col => &$colconf) {
$tagname = pathinfo($tag, PATHINFO_BASENAME);
$target = "$tag/{$user['name']}";
$val = file_exists($target);
$tagname = pathinfo($tag, PATHINFO_BASENAME);
$target = "$tag/{$user['name']}";
$val = file_exists($target);
- $tags[$tagname] = ['value' => $val];
- if (empty($User['admin'])) {
- continue; # forbidden
- }
+ $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
}
if (!is_writable($tag)) {
continue; # locked tag directory
}
if ($val and !is_writable($target)) {
continue; # existing file locked
}
- $tag
s[$tagname]
['target'] = $target;
+ $tag
opt
['target'] = $target;
}
}
}
}
@@
-167,9
+173,10
@@
foreach ($cols as $col => &$colconf) {
print "\t";
printf('<li><label for="%s">%s:</label>', $col, ucfirst($colconf['label']));
if (@$colconf['type'] == 'file' and isset($colconf['value'])) {
print "\t";
printf('<li><label for="%s">%s:</label>', $col, ucfirst($colconf['label']));
if (@$colconf['type'] == 'file' and isset($colconf['value'])) {
+ $target = $user['dir'] . '/' . $colconf['filename'];
printf('<a href="/%s"><img src="/thumb/%s/%s?%s" /></a><br />',
printf('<a href="/%s"><img src="/thumb/%s/%s?%s" /></a><br />',
- $
colconf['target']
,
- 200, $
colconf['target'], filemtime($colconf['target']
)
+ $
target
,
+ 200, $
target, filemtime($target
)
);
}
);
}
@@
-197,10
+204,10
@@
foreach ($cols as $col => &$colconf) {
);
}
}
);
}
}
- else {
+ else
if (@$colconf['type'] !== 'file' or isset($colconf['target']))
{
if (isset($cols[$col]['filter'])) {
list ($targetstr, $inputstr) = $cols[$col]['filter'];
if (isset($cols[$col]['filter'])) {
list ($targetstr, $inputstr) = $cols[$col]['filter'];
- $colconf['value'] = str_replace($targetstr, $inputstr, $colconf['value']);
+ $colconf['value'] = str_replace($targetstr, $inputstr,
@
$colconf['value']);
}
$attrs = [
}
$attrs = [
@@
-210,12
+217,7
@@
foreach ($cols as $col => &$colconf) {
'value' => htmlspecialchars(@$colconf['value']),
'placeholder' => "Niet ingesteld",
'readonly' => empty($colconf['target']),
'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 '<input';
foreach ($attrs as $attr => $attrval) {
print '<input';
foreach ($attrs as $attr => $attrval) {