You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.5 KiB

  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @copyright 2010 Frank Karlitschek karlitschek@kde.org
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. require_once('../inc/lib_base.php');
  23. oc_require_once('HTTP/WebDAV/Server/Filesystem.php');
  24. ini_set('default_charset', 'UTF-8');
  25. #ini_set('error_reporting', '');
  26. ob_clean();
  27. if(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['REDIRECT_REMOTE_USER'])) {
  28. header('WWW-Authenticate: Basic realm="ownCloud"');
  29. header('HTTP/1.0 401 Unauthorized');
  30. die('401 Unauthorized');
  31. }
  32. $user=$_SERVER['PHP_AUTH_USER'];
  33. $passwd=$_SERVER['PHP_AUTH_PW'];
  34. if(($user==$CONFIG_ADMINLOGIN) and ($passwd==$CONFIG_ADMINPASSWORD )){
  35. $server = new HTTP_WebDAV_Server_Filesystem();
  36. $server->db_name = $CONFIG_DBNAME;
  37. $server->ServeRequest($CONFIG_DATADIRECTORY);
  38. }else{
  39. header('WWW-Authenticate: Basic realm="ownCloud"');
  40. header('HTTP/1.0 401 Unauthorized');
  41. die('401 Unauthorized');
  42. }
  43. ?>