Пример #1
0
        }
    }
}
// delete user
if ($userAction == 'delete') {
    $message = '';
    $user = new PMF_User();
    $userId = PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT, 0);
    $userAction = $defaultUserAction;
    if ($userId == 0) {
        $message .= '<p class="error">' . $errorMessages['delUser_noId'] . '</p>';
    } else {
        if (!$user->getUserById($userId)) {
            $message .= '<p class="error">' . $errorMessages['delUser_noId'] . '</p>';
        }
        if (!$user->deleteUser()) {
            $message .= '<p class="error">' . $errorMessages['delUser'] . '</p>';
        } else {
            // Move the categories ownership to admin (id == 1)
            $categoryHelper = new PMF_Category_Helper();
            $categoryHelper->moveOwnership($userId, 1);
            // Remove the user from groups
            if ('medium' == PMF_Configuration::getInstance()->get('main.permLevel')) {
                $oPerm = PMF_Perm::selectPerm('medium');
                $oPerm->removeFromAllGroups($userId);
            }
            $message .= '<p class="success">' . $successMessages['delUser'] . '</p>';
        }
        $userError = $user->error();
        if ($userError != "") {
            $message .= '<p>ERROR: ' . $userError . '</p>';