* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiStatusnetConfigAction extends ApiAction
{
var $keys = array(
'notice' => array('contentlimit'),
'throttle' => array('enabled', 'count', 'timespan'),
'xmpp' => array('enabled', 'server', 'port', 'user'),
- 'integration' => array('source')
+ 'integration' => array('source'),
+ 'attachments' => array('uploads', 'file_quota')
);
/**
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
foreach ($this->keys as $section => $settings) {
$this->elementStart($section);
foreach ($settings as $setting) {
- $value = common_config($section, $setting);
+ $value = $this->setting($section, $setting);
if (is_array($value)) {
$value = implode(',', $value);
- } else if ((bool)$value === false) {
+ } else if ($value === false || $value == '0') {
$value = 'false';
- } else if ((bool)$value === true) {
+ } else if ($value === true || $value == '1') {
$value = 'true';
}
$result[$section] = array();
foreach ($settings as $setting) {
$result[$section][$setting]
- = common_config($section, $setting);
+ = $this->setting($section, $setting);
}
}
$this->initDocument('json');
break;
default:
$this->clientError(
+ // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'),
404,
$this->format
}
}
+ function setting($section, $key) {
+ $result = common_config($section, $key);
+ if ($key == 'file_quota') {
+ // hack: adjust for the live upload limit
+ if (common_config($section, 'uploads')) {
+ $max = ImageFile::maxFileSizeInt();
+ } else {
+ $max = 0;
+ }
+ return min($result, $max);
+ }
+ return $result;
+ }
+
/**
* Return true if read only.
*
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
return true;
}
-
}
-