richdocuments/ajax/admin.php
2014-03-31 20:27:07 +03:00

34 lines
725 B
PHP

<?php
namespace OCA\Documents;
\OCP\JSON::callCheck();
\OCP\JSON::checkAdminUser();
$l10n = \OCP\Util::getL10N('documents');
$converter = isset($_POST['converter']) ? $_POST['converter'] : null;
$url = isset($_POST['url']) ? $_POST['url'] : null;
try {
if (!is_null($converter)){
Config::setConverter($converter);
}
if (!is_null($url)){
Config::setConverterUrl($url);
}
if (Config::getConverter()!='local'){
if (!Converter::checkConnection()){
Helper::warnLog('Bad response from Format Filter Server');
\OCP\JSON::error(array('message' => $l10n->t('Format filter server is down or misconfigured') ));
exit();
}
}
\OCP\JSON::success();
} catch (\Exception $e){
\OCP\JSON::error();
}
exit();