index.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. header('Access-Control-Allow-Origin: *');
  3. header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
  4. header('Access-Control-Allow-Headers: X-Requested-With');
  5. header('Access-Control-Max-Age: 86400');
  6. // includes
  7. $includePath = array();
  8. $includePath[] = '../arav_up_inclu';
  9. $includePath[] = get_include_path();
  10. $includePath = implode(PATH_SEPARATOR,$includePath);
  11. set_include_path($includePath);
  12. // carica configurazione
  13. require '../arav_up_confs.php';
  14. require_once('arkiwi.php');
  15. require_once('auth.php');
  16. require_once('report.php');
  17. // presenta auth
  18. if (!isset($_SERVER['PHP_AUTH_USER'])) {
  19. prompt_auth();
  20. // report(1,"PHP_AUTH_USER not set, exiting"); //Lo vogliamo davvero loggare?
  21. exit;
  22. }
  23. $authstate = do_local_auth($_SERVER['PHP_AUTH_USER'], hash("sha256",$_SERVER['PHP_AUTH_PW']));
  24. // report(1,"userid : ".$authstate["userid"]);
  25. // report(1,"dir : ".$authstate["dir"]);
  26. if ($authstate["esito"] != "AUTH_OK") {
  27. // // es: is_inside_dir($object, $authstate["dir"]);
  28. prompt_auth();
  29. // report(1,"esito not AUTH_OK, exiting");
  30. exit;
  31. }
  32. else {
  33. // registra in sessione i dati dell'utente //FIXME lo facciamo qui o dentro la funzione do_local_auth?
  34. $_SESSION['authstate'] = $authstate;
  35. }
  36. // -----------------
  37. // I am not afraid of errors:
  38. error_reporting(E_ALL);
  39. // Parse the request, and run:
  40. $request = parseRequest();
  41. $request->run();
  42. // Print the headers and the body:
  43. $request->writeHeader();
  44. $request->writeBody();