X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/ab3ebc53acde6f060649a01403a886f5485f7bf6..0c55414fd58400c3923b1b16d5b194a9916637fb:/login/edit.php diff --git a/login/edit.php b/login/edit.php index 101244a..9b339a2 100644 --- a/login/edit.php +++ b/login/edit.php @@ -17,14 +17,24 @@ and !empty($Place['user']) and $Place['user'] !== $User['name']) { require_once('edit.inc.php'); foreach ($cols as $col => &$colconf) { + 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['values'])) { if (!file_exists($colconf['filename'])) { + $colconf['visible'] = FALSE; continue; - #TODO: drop key } $tags = []; foreach (glob($colconf['filename'] . '/*') as $tag) { @@ -32,9 +42,6 @@ foreach ($cols as $col => &$colconf) { $target = "$tag/{$user['name']}"; $val = file_exists($target); $tags[$tagname] = ['value' => $val]; - if (empty($User['admin'])) { - continue; # forbidden - } if (!is_writable($tag)) { continue; # locked tag directory } @@ -129,12 +136,12 @@ if ($_POST) { } try { require_once('upload.inc.php'); - $target = userupload($val, $cols[$col]['target']); + $target = userupload($val, NULL, $cols[$col]['target']); if (!$target) continue; $cols[$col]['value'] = ''; } catch (Exception $e) { - $colwarn[$col] = $e->getMessage(); + $colwarn[$col] = ucfirst($e->getMessage()).'.'; } } @@ -158,6 +165,10 @@ if ($_POST) {