Пример #1
0
    return array_filter($error);
}
if (isset($_POST['newusersubmit']) || isset($_POST['newmachinesubmit'])) {
    // Fill details from form
    if (isset($_POST['newusersubmit'])) {
        $type = 'User';
    }
    if (isset($_POST['newmachinesubmit'])) {
        $type = 'Computer';
    }
    if ($type == 'User') {
        $user['Username'] = \Grase\Clean::username($_POST['Username']);
        $user['Password'] = \Grase\Clean::text($_POST['Password']);
    }
    if ($type == 'Computer') {
        $user['Username'] = \Grase\Clean::username($_POST['mac']);
        $user['mac'] = $user['Username'];
        $user['Password'] = DatabaseFunctions::getInstance()->getChilliConfigSingle('macpasswd');
    }
    $user['MaxMb'] = $_POST['MaxMb'];
    $user['Max_Mb'] = clean_number($_POST['Max_Mb']);
    if ($_POST['Max_Mb'] == 'inherit') {
        $user['Max_Mb'] = 'inherit';
    }
    $user['MaxTime'] = $_POST['MaxTime'];
    $user['Max_Time'] = clean_int($_POST['Max_Time']);
    if ($_POST['Max_Time'] == 'inherit') {
        $user['Max_Time'] = 'inherit';
    }
    $user['Group'] = \Grase\Clean::text($_POST['Group']);
    $user['Expiration'] = expiry_for_group(\Grase\Clean::text($_POST['Group']));
Пример #2
0
     DatabaseFunctions::getInstance()->setUserComment($username, \Grase\Clean::text($_POST['Comment']));
     // TODO: Check return for success
     $success[] = T_("Comment Changed");
     AdminLog::getInstance()->log("Comment changed for {$username}");
 }
 // Lock/Unlock update
 if (\Grase\Clean::text($_POST['LockReason']) != $user['LockReason']) {
     if (\Grase\Clean::text($_POST['LockReason']) == '') {
         DatabaseFunctions::getInstance()->unlockUser($username);
         $success[] = T_("User Account Unlocked");
         AdminLog::getInstance()->log("Account {$username} unlocked");
     } else {
         // Using \Grase\Clean::username as the LockReason is processed by JSON from CoovaChilli from Radius and so ' and " don't carry well
         DatabaseFunctions::getInstance()->lockUser($username, \Grase\Clean::username($_POST['LockReason']));
         $success[] = T_("User Account Locked");
         AdminLog::getInstance()->log("Account {$username} locked: " . \Grase\Clean::username($_POST['LockReason']));
     }
 }
 // Increase Data Limit
 if ($addMb) {
     if (!\Grase\Validate::numericLimit($addMb)) {
         $error[] = sprintf(T_("Invalid value '%s' for Data Limit"), $addMb);
     } else {
         DatabaseFunctions::getInstance()->increaseUserDatalimit($username, $addMb);
         DatabaseFunctions::getInstance()->setUserExpiry($username, expiry_for_group(DatabaseFunctions::getInstance()->getUserGroup($username)));
         // TODO: Check return for success
         $success[] = T_("Data Limit Increased");
         AdminLog::getInstance()->log(sprintf(T_("Data Limit increased for %s"), $username));
     }
 }
 // If Data Limit is changed and Not added too, Change Data Limit