1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
<?php
/* OpenDb - Open Media Lending Database
Copyright (C) 2001,2002 by Jason Pell
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.
*/
// This must be first - includes config.php
require_once("./include/begin.inc.php");
include_once("./functions/database.php");
include_once("./functions/auth.php");
include_once("./functions/logging.php");
include_once("./functions/widgets.php");
include_once("./functions/http.php");
include_once("./functions/importcache.php");
if($CONFIG_VARS['site.enable']!==FALSE)
{
session_start();
if($CONFIG_VARS['login.enable_change_user']!==FALSE &&
strlen($HTTP_SESSION_VARS['admin_user_id'])>0 &&
is_user_admin($HTTP_SESSION_VARS['admin_user_id']))
{
opendb_log("Administrator logged out change user (admin_user_id=".$HTTP_SESSION_VARS['admin_user_id'].", user_id=".$HTTP_SESSION_VARS['user_id'].")");
$user_r = fetch_user_r($HTTP_SESSION_VARS['admin_user_id']);
$HTTP_SESSION_VARS['user_id'] = $HTTP_SESSION_VARS['admin_user_id'];
$HTTP_SESSION_VARS['user_language'] = $user_r['language'];
$HTTP_SESSION_VARS['user_theme'] = $user_r['theme'];
$HTTP_SESSION_VARS['user_type'] = $user_r['type'];
if(is_register_globals_enabled())
{
session_register("user_id");
session_register("user_language");
session_register("user_type");
session_register("user_theme");
$user_id = $HTTP_SESSION_VARS['user_id'];
$user_language = $HTTP_SESSION_VARS['user_language'];
$user_theme = $HTTP_SESSION_VARS['user_theme'];
$user_type = $HTTP_SESSION_VARS['user_type'];
}
if(is_register_globals_enabled())
{
// PHP manual suggests unregistering these
session_unregister("admin_user_id");
}
$HTTP_SESSION_VARS['admin_user_id'] = NULL;
// invalid login, so login instead.
header('Location: ' . urldecode('./login.php'));
}
else
{
opendb_log("User logged out (user_id=".$HTTP_SESSION_VARS['user_id'].")");
// delete import cache records for user.
if(strlen($HTTP_SESSION_VARS['user_id'])>0 && import_cache_check_is_installed())
{
import_cache_delete_for_user($HTTP_SESSION_VARS['user_id']);
}
if(is_register_globals_enabled())
{
// PHP manual suggests unregistering these
session_unregister("user_id");
session_unregister("user_type");
session_unregister("user_theme");
session_unregister("user_language");
session_unregister("hash_check");
session_unregister("login_time");
session_unregister("last_access_time");
}
// Explicitly set to null!
$HTTP_SESSION_VARS['user_id'] = NULL;
$HTTP_SESSION_VARS['user_theme'] = NULL;
$HTTP_SESSION_VARS['user_language'] = NULL;
$HTTP_SESSION_VARS['user_type'] = NULL;
$HTTP_SESSION_VARS['hash_check'] = NULL;
$HTTP_SESSION_VARS['login_time'] = NULL;
$HTTP_SESSION_VARS['last_access_time'] = NULL;
// close session
session_destroy();
include_once("./include/language.php");
include_once("./include/theme.php");
// No session variables available once logged out!!!
echo _theme_header($LANG_VARS['logout'], $CONFIG_VARS['logout.show_menu']!==FALSE);
echo("<h2>".$LANG_VARS['logout']."</h2>");
// In some cases this will cause menu frame to be refreshed.
echo _theme_refresh_menu();
echo("<div class=\"colortext\">");
$myid = session_id();// double check for any errors
if( $myid=="")
echo("<p>".replace_lang_var("site", $CONFIG_VARS['site.title']." ".$CONFIG_VARS['site.version'], $LANG_VARS['thanks_for_using'])."</p>\n");
else
echo("<p>".$LANG_VARS['unable_to_logout']."</p>\n");
echo("<br>");
echo("</div>");
echo format_footer_links(array(array(url=>"login.php",text=>$LANG_VARS['return_to_login_page'])));
// No session variables available once logged out!!!
echo _theme_footer();
}
}//if($CONFIG_VARS['site.enable']!==FALSE)
else
{
echo _theme_header($LANG_VARS['site_is_disabled'], FALSE);
echo _theme_error($LANG_VARS['site_is_disabled']);
echo _theme_footer();
}
// Cleanup after begin.inc.php
require_once("./include/end.inc.php");
?>
|