logout.php 1.23 KB
Newer Older
Evan Prodromou's avatar
Evan Prodromou committed
1
<?php
Evan Prodromou's avatar
Evan Prodromou committed
2
/*
3 4
 * Laconica - a distributed open-source microblogging tool
 * Copyright (C) 2008, Controlez-Vous, Inc.
Evan Prodromou's avatar
Evan Prodromou committed
5
 *
6 7 8 9
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
Evan Prodromou's avatar
Evan Prodromou committed
10
 *
11 12 13 14
 * 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 Affero General Public License for more details.
Evan Prodromou's avatar
Evan Prodromou committed
15
 *
16 17 18 19
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

20
if (!defined('LACONICA')) { exit(1); }
Evan Prodromou's avatar
Evan Prodromou committed
21

22 23
require_once(INSTALLDIR.'/lib/openid.php');

Evan Prodromou's avatar
Evan Prodromou committed
24
class LogoutAction extends Action {
25 26 27 28 29
	
	function is_readonly() {
		return true;
	}
	
Evan Prodromou's avatar
Evan Prodromou committed
30 31 32
	function handle($args) {
		parent::handle($args);
		if (!common_logged_in()) {
33
			common_user_error(_('Not logged in.'));
Evan Prodromou's avatar
Evan Prodromou committed
34
		} else {
35
			common_set_user(NULL);
36
			common_real_login(false); # not logged in
37
			common_forgetme(); # don't log back in!
38
			common_redirect(common_local_url('public'));
Evan Prodromou's avatar
Evan Prodromou committed
39 40 41
		}
	}
}