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 Evan Prodromou <evan@status.net>
25 * @author Zach Copley <zach@status.net>
26 * @copyright 2009 StatusNet, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://status.net/
31 if (!defined('STATUSNET')) {
35 require_once INSTALLDIR . '/lib/api.php';
38 * Gives a full dump of configuration variables for this instance
39 * of StatusNet, minus variables that may be security-sensitive (like
41 * URL: http://identi.ca/api/statusnet/config.(xml|json)
46 * @author Evan Prodromou <evan@status.net>
47 * @author Zach Copley <zach@status.net>
48 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
49 * @link http://status.net/
52 class ApiStatusnetConfigAction extends ApiAction
55 'site' => array('name', 'server', 'theme', 'path', 'logo', 'fancy', 'language',
56 'email', 'broughtby', 'broughtbyurl', 'timezone', 'closed',
57 'inviteonly', 'private', 'textlimit', 'ssl', 'sslserver', 'shorturllength'),
58 'license' => array('type', 'owner', 'url', 'title', 'image'),
59 'nickname' => array('featured'),
60 'profile' => array('biolimit'),
61 'group' => array('desclimit'),
62 'notice' => array('contentlimit'),
63 'throttle' => array('enabled', 'count', 'timespan'),
64 'xmpp' => array('enabled', 'server', 'port', 'user'),
65 'integration' => array('source')
69 * Take arguments for running
71 * @param array $args $_REQUEST args
73 * @return boolean success flag
77 function prepare($args)
79 parent::prepare($args);
86 * @param array $args $_REQUEST data (unused)
91 function handle($args)
93 parent::handle($args);
95 switch ($this->format) {
97 $this->initDocument('xml');
98 $this->elementStart('config');
100 // XXX: check that all sections and settings are legal XML elements
102 common_debug(var_export($this->keys, true));
104 foreach ($this->keys as $section => $settings) {
105 $this->elementStart($section);
106 foreach ($settings as $setting) {
107 $value = common_config($section, $setting);
108 if (is_array($value)) {
109 $value = implode(',', $value);
110 } else if ($value === false) {
112 } else if ($value === true) {
115 $this->element($setting, null, $value);
117 $this->elementEnd($section);
119 $this->elementEnd('config');
120 $this->endDocument('xml');
124 foreach ($this->keys as $section => $settings) {
125 $result[$section] = array();
126 foreach ($settings as $setting) {
127 $result[$section][$setting]
128 = common_config($section, $setting);
131 $this->initDocument('json');
132 $this->showJsonObjects($result);
133 $this->endDocument('json');
137 _('API method not found.'),
146 * Return true if read only.
150 * @param array $args other arguments
152 * @return boolean is read only action?
155 function isReadOnly($args)