10 * @author Zach Copley <zach@status.net>
11 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
12 * @link http://status.net/
14 * StatusNet - the distributed open-source microblogging tool
15 * Copyright (C) 2009, StatusNet, Inc.
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU Affero General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Affero General Public License for more details.
27 * You should have received a copy of the GNU Affero General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 if (!defined('STATUSNET')) {
35 class RSSCloudRequestNotifyAction extends Action
41 * @param array $args Web and URL arguments
43 * @return boolean false if user doesn't exist
45 function prepare($args)
47 parent::prepare($args);
51 function handle($args)
53 parent::handle($args);
55 if ($_SERVER['REQUEST_METHOD'] != 'POST') {
56 showResult(false, 'Request must be POST.');
59 $ip = $_SERVER['REMOTE_ADDR'];
61 $port = $this->arg('port');
63 if (empty($this->port)) {
67 $path = $this->arg('path');
69 if (empty($this->path)) {
73 $protocol = $this->arg('protocol');
75 if (empty($this->protocol)) {
76 $missing[] = 'protocol';
79 if (empty($this->notifyProcedure)) {
80 $missing[] = 'notifyProcedure';
83 if (!empty($missing)) {
84 $msg = 'The following parameters were missing from the request body: ' .
85 implode(',', $missing) . '.';
86 $this->showResult(false, $msg);
89 $feeds = $this->getFeeds();
92 $this->showResult(false,
93 'You must provide at least one feed url (url1, url2, url3 ... urlN).');
96 $endpoint = $ip . ':' . $port . $path;
98 foreach ($feeds as $feed) {
110 foreach ($this->args as $key => $feed ) {
111 if (preg_match('|url\d+|', $key)) {
113 // XXX: validate feeds somehow and kick bad ones out
123 function checkNotifyHandler()
128 function validateFeed()
132 function showResult($success, $msg)
135 $this->elementStart('notifyResult', array('success' => ($success) ? 'true' : 'false',