summaryrefslogtreecommitdiffstats
path: root/apps/external/ajax/setsites.php
blob: c14daa258c12f914783123b0b52d9003380d67f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

/**
 * Copyright (c) 2011, Frank Karlitschek <karlitschek@kde.org>
 * This file is licensed under the Affero General Public License version 3 or later.
 * See the COPYING-README file.
 */

 
OCP\User::checkAdminUser();

$sites = array();
for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {
	if (!empty($_POST['site_name'][$i]) && !empty($_POST['site_url'][$i])) {
		array_push($sites, array($_POST['site_name'][$i], $_POST['site_url'][$i]));
	}
}

if (sizeof($sites) == 0)
	OC_Appconfig::deleteKey('external', 'sites');
else
	OCP\Config::setAppValue('external', 'sites', json_encode($sites));

echo 'true';
?>