3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2010, StatusNet, Inc.
12 * @author Evan Prodromou <evan@status.net>
13 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
14 * @link http://status.net/
16 * This program is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU Affero General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU Affero General Public License for more details.
26 * You should have received a copy of the GNU Affero General Public License
27 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 if (!defined('STATUSNET')) {
35 * Prints out a static robots.txt
39 * @author Evan Prodromou <evan@status.net>
40 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
41 * @link http://status.net/
43 class RobotstxtAction extends Action
48 * Since this is a relatively static document, we
49 * don't do a prepare()
51 * @param array $args GET, POST, and URL params; unused.
55 function handle($args)
57 if (Event::handle('StartRobotsTxt', array($this))) {
59 header('Content-Type: text/plain');
61 print "User-Agent: *\n";
63 if (common_config('site', 'private')) {
65 print "Disallow: /\n";
67 $disallow = common_config('robotstxt', 'disallow');
69 foreach ($disallow as $dir) {
70 print "Disallow: /$dir/\n";
73 $crawldelay = common_config('robotstxt', 'crawldelay');
75 if (!empty($crawldelay)) {
76 print "Crawl-delay: " . $crawldelay . "\n";
80 Event::handle('EndRobotsTxt', array($this));
85 * Return true; this page doesn't touch the DB.
87 * @param array $args other arguments
89 * @return boolean is read only action?
91 function isReadOnly($args)