X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/3da3adc1788fb8be517e61e8b6be094b40875b35..ba81a98b01dd67cfed5ff5dc87f6b3266a0a38ab:/login/edit.php diff --git a/login/edit.php b/login/edit.php index 49b8ed8..1d29b03 100644 --- 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) { - $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 @@ -33,17 +41,15 @@ foreach ($cols as $col => &$colconf) { $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 } - $tags[$tagname]['target'] = $target; + $tagopt['target'] = $target; } } @@ -200,7 +206,7 @@ foreach ($cols as $col => &$colconf) { else { 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 = [