~ubuntu-branches/debian/wheezy/phpldapadmin/wheezy

« back to all changes in this revision

Viewing changes to htdocs/logout.php

  • Committer: Bazaar Package Importer
  • Author(s): Fabio Tranchitella
  • Date: 2010-04-10 10:12:22 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100410101222-3xyuhy4a7usewxla
Tags: 1.2.0.5-1
* New upstream release. (Closes: #571672, #549464)
* debian/po/ru.po: added. (Closes: #536402)
* applied patch to fix lintian warnings. (Closes: #531649)
* Removed debian/patches that have been merged upstream.
* Do not build-depend anymore on dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.20.2.2 2008/12/12 12:20:22 wurley Exp $
3
 
 
4
2
/**
5
 
 * For servers whose auth_type is set to 'cookie' or 'session'. Pass me
6
 
 * the server_id and I will log out the user (delete the cookie)
7
 
 *
8
 
 * Variables that come in via common.php
9
 
 *  - server_id
 
3
 * Log the user out of the application.
10
4
 *
11
5
 * @package phpLDAPadmin
 
6
 * @subpackage Page
12
7
 */
 
8
 
13
9
/**
14
10
 */
15
11
 
16
12
require './common.php';
17
13
 
18
 
if (! $ldapserver->haveAuthInfo())
19
 
        error(_('No one is logged in to that server.'),'error','index.php');
20
 
 
21
 
if (in_array($ldapserver->auth_type, array('cookie','session','http'))) {
22
 
        syslog_notice (sprintf('Logout for %s',$ldapserver->getLoggedInDN()));
23
 
        if($ldapserver->auth_type!='http')
24
 
                $ldapserver->unsetLoginDN() or error(_('Could not logout.'),'error','index.php');
25
 
        unset_lastactivity($ldapserver);
26
 
 
27
 
        @session_destroy();
28
 
 
29
 
} else
30
 
        error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)),'error','index.php');
31
 
 
32
 
system_message(array(
33
 
        'title'=>_('Logout'),
34
 
        'body'=>('Logged out successfully from server.'),
35
 
        'type'=>'info'),
36
 
        sprintf('index.php?server_id=%s',$ldapserver->server_id));
 
14
if ($app['server']->logout())
 
15
        system_message(array(
 
16
                'title'=>_('Authenticate to server'),
 
17
                'body'=>_('Successfully logged out of server.'),
 
18
                'type'=>'info'),
 
19
                sprintf('index.php?server_id=%s',$app['server']->getIndex()));
 
20
else
 
21
        system_message(array(
 
22
                'title'=>_('Failed to Logout of server'),
 
23
                'body'=>_('Please report this error to the admins.'),
 
24
                'type'=>'error'),
 
25
                sprintf('index.php?server_id=%s',$app['server']->getIndex()));
37
26
?>