Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,19 @@ SQLConnectInfo database@localhost username password
SQLUserInfo users userid passwd uid gid homedir shell
SQLGroupInfo groups groupname gid members
SQLUserWhereClause "disabled != 1"

# Register login counter and date
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "login_count=login_count+1, last_login=now() WHERE userid='%u'" users

# Register login history
SQLLog PASS log_sess
SQLNamedQuery log_sess INSERT "'%u', '%a', '%V', '%{protocol}', NOW()" login_history

# Register file changes
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified_file=now() WHERE userid='%u'" users

# Used to track xfer traffic per user (without invoking a quota)
SQLLog RETR bytes-out-count
SQLNamedQuery bytes-out-count UPDATE "bytes_out_used=bytes_out_used+%b WHERE userid='%u'" users
Expand Down
2 changes: 1 addition & 1 deletion add_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
$errormsg = 'Group "'.$_REQUEST[$cfg['field_groupname']].'" creation failed; check log files.';
}
} else {
$errormsg = implode($errors, "<br />\n");
$errormsg = implode("<br />\n", $errors);
}
}

Expand Down
8 changes: 4 additions & 4 deletions add_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
$field_disabled => $disabled);
if ($ac->add_user($userdata)) {
if (isset($_REQUEST[$field_ad_gid])) {
while (list($g_key, $g_gid) = each($_REQUEST[$field_ad_gid])) {
foreach ($_REQUEST[$field_ad_gid] as $g_key => $g_gid) {
if (!$ac->is_valid_id($g_gid)) {
$warnmsg = 'Adding additional group failed; at least one of the additional groups had an invalid GID.';
continue;
Expand All @@ -114,7 +114,7 @@
$errormsg = 'User "'.$_REQUEST[$field_userid].'" creation failed; check log files.';
}
} else {
$errormsg = implode($errors, "<br />\n");
$errormsg = implode("<br />\n", $errors);
}
}

Expand Down Expand Up @@ -195,7 +195,7 @@
<label for="<?php echo $field_ugid; ?>" class="col-sm-4 control-label">Main group</label>
<div class="controls col-sm-8">
<select class="form-control multiselect" id="<?php echo $field_ugid; ?>" name="<?php echo $field_ugid; ?>" required>
<?php while (list($g_gid, $g_group) = each($groups)) { ?>
<?php foreach ($groups as $g_gid => $g_group) { ?>
<option value="<?php echo $g_gid; ?>" <?php if ($ugid == $g_gid) { echo 'selected="selected"'; } ?>><?php echo $g_group; ?></option>
<?php } ?>
</select>
Expand All @@ -206,7 +206,7 @@
<label for="<?php echo $field_ad_gid; ?>" class="col-sm-4 control-label">Additional groups</label>
<div class="controls col-sm-8">
<select class="form-control multiselect" id="<?php echo $field_ad_gid; ?>" name="<?php echo $field_ad_gid; ?>[]" multiple="multiple">
<?php reset ($groups); while (list($g_gid, $g_group) = each($groups)) { ?>
<?php reset ($groups); foreach ($groups as $g_gid => $g_group) { ?>
<option value="<?php echo $g_gid; ?>" <?php if (array_key_exists($g_gid, $ad_gid)) { echo 'selected="selected"'; } ?>><?php echo $g_group; ?></option>
<?php } ?>
</select>
Expand Down
84 changes: 42 additions & 42 deletions edit_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
$errormsg = 'Group update failed; check log files.';
}
} else {
$errormsg = implode($errors, "<br />\n");
$errormsg = implode("<br />\n", $errors);
}
}

Expand All @@ -88,6 +88,45 @@
<?php include ("includes/messages.php"); ?>

<?php if (is_array($group)) { ?>
<!-- Edit panel -->
<div class="col-xs-12 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" href="#groupprops" aria-expanded="true" aria-controls="groupprops">Group properties</a>
</h3>
</div>
<div class="panel-body collapse in" id="groupprops" aria-expanded="true">
<div class="col-sm-12">
<form role="form" class="form-horizontal" method="post" data-toggle="validator">
<!-- Group name (readonly) -->
<div class="form-group">
<label for="<?php echo $cfg['field_groupname']; ?>" class="col-sm-4 control-label">Group name</label>
<div class="controls col-sm-8">
<input type="text" class="form-control" id="<?php echo $cfg['field_groupname']; ?>" name="<?php echo $cfg['field_groupname']; ?>" value="<?php echo $groupname; ?>" readonly />
</div>
</div>
<!-- GID -->
<div class="form-group">
<label for="<?php echo $cfg['field_gid']; ?>" class="col-sm-4 control-label">New GID</label>
<div class="col-sm-8">
<input type="number" class="form-control" id="new_<?php echo $cfg['field_gid']; ?>" name="new_<?php echo $cfg['field_gid']; ?>" value="<?php echo $gid; ?>" placeholder="Enter the new GID" min="1" required />
<p class="help-block"><small>Positive integer.</small></p>
</div>
</div>
<!-- Actions -->
<div class="form-group">
<div class="col-sm-12">
<input type="hidden" name="<?php echo $field_gid; ?>" value="<?php echo $gid; ?>" />
<a class="btn btn-danger" href="remove_group.php?action=remove&<?php echo $field_gid; ?>=<?php echo $gid; ?>">Remove group</a>
<button type="submit" class="btn btn-primary pull-right" role="group" name="action" value="update">Update group</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Users panel -->
<div class="col-xs-12 col-sm-6">
<div class="panel panel-default">
Expand All @@ -111,7 +150,7 @@
<th data-defaultsort="disabled"></th>
</thead>
<tbody>
<?php reset($users_main); while (list($u_id, $u_userid) = each($users_main)) {
<?php reset($users_main); foreach ($users_main as $u_id => $u_userid) {
$user = $ac->get_user_by_id($u_id); ?>
<tr>
<td class="pull-middle"><?php echo $user[$field_uid]; ?></td>
Expand Down Expand Up @@ -141,7 +180,7 @@
<th data-defaultsort="disabled"></th>
</thead>
<tbody>
<?php reset($users_add); while (list($u_id, $u_userid) = each($users_add)) {
<?php reset($users_add); foreach ($users_add as $u_id => $u_userid) {
$user = $ac->get_user_by_id($u_id); ?>
<tr>
<td class="pull-middle"><?php echo $user[$field_uid]; ?></td>
Expand All @@ -162,45 +201,6 @@
</div>
</div>
</div>
<!-- Edit panel -->
<div class="col-xs-12 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" href="#groupprops" aria-expanded="true" aria-controls="groupprops">Group properties</a>
</h3>
</div>
<div class="panel-body collapse in" id="groupprops" aria-expanded="true">
<div class="col-sm-12">
<form role="form" class="form-horizontal" method="post" data-toggle="validator">
<!-- Group name (readonly) -->
<div class="form-group">
<label for="<?php echo $cfg['field_groupname']; ?>" class="col-sm-4 control-label">Group name</label>
<div class="controls col-sm-8">
<input type="text" class="form-control" id="<?php echo $cfg['field_groupname']; ?>" name="<?php echo $cfg['field_groupname']; ?>" value="<?php echo $groupname; ?>" readonly />
</div>
</div>
<!-- GID -->
<div class="form-group">
<label for="<?php echo $cfg['field_gid']; ?>" class="col-sm-4 control-label">New GID</label>
<div class="col-sm-8">
<input type="number" class="form-control" id="new_<?php echo $cfg['field_gid']; ?>" name="new_<?php echo $cfg['field_gid']; ?>" value="<?php echo $gid; ?>" placeholder="Enter the new GID" min="1" required />
<p class="help-block"><small>Positive integer.</small></p>
</div>
</div>
<!-- Actions -->
<div class="form-group">
<div class="col-sm-12">
<input type="hidden" name="<?php echo $field_gid; ?>" value="<?php echo $gid; ?>" />
<a class="btn btn-danger" href="remove_group.php?action=remove&<?php echo $field_gid; ?>=<?php echo $gid; ?>">Remove group</a>
<button type="submit" class="btn btn-primary pull-right" role="group" name="action" value="update">Update group</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php } ?>

<?php include ("includes/footer.php"); ?>
Loading