2008-11-14 05:21:47 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.");
|
|
|
|
|
/**
|
|
|
|
|
* Gallery - a web based photo album viewer and editor
|
2009-05-13 20:04:58 +00:00
|
|
|
* Copyright (C) 2000-2009 Bharat Mediratta
|
2008-11-14 05:21:47 +00:00
|
|
|
*
|
|
|
|
|
* 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
class Logout_Controller extends Controller {
|
|
|
|
|
public function index() {
|
2010-01-04 21:37:51 -08:00
|
|
|
access::verify_csrf();
|
2009-10-30 09:32:18 -07:00
|
|
|
auth::logout();
|
2009-12-21 21:27:43 -08:00
|
|
|
if ($continue_url = Input::instance()->get("continue")) {
|
2009-07-21 13:02:20 -07:00
|
|
|
$item = url::get_item_from_uri($continue_url);
|
2009-06-09 21:35:35 +08:00
|
|
|
if (access::can("view", $item)) {
|
2009-07-21 13:02:20 -07:00
|
|
|
// Don't use url::redirect() because it'll call url::site() and munge the continue url.
|
|
|
|
|
header("Location: $continue_url");
|
2009-06-09 21:35:35 +08:00
|
|
|
} else {
|
2009-09-10 21:31:50 -07:00
|
|
|
url::redirect(item::root()->abs_url());
|
2009-06-09 21:35:35 +08:00
|
|
|
}
|
2008-11-15 06:23:09 +00:00
|
|
|
}
|
2008-11-14 05:21:47 +00:00
|
|
|
}
|
|
|
|
|
}
|