modules/su/su.php
d4b2da87
 <?php
c208bd90
 /*
 This file belongs to the Webinterface of schokokeks.org Hosting
 
cf54502a
 Written 2008-2018 by schokokeks.org Hosting, namely
c208bd90
   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.
 
2626dd47
 You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
c208bd90
 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.
 */
d4b2da87
 
1b16ffa5
 require_once('inc/base.php');
e6ce5897
 require_once('inc/security.php');
d4b2da87
 require_once('inc/debug.php');
 
 require_once('session/start.php');
 require_once('su.php');
 
 require_role(ROLE_SYSADMIN);
 
8a8065ee
 
1b16ffa5
 
2626dd47
 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);
8a8065ee
 }
d4b2da87
 
2626dd47
 $search = null;
 if (isset($_POST['query'])) {
     check_form_token('su_su');
     $id = filter_input_general($_POST['query']);
     if (! su(null, $id)) {
         $search = $_POST['query'];
     }
d4b2da87
 }
 
f2550e90
 title("Benutzer wechseln");
d4b2da87
 
f2550e90
 output('<p>Hiermit können Sie (als Admin) das Webinterface mit den Rechten eines beliebigen anderen Benutzers benutzen.</p>
fbb3a834
 ');
d4b2da87
 
1b16ffa5
 $debug = '';
2626dd47
 if ($debugmode) {
     $debug = 'debug&amp;';
 }
1b16ffa5
 
cc9efe0d
 require_once('inc/jquery.php');
90328d5f
 // lädt die JS-Datei mit gleichem basename
 javascript();
1b16ffa5
 
73aefd48
 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>
8a8065ee
 '));
1b16ffa5
 
e6ce5897
 if ($search) {
2626dd47
     $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>");
     }
e6ce5897
 }