setsites.php 626 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * 2012 Frank Karlitschek frank@owncloud.org
  4. * This file is licensed under the Affero General Public License version 3 or later.
  5. * See the COPYING-README file.
  6. */
  7. OCP\User::checkAdminUser();
  8. $sites = array();
  9. for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {
  10. if (!empty($_POST['site_name'][$i]) && !empty($_POST['site_url'][$i])) {
  11. array_push($sites, array(strip_tags($_POST['site_name'][$i]), strip_tags($_POST['site_url'][$i])));
  12. }
  13. }
  14. if (sizeof($sites) == 0)
  15. OC_Appconfig::deleteKey('external', 'sites');
  16. else
  17. OCP\Config::setAppValue('external', 'sites', json_encode($sites));
  18. echo 'true';
  19. ?>