} print json_encode($groups); } // Return the group data if ('get_group_data' == $ajax_action) { print json_encode($user->perm->getGroupData($group_id)); } // Return the group rights if ('get_group_rights' == $ajax_action) { print json_encode($user->perm->getGroupRights($group_id)); } // Return all users if ('get_all_users' == $ajax_action) { $users = array(); foreach ($userList as $single_user) { $user->getUserById($single_user); $users[] = array('user_id' => $user->getUserId(), 'login' => $user->getLogin()); } print json_encode($users); } // Returns all group members if ('get_all_members' == $ajax_action) { $memberList = $user->perm->getGroupMembers($group_id); $members = array(); foreach ($memberList as $single_member) { $user->getUserById($single_member); $members[] = array('user_id' => $user->getUserId(), 'login' => $user->getLogin()); } print json_encode($members); } }
</form> </div> </div> <?php } ?> <h1><a class="mainpage" href="../"><?php print $faqconfig->get('main.titleFAQ'); ?> </a></h1> <?php if (isset($auth)) { ?> <h2><?php print $PMF_LANG['ad_user_loggedin'] . $user->getUserData('display_name') . ' (' . $user->getLogin(); ?> )<br /> <?php print $PMF_LANG['ad_session_expiration']; ?> : <span id="sessioncounter">Loading...</span></h2> <nav> <ul> <li<?php print $dashboardPage ? ' class="active"' : ''; ?> ><a href="index.php"><?php print $PMF_LANG['admin_mainmenu_home']; ?>
$message .= '<p class="error">' . $errorMessages['delUser_protectedAccount'] . '</p>'; } else { ?> <h2><?php print $text['header']; ?> </h2> <div id="user_confirmDelete"> <fieldset> <legend><?php print $text['delUser']; ?> </legend> <strong><?php print $user->getLogin(); ?> </strong> <p><?php print $text['delUser_question']; ?> </p> <form action ="?action=user&user_action=delete" method="post"> <input type="hidden" name="user_id" value="<?php print $userId; ?> " /> <div class="button_row"> <input class="reset" type="submit" name="cancel" value="<?php print $text['delUser_cancel']; ?>
if ($user->perm->checkRight($user->getUserId(), 'adduser') || $user->perm->checkRight($user->getUserId(), 'edituser') || $user->perm->checkRight($user->getUserId(), 'deluser')) { $user = new PMF_User($faqConfig); switch ($ajaxAction) { case 'get_user_list': $users = []; foreach ($user->searchUsers($usersearch) as $singleUser) { $users[] = array('user_id' => $singleUser['user_id'], 'name' => $singleUser['login']); } $response->setData($users); break; case 'get_user_data': $user->getUserById($userId); $userdata = []; $userdata = $user->userdata->get('*'); $userdata['status'] = $user->getStatus(); $userdata['login'] = $user->getLogin(); $response->setData($userdata); break; case 'get_user_rights': $user->getUserById($userId); $response->setData($user->perm->getUserRights($userId)); break; case 'activate_user': $user->getUserById($userId); $user->setStatus('active'); echo json_encode($user->getStatus()); break; case 'delete_user': $user->getUserById($userId); if ($user->getStatus() == 'protected' || $userId == 1) { $message = '<p class="error">' . $PMF_LANG['ad_user_error_protectedAccount'] . '</p>';
$counter = $displayedCounter = 0; foreach ($allUsers as $userId) { $user->getUserById($userId); if ($displayedCounter >= $perPage) { continue; } $counter++; if ($counter <= $firstPage) { continue; } $displayedCounter++; $icon = ''; switch ($user->getStatus()) { case 'active': $icon = 'icon-ok'; break; case 'blocked': $icon = 'icon-lock'; break; case 'protected': $icon = 'icon-ok-sign'; break; } $templateVars['users'][] = array('id' => $user->getUserId(), 'displayName' => $user->getUserData('display_name'), 'editUrl' => '?action=user&user_id=' . $user->getUserData('user_id'), 'email' => $user->getUserData('email'), 'icon' => $icon, 'loginName' => $user->getLogin(), 'showDeleteButton' => $user->getStatus() !== 'protected', 'status' => $user->getStatus()); } $twig->loadTemplate('user/listallusers.twig')->display($templateVars); unset($templateVars, $allUsers, $numUsers, $page, $perPage, $numPages, $lastPage, $firstPage, $baseUrl, $options, $pagination, $counter, $displayedCounter, $icon); } } else { require 'noperm.php'; }
$stats = $user->getStatus(); // set new password an send email if user is switched to active if ($stats == 'blocked' && $userStatus == 'active') { $consonants = array("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "y", "z"); $vowels = array("a", "e", "i", "o", "u"); $newPassword = ''; srand((double) microtime() * 1000000); for ($i = 1; $i <= 4; $i++) { $newPassword .= $consonants[rand(0, 19)]; $newPassword .= $vowels[rand(0, 4)]; } $user->changePassword($newPassword); $mail = new PMF_Mail(); $mail->addTo($userData['email']); $mail->subject = '[%sitename%] Username / activation'; $mail->message = sprintf("\nUsername: %s\nLoginname: %s\nNew Password: %s\n\n", $userData['display_name'], $user->getLogin(), $newPassword); $result = $mail->send(); unset($mail); } if (!$user->userdata->set(array_keys($userData), array_values($userData)) or !$user->setStatus($userStatus)) { $message .= '<p class="error">' . $errorMessages['updateUser'] . '</p>'; } else { $message .= '<p class="success">' . sprintf($successMessages['updateUser'], $user->getLogin()) . '</p>'; $message .= '<script type="text/javascript">updateUser(' . $userId . ');</script>'; } } } // delete user confirmation if ($userAction == 'delete_confirm') { $message = ''; $user = new PMF_User_CurrentUser();