3 * Superclass for actions that operate on a user
7 * StatusNet - the distributed open-source microblogging tool
8 * Copyright (C) 2009, StatusNet, Inc.
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Affero General Public License for more details.
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 * @author Evan Prodromou <evan@status.net>
26 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
27 * @link http://status.net/
30 if (!defined('STATUSNET') && !defined('LACONICA')) {
35 * Superclass for actions that operate on a user
39 * @author Evan Prodromou <evan@status.net>
40 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
41 * @link http://status.net/
44 class ProfileFormAction extends RedirectingAction
49 * Take arguments for running
51 * @param array $args $_REQUEST args
53 * @return boolean success flag
56 function prepare($args)
58 parent::prepare($args);
60 $this->checkSessionToken();
62 if (!common_logged_in()) {
63 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
64 $this->clientError(_('Not logged in.'));
67 common_set_returnto($this->selfUrl());
68 $user = common_current_user();
69 if (Event::handle('RedirectToLogin', array($this, $user))) {
70 common_redirect(common_local_url('login'), 303);
76 $id = $this->trimmed('profileid');
79 $this->clientError(_('No profile specified.'));
83 $this->profile = Profile::staticGet('id', $id);
85 if (!$this->profile) {
86 $this->clientError(_('No profile with that ID.'));
96 * Shows a page with list of favorite notices
98 * @param array $args $_REQUEST args; handled in prepare()
103 function handle($args)
105 parent::handle($args);
107 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
109 $this->returnToPrevious();
114 * handle a POST request
116 * sub-classes should overload this request
121 function handlePost()
123 $this->serverError(_("Unimplemented method."));