Exemple #1
0
}
if (!empty($_POST['change_pwd'])) {
    if (Password::isForbidden($_POST['change_pwd'])) {
        echo '<div class="item">Weak password was chosen, password has not been changed!</div>';
        return;
    }
    UserHandler::setPassword($user->id, $_POST['change_pwd']);
    echo '<div class="item">Password changed!</div>';
    return;
}
if (!empty($_POST['setting_name']) && isset($_POST['setting_val'])) {
    UserSetting::set($user->id, $_POST['setting_name'], $_POST['setting_val']);
    echo '<div class="good">Setting added!</div>';
}
if (!empty($_GET['remove_setting'])) {
    UserSetting::delete($user->id, $_GET['remove_setting']);
    echo '<div class="good">Setting removed!</div>';
}
// save changes in edited settings
if (!empty($_POST)) {
    $settings = UserSetting::getAll($user->id);
    foreach ($settings as $set) {
        if (!empty($_POST['setting_name_' . $set['id']])) {
            UserSetting::set($user->id, $_POST['setting_name_' . $set['id']], $_POST['setting_val_' . $set['id']]);
        }
    }
}
if (!empty($_POST['grp_id'])) {
    UserGroupHandler::addToGroup($user->id, $_POST['grp_id']);
}
if (!empty($_GET['rm_grp'])) {