3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2008-2011, StatusNet, Inc.
6 * Search subscription action.
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 * @author Brion Vibber <brion@status.net>
26 * @author Evan Prodromou <evan@status.net>
27 * @copyright 2008-2010 StatusNet, Inc.
28 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
29 * @link http://status.net/
32 if (!defined('STATUSNET')) {
37 * Search unsubscription action
41 * - token: session token to prevent CSRF attacks
42 * - ajax: boolean; whether to return Ajax or full-browser results
44 * Only works if the current user is logged in.
48 * @author Evan Prodromou <evan@status.net>
49 * @author Brion Vibber <brion@status.net>
50 * @copyright 2008-2011 StatusNet, Inc.
51 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
52 * @link http://status.net/
54 class SearchunsubAction extends SearchsubAction
59 * Does the subscription and returns results.
61 * @param Array $args unused.
65 function handle($args)
67 // Throws exception on error
69 SearchSub::cancel($this->user->getProfile(),
72 if ($this->boolean('ajax')) {
73 $this->startHTML('text/xml;charset=utf-8');
74 $this->elementStart('head');
75 // TRANS: Page title when search unsubscription succeeded.
76 $this->element('title', null, _m('Unsubscribed'));
77 $this->elementEnd('head');
78 $this->elementStart('body');
79 $subscribe = new SearchSubForm($this, $this->search);
81 $this->elementEnd('body');
84 $url = common_local_url('search',
85 array('search' => $this->search));
86 common_redirect($url, 303);