remote.php 771 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. $RUNTIME_NOSETUPFS = true;
  3. $RUNTIME_NOAPPS = TRUE;
  4. require_once('lib/base.php');
  5. if (array_key_exists('PATH_INFO', $_SERVER)){
  6. $path_info = $_SERVER['PATH_INFO'];
  7. }else{
  8. $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
  9. }
  10. if ($path_info === false) {
  11. OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
  12. exit;
  13. }
  14. if (!$pos = strpos($path_info, '/', 1)) {
  15. $pos = strlen($path_info);
  16. }
  17. $service=substr($path_info, 1, $pos-1);
  18. $file = OC_AppConfig::getValue('core', 'remote_' . $service);
  19. if(is_null($file)){
  20. OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
  21. exit;
  22. }
  23. $parts=explode('/',$file);
  24. $app=$parts[2];
  25. OC_App::loadApp($app);
  26. $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
  27. require_once(OC::$APPSROOT . $file);