<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
if (!$main::done_foreign_require{"htaccess_htpasswd","htaccess-lib.pl"}) {
	require 'htaccess-lib.pl';
	}

sub useradmin_create_user
{
foreach $dir (&amp;list_directories()) {
	next if ($dir-&gt;[3] !~ /create/);
	local $users = &amp;list_users($dir-&gt;[1]);
	local ($clash) = grep { $_-&gt;{'user'} eq $_[0]-&gt;{'user'} } @$users;
	return if ($clash);
	&amp;lock_file($dir-&gt;[1]);
	local $user = { 'user' =&gt; $_[0]-&gt;{'user'},
			'enabled' =&gt; 1 };
	if ($_[0]-&gt;{'passmode'} == 0) {
		$user-&gt;{'pass'} = "";
		}
	elsif ($_[0]-&gt;{'passmode'} == 1) {
		$user-&gt;{'pass'} = "*LK*";
		}
	elsif ($_[0]-&gt;{'passmode'} == 2) {
		$user-&gt;{'pass'} = $_[0]-&gt;{'pass'};
		}
	else {
		$user-&gt;{'pass'} = &amp;encrypt_password($_[0]-&gt;{'plainpass'},
						    undef, $config{'md5'});
		}
	&amp;create_user($user, $dir-&gt;[1]);
	&amp;unlock_file($dir-&gt;[1]);
	}
}

sub useradmin_modify_user
{
foreach $dir (&amp;list_directories()) {
	next if ($dir-&gt;[3] !~ /update/);
	local $users = &amp;list_users($dir-&gt;[1]);
	local ($user) = grep { $_-&gt;{'user'} eq $_[0]-&gt;{'olduser'} } @$users;
	return if (!$user);
	&amp;lock_file($dir-&gt;[1]);
	$user-&gt;{'user'} = $_[0]-&gt;{'user'};
	if ($_[0]-&gt;{'passmode'} == 0) {
		$user-&gt;{'pass'} = "";
		}
	elsif ($_[0]-&gt;{'passmode'} == 1) {
		$user-&gt;{'pass'} = "*LK*";
		}
	elsif ($_[0]-&gt;{'passmode'} == 2) {
		$user-&gt;{'pass'} = $_[0]-&gt;{'pass'};
		}
	elsif ($_[0]-&gt;{'passmode'} == 3) {
		$user-&gt;{'pass'} = &amp;encrypt_password($_[0]-&gt;{'plainpass'},
						    undef, $config{'md5'});
		}
	&amp;modify_user($user);
	&amp;unlock_file($dir-&gt;[1]);
	}
}

sub useradmin_delete_user
{
foreach $dir (&amp;list_directories()) {
	next if ($dir-&gt;[3] !~ /update/);
	local $users = &amp;list_users($dir-&gt;[1]);
	local ($user) = grep { $_-&gt;{'user'} eq $_[0]-&gt;{'user'} } @$users;
	return if (!$user);
	&amp;lock_file($dir-&gt;[1]);
	&amp;delete_user($user);
	&amp;unlock_file($dir-&gt;[1]);
	}
}

1;
</pre></body></html>