3 * Laconica, the distributed open-source microblogging tool
5 * Laconica extensions to the Twitter-like API for groups
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Craig Andrews
25 * @author Zach Copley <zach@controlyourself.ca>
26 * @copyright 2009 Control Yourself, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://laconi.ca/
31 if (!defined('LACONICA')) {
35 require_once INSTALLDIR.'/lib/twitterapi.php';
38 * Group-specific API methods
40 * This class handles Laconica group API methods.
44 * @author Craig Andrews
45 * @author Zach Copley <zach@controlyourself.ca>
46 * @copyright 2009 Control Yourself, Inc.
47 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
48 * @link http://laconi.ca/
51 class TwitapitagsAction extends TwitterapiAction
54 function timeline($args, $apidata)
56 parent::handle($args);
58 common_debug("in tags api action");
60 $this->auth_user = $apidata['user'];
61 $tag = $apidata['api_arg'];
64 $this->clientError('Not Found', 404, $apidata['content-type']);
68 $sitename = common_config('site', 'name');
69 $title = sprintf(_("Notices tagged with %s"), $tag);
70 $taguribase = common_config('integration', 'taguri');
71 $id = "tag:$taguribase:TagTimeline:".$tag;
72 $link = common_local_url('tag',
73 array('tag' => $tag));
74 $subtitle = sprintf(_('Updates tagged with %1$s on %2$s!'),
77 $page = (int)$this->arg('page', 1);
78 $count = (int)$this->arg('count', 20);
79 $max_id = (int)$this->arg('max_id', 0);
80 $since_id = (int)$this->arg('since_id', 0);
81 $since = $this->arg('since');
83 # XXX: support max_id, since_id, and since arguments
84 $notice = Notice_tag::getStream($tag, ($page-1)*$count, $count + 1);
86 switch($apidata['content-type']) {
88 $this->show_xml_timeline($notice);
91 $this->show_rss_timeline($notice, $title, $link, $subtitle);
94 if (isset($apidata['api_arg'])) {
95 $selfuri = common_root_url() .
96 'api/laconica/tags/timeline/' .
97 $apidata['api_arg'] . '.atom';
99 $selfuri = common_root_url() .
100 'api/laconica/tags/timeline.atom';
102 $this->show_atom_timeline($notice, $title, $id, $link,
103 $subtitle, null, $selfuri);
106 $this->show_json_timeline($notice);
109 $this->clientError(_('API method not found!'), $code = 404);