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:
1ed6d72
)
login/edit: create missing user profiles
author
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 14 Jun 2018 09:24:18 +0000
(11:24 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 14 Jun 2018 12:45:19 +0000
(14:45 +0200)
login/edit.php
patch
|
blob
|
history
diff --git
a/login/edit.php
b/login/edit.php
index 4cb3f111db94ae18b350c6579ab3025d94c0db58..75811ed82d2581fa1a03d0c4482d2cd6b9a89f86 100644
(file)
--- a/
login/edit.php
+++ b/
login/edit.php
@@
-5,15
+5,11
@@
if (empty($user = &$User)) {
}
if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
}
if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
- $username =
ltrim($Args, '/'
);
+ $username =
strtolower(ltrim($Args, '/')
);
$user = [
'dir' => "profile/$username",
'name' => $username,
];
$user = [
'dir' => "profile/$username",
'name' => $username,
];
- if (!is_writable($user['dir'])) {
- print "<p class=warn>Het is niet mogelijk om de gebruiker <em>{$user['name']}</em> aan te passen.</p>\n\n";
- return;
- }
}
$cols = [
}
$cols = [
@@
-26,7
+22,7
@@
foreach ($cols as $col => &$colconf) {
if (file_exists($colpath)) {
$colconf['value'] = file_get_contents($colpath);
}
if (file_exists($colpath)) {
$colconf['value'] = file_get_contents($colpath);
}
- if (!is_writable($user['dir'])) {
+ if (
file_exists($user['dir']) and
!is_writable($user['dir'])) {
continue; # locked parent directory
}
if (isset($colconf['value']) and !is_writable($colpath)) {
continue; # locked parent directory
}
if (isset($colconf['value']) and !is_writable($colpath)) {
@@
-41,6
+37,10
@@
$cols = [
$colwarn = [];
if ($_POST) {
$colwarn = [];
if ($_POST) {
+ if (!file_exists($user['dir']) and !@mkdir($user['dir'])) {
+ print "<p class=warn>Fout bij het aanmaken van gebruikersprofiel voor <em>{$user['name']}</em>.</p>\n\n";
+ return;
+ }
foreach ($_POST as $col => $val) {
if (!isset($cols[$col])) {
continue; # unknown
foreach ($_POST as $col => $val) {
if (!isset($cols[$col])) {
continue; # unknown
@@
-53,7
+53,7
@@
if ($_POST) {
$colwarn[$col] = "Kan niet worden aangepast.";
continue;
}
$colwarn[$col] = "Kan niet worden aangepast.";
continue;
}
- if (
!file_put_contents($cols[$col]['target'], $val)
) {
+ if (
file_put_contents($cols[$col]['target'], $val) === FALSE
) {
$colwarn[$col] = "Fout bij opslaan.";
}
}
$colwarn[$col] = "Fout bij opslaan.";
}
}