diff options
| -rw-r--r-- | admin_masquerade.php | 53 | ||||
| -rw-r--r-- | themes/_administration/header.php | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/admin_masquerade.php b/admin_masquerade.php new file mode 100644 index 0000000000..eafccc21d5 --- /dev/null +++ b/admin_masquerade.php @@ -0,0 +1,53 @@ +<?php +// Masquerade as another user +// +// webtrees: Web based Family History software +// Copyright (C) 2013 webtrees development team. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// $Id: admin_modules.php 14786 2013-02-06 22:28:50Z greg $ + +const WT_SCRIPT_NAME = 'admin_masquerade.php'; + +require 'includes/session.php'; +require 'includes/functions/functions_edit.php'; + +$controller=new WT_Controller_Page(); +$controller + ->requireAdminLogin() + ->setPageTitle(/* I18N: verb - pretend to be someone else */ WT_I18N::translate('Masquerade')); + +$all_users = get_all_users('ASC', 'username'); + +$user_id = filter_input(INPUT_POST, 'user_id', FILTER_VALIDATE_INT); + +if (array_key_exists($user_id, $all_users)) { + $WT_SESSION->wt_user = $user_id; + Zend_Session::regenerateId(); + Zend_Session::writeClose(); + header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'index.php'); + exit; +} + +$controller->pageHeader(); +?> + +<h2><?php echo WT_I18N::translate('Masquerade as another user'); ?></h2> + +<form method="post" action="<?php echo WT_SCRIPT_NAME; ?>"> + <?php echo select_edit_control('user_id', $all_users, null, null); ?> + <input type="submit" value="<?php echo WT_I18N::translate('continue'); ?>"> +</form> diff --git a/themes/_administration/header.php b/themes/_administration/header.php index aac01d7b89..6fbfe25a92 100644 --- a/themes/_administration/header.php +++ b/themes/_administration/header.php @@ -127,6 +127,7 @@ if (WT_USER_IS_ADMIN) { '<li><ul>', '<li><a ', (WT_SCRIPT_NAME=="admin_users.php" && safe_GET('action')=="createform" ? 'class="current" ' : ''), 'href="admin_users.php?action=createform">', WT_I18N::translate('Add a new user'), '</a></li>', '<li><a ', (WT_SCRIPT_NAME=="admin_users_bulk.php" ? 'class="current" ' : ''), 'href="admin_users_bulk.php">', WT_I18N::translate('Send broadcast messages'), '</a>', + '<li><a ', (WT_SCRIPT_NAME=="admin_masquerade.php" ? 'class="current" ' : ''), 'href="admin_masquerade.php">', WT_I18N::translate('Masquerade'), '</a>', '<li><a ', (WT_SCRIPT_NAME=="admin_users.php" && safe_GET('action')=="cleanup" ? 'class="current" ' : ''), 'href="admin_users.php?action=cleanup">', WT_I18N::translate('Delete inactive users'), '</a></li>', '<li><a href="index_edit.php?user_id=-1" onclick="return modalDialog(\'index_edit.php?user_id=-1'.'\', \'', WT_I18N::translate('Set the default blocks for new users'), '\');">', WT_I18N::translate('Set the default blocks'), '</a></li>', |
