addMountPoint.php 747 B

123456789101112131415161718192021222324252627
  1. <?php
  2. OCP\JSON::checkAppEnabled('files_external');
  3. OCP\JSON::callCheck();
  4. if ($_POST['isPersonal'] == 'true') {
  5. OCP\JSON::checkLoggedIn();
  6. $isPersonal = true;
  7. } else {
  8. OCP\JSON::checkAdminUser();
  9. $isPersonal = false;
  10. }
  11. $mountPoint = $_POST['mountPoint'];
  12. $oldMountPoint = $_POST['oldMountPoint'];
  13. $class = $_POST['class'];
  14. $options = $_POST['classOptions'];
  15. $type = $_POST['mountType'];
  16. $applicable = $_POST['applicable'];
  17. if ($oldMountPoint and $oldMountPoint !== $mountPoint) {
  18. OC_Mount_Config::removeMountPoint($oldMountPoint, $type, $applicable, $isPersonal);
  19. }
  20. $status = OC_Mount_Config::addMountPoint($mountPoint, $class, $options, $type, $applicable, $isPersonal);
  21. OCP\JSON::success(array('data' => array('message' => $status)));