3 * StatusNet, the distributed open-source microblogging tool
5 * Dump of configuration variables
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 Zach Copley <zach@status.net>
25 * @copyright 2009 StatusNet, Inc.
26 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27 * @link http://status.net/
30 if (!defined('STATUSNET')) {
34 require_once INSTALLDIR . '/lib/api.php';
37 * Gives a full dump of configuration variables for this instance
38 * of StatusNet, minus variables that may be security-sensitive (like
40 * URL: http://identi.ca/api/statusnet/config.(xml|json)
45 * @author Zach Copley <zach@status.net>
46 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
47 * @link http://status.net/
50 class ApiStatusnetConfigAction extends ApiAction
53 'site' => array('name', 'server', 'theme', 'path', 'fancy', 'language',
54 'email', 'broughtby', 'broughtbyurl', 'closed',
55 'inviteonly', 'private'),
56 'license' => array('url', 'title', 'image'),
57 'nickname' => array('featured'),
58 'throttle' => array('enabled', 'count', 'timespan'),
59 'xmpp' => array('enabled', 'server', 'user')
63 * Take arguments for running
65 * @param array $args $_REQUEST args
67 * @return boolean success flag
71 function prepare($args)
73 parent::prepare($args);
80 * @param array $args $_REQUEST data (unused)
85 function handle($args)
87 parent::handle($args);
89 switch ($this->format) {
91 $this->init_document('xml');
92 $this->elementStart('config');
94 // XXX: check that all sections and settings are legal XML elements
96 common_debug(var_export($this->keys, true));
98 foreach ($this->keys as $section => $settings) {
99 $this->elementStart($section);
100 foreach ($settings as $setting) {
101 $value = common_config($section, $setting);
102 if (is_array($value)) {
103 $value = implode(',', $value);
104 } else if ($value === false) {
106 } else if ($value === true) {
109 $this->element($setting, null, $value);
111 $this->elementEnd($section);
113 $this->elementEnd('config');
114 $this->end_document('xml');
118 foreach ($this->keys as $section => $settings) {
119 $result[$section] = array();
120 foreach ($settings as $setting) {
121 $result[$section][$setting]
122 = common_config($section, $setting);
125 $this->init_document('json');
126 $this->show_json_objects($result);
127 $this->end_document('json');
131 _('API method not found!'),