<?php
/**
 * ownCloud
 *
 * @author Thomas Müller <deepdiver@owncloud.com>
 * @author Dominik Schmidt <dschmidt@owncloud.com>
 * @copyright (C) 2014-2018 ownCloud GmbH
 *
 * This code is covered by the ownCloud Commercial License.
 *
 * You should have received a copy of the ownCloud Commercial License
 * along with this program. If not, see <https://owncloud.com/licenses/owncloud-commercial/>.
 *
 */

require __DIR__ . '/vendor/autoload.php';

try {
	$oem = Utility::get_array_item_or($_GET, 'oem', 'ownCloud');

	$configBaseDir = __DIR__ . '/config';
	$loader = new ConfigLoader($configBaseDir);

	$platformDetector = new PlatformDetector();
	$platform = $platformDetector->detectPlatform($_GET);
	$config = $loader->loadConfig($oem, $platform);

	$checker = new ClientUpdateChecker($config, $_GET);
	$updateInfo = $checker->getUpdateInformation();

	$renderer = new XmlResponseRenderer($updateInfo, $_GET);
	$renderer->sendRenderedOutput();
} catch (Exception $e) {
	echo \htmlspecialchars($e->getMessage());
}
