appconfig.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
  4. * This file is licensed under the Affero General Public License version 3 or later.
  5. * See the COPYING-README file.
  6. */
  7. require_once ("../../lib/base.php");
  8. OC_Util::checkAdminUser();
  9. OCP\JSON::callCheck();
  10. $action=isset($_POST['action'])?$_POST['action']:$_GET['action'];
  11. $result=false;
  12. switch($action){
  13. case 'getValue':
  14. $result=OC_Appconfig::getValue($_GET['app'],$_GET['key'],$_GET['defaultValue']);
  15. break;
  16. case 'setValue':
  17. $result=OC_Appconfig::setValue($_POST['app'],$_POST['key'],$_POST['value']);
  18. break;
  19. case 'getApps':
  20. $result=OC_Appconfig::getApps();
  21. break;
  22. case 'getKeys':
  23. $result=OC_Appconfig::getKeys($_GET['app']);
  24. break;
  25. case 'hasKey':
  26. $result=OC_Appconfig::hasKey($_GET['app'],$_GET['key']);
  27. break;
  28. case 'deleteKey':
  29. $result=OC_Appconfig::deleteKey($_POST['app'],$_POST['key']);
  30. break;
  31. case 'deleteApp':
  32. $result=OC_Appconfig::deleteApp($_POST['app']);
  33. break;
  34. }
  35. OC_JSON::success(array('data'=>$result));