Marius Cramer
2015-08-06 37b29231e47a0c4458dc1c15d98588f16f07e1e2
commit | author | age
b5a2f8 1 <?php
T 2 /*
3 Copyright (c) 2005, Till Brehm, projektfarm Gmbh
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without modification,
7 are permitted provided that the following conditions are met:
8
9     * Redistributions of source code must retain the above copyright notice,
10       this list of conditions and the following disclaimer.
11     * Redistributions in binary form must reproduce the above copyright notice,
12       this list of conditions and the following disclaimer in the documentation
13       and/or other materials provided with the distribution.
14     * Neither the name of ISPConfig nor the names of its contributors
15       may be used to endorse or promote products derived from this software without
16       specific prior written permission.
17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
7fe908 30 require_once '../../lib/config.inc.php';
MC 31 require_once '../../lib/app.inc.php';
b5a2f8 32
5c4970 33 /*
V 34  * Check if the logout is forced
35  */
36 $forceLogout = false;
37 if (isset($_GET['l']) && ($_GET['l']== 1)) $forceLogout = true;
38
39 /*
40  * if the admin is logged in as client, then ask, if the admin want't to
41  * "re-login" as admin again
42  */
c6f36f 43 if ((isset($_SESSION['s_old']) && ($_SESSION['s_old']['user']['typ'] == 'admin' || $app->auth->has_clients($_SESSION['s_old']['user']['userid']))) &&
5c4970 44     (!$forceLogout)){
c6f36f 45     $utype = ($_SESSION['s_old']['user']['typ'] == 'admin' ? 'admin' : 'reseller');
0998a3 46     $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_login_as.lng';
MC 47     include $lng_file;
5c4970 48     echo '
V 49         <br /> <br />    <br /> <br />
0998a3 50         '.str_replace('{UTYPE}', $utype, $wb['login_as_or_logout_txt']).'<br />
5c4970 51         <div style="visibility:hidden">
V 52             <input type="text" name="username" value="' . $_SESSION['s_old']['user']['username'] . '" />
53             <input type="password" name="passwort" value="' . $_SESSION['s_old']['user']['passwort'] .'" />
54         </div>
55         <input type="hidden" name="s_mod" value="login" />
56         <input type="hidden" name="s_pg" value="index" />
57         <div class="wf_actions buttons">
c6f36f 58           <button class="positive iconstxt icoPositive" type="button" value="Yes, re-login as ' . $utype . '" onclick="submitLoginForm(' . "'pageForm'" . ');"><span>Yes, re-login as ' . $utype . '</span></button>
9021d7 59           <button class="negative iconstxt icoNegative" type="button" value="No, logout" data-load-content="login/logout.php?l=1"><span>No, logout</span></button>
5c4970 60         </div>
V 61     ';
62     exit;
63 }
64
7fe908 65 $app->plugin->raiseEvent('logout', true);
da1da4 66
b5a2f8 67 $_SESSION["s"]["user"] = null;
T 68 $_SESSION["s"]["module"] = null;
5c4970 69 $_SESSION['s_old'] = null;
b5a2f8 70
T 71 //header("Location: ../index.php?phpsessid=".$_SESSION["s"]["id"]);
72
73 if($_SESSION["s"]["site"]["logout"] != '') {
7fe908 74     echo 'URL_REDIRECT:'.$_SESSION["s"]["site"]["logout"];
b5a2f8 75 } else {
845c3e 76     if($conf["interface_logout_url"] != '') {
7fe908 77         echo 'URL_REDIRECT:'.$conf["interface_logout_url"];
845c3e 78     } else {
7fe908 79         echo 'URL_REDIRECT:index.php';
845c3e 80     }
b5a2f8 81 }
25c72d 82 // Destroy the session completely now
N 83 $_SESSION = array();
84 session_destroy();
85 session_write_close();
86 ?>