git.schokokeks.org
Repositories
Help
Report an Issue
webinterface.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
90328d5
Branches
Tags
master
ticket
webinterface.git
modules
su
su.php
JQuery/-UI integriert und Vorbereitung für ausgelagerte JS-Dateien. Su-modul testweise umgestellt.
Bernd Wurst
commited
90328d5
at 2014-02-06 18:26:10
su.php
Blame
History
Raw
<?php /* This file belongs to the Webinterface of schokokeks.org Hosting Written 2008-2013 by schokokeks.org Hosting, namely Bernd Wurst <bernd@schokokeks.org> Hanno Böck <hanno@schokokeks.org> To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/ Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code. */ require_once('inc/base.php'); require_once('inc/security.php'); require_once('inc/debug.php'); require_once('session/start.php'); require_once('su.php'); require_role(ROLE_SYSADMIN); function su($type, $id) { $role = NULL; $admin_user = $_SESSION['userinfo']['username']; $_SESSION['admin_user'] = $admin_user; $role = find_role($id, '', True); if (!$role) { unset($_SESSION['admin_user']); return False; } setup_session($role, $id); if ($type == 'c') { if (! (ROLE_CUSTOMER & $_SESSION['role'])) { session_destroy(); system_failure('Es wurde ein "su" zu einem Kundenaccount angefordert, das war aber kein Kundenaccount!'); } } elseif ($type == 'u') { if (! (ROLE_SYSTEMUSER & $_SESSION['role'])) { session_destroy(); system_failure('Es wurde ein "su" zu einem Benutzeraccount angefordert, das war aber kein Benutzeraccount!'); } } elseif ($type) { // wenn type leer ist, dann ist es auch egal system_failure('unknown type'); } redirect('../../go/index/index'); die(); } if (isset($_GET['do'])) { if ($_SESSION['su_ajax_timestamp'] < time() - 30) { system_failure("Die su-Auswahl ist schon abgelaufen!"); } $type = $_GET['do'][0]; $id = (int) substr($_GET['do'], 1); su($type, $id); } $search = NULL; if (isset($_POST['query'])) { check_form_token('su_su'); $id = filter_input_general($_POST['query']); if (! su(NULL, $id)) { $search = $_POST['query']; } } title("Benutzer wechseln"); output('<p>Hiermit können Sie (als Admin) das Webinterface mit den Rechten eines beliebigen anderen Benutzers benutzen.</p> '); $debug = ''; if ($debugmode) $debug = 'debug&'; require_once('inc/jquery.php'); // lädt die JS-Datei mit gleichem basename javascript(); output(html_form('su_su', '', '', '<p><label for="query"><strong>Suchtext:</strong></label> <input type="text" name="query" id="query" /> <input type="submit" value="Suchen" /></p> ')); if ($search) { $allentries = build_results($search); foreach ($allentries as $entry) { output(" <p><a href=\"?do=".filter_input_general($entry['id'])."\">".filter_input_general($entry['value'])."</a></p>"); } }