* Checking permissions */ require_once "../auth/login_check.php"; loginCheck(OPEN_PROFILE_ADMINISTRATOR); require_once "../lib/Form.php"; Form::compareToken($returnLocation); require_once "../lib/Check.php"; /** * Retrieving post vars */ $idUser = intval($_POST["id_user"]); /** * Delete user */ require_once "../model/Query/User.php"; $userQ = new Query_User(); if (!$userQ->select($idUser)) { $userQ->close(); FlashMsg::add(_("That user does not exist."), OPEN_MSG_ERROR); header("Location: " . $returnLocation); exit; } $user = $userQ->fetch(); $userQ->delete($idUser); $userQ->close(); unset($userQ); /** * Redirect to $returnLocation to avoid reload problem */ FlashMsg::add(sprintf(_("User, %s, has been deleted."), $user->getLogin())); header("Location: " . $returnLocation);
if (empty($userArray)) { $content = _("There no more users to create. You must create more staff members first."); } else { $content = Form::label("id_member_login", _("Select a login to create a new user") . ": "); $content .= Form::select("id_member_login", $userArray); $tfoot = array(Form::button("new", _("Create")) . Form::generateToken()); } $tbody = array($content); /** * New user form */ echo HTML::start('form', array('method' => 'post', 'action' => '../admin/user_new_form.php')); echo Form::fieldset($legend, $tbody, isset($tfoot) ? $tfoot : null, array('id' => 'new_user')); echo HTML::end('form'); echo HTML::section(2, _("Users List:")); if (!$userQ->select()) { $userQ->close(); echo Msg::info(_("No results found.")); include_once "../layout/footer.php"; exit; } $profiles = array(OPEN_PROFILE_ADMINISTRATOR => _("Administrator"), OPEN_PROFILE_ADMINISTRATIVE => _("Administrative"), OPEN_PROFILE_DOCTOR => _("Doctor")); $thead = array(_("#"), _("Function") => array('colspan' => 6), _("Login"), _("Email"), _("Actived"), _("Profile")); $options = array(0 => array('align' => 'right'), 1 => array('align' => 'center'), 2 => array('align' => 'center'), 3 => array('align' => 'center'), 4 => array('align' => 'center'), 5 => array('align' => 'center'), 6 => array('align' => 'center'), 9 => array('align' => 'center'), 10 => array('align' => 'center')); $tbody = array(); $i = 0; while ($user = $userQ->fetch()) { /** * to protect 'big brother' user */ if ($user->getIdProfile() == OPEN_PROFILE_ADMINISTRATOR && $user->getIdUser() == 1) {