wfs.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /* QGIS- reverse inginiering:
  3. ?SERVICE=WFS&REQUEST=GetCapabilities&VERSION=1.0.0
  4. */
  5. require_once dirname(__FILE__) . '/se-lib/bootstrap.php';
  6. if (!Request::isHttps()) {
  7. header("Location: https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
  8. exit();
  9. }
  10. date_default_timezone_set('Europe/Warsaw');// PHP 5 >= 5.1.0 required by date functions
  11. $errorReportingLevel = E_ALL & ~E_NOTICE;
  12. error_reporting($errorReportingLevel);
  13. ini_set('error_reporting', $errorReportingLevel);
  14. if (file_exists(APP_PATH_ROOT . "/config/.config_{$_SERVER['SERVER_NAME']}.php")) {
  15. require APP_PATH_ROOT . "/config/.config_{$_SERVER['SERVER_NAME']}.php";
  16. }
  17. if (file_exists(APP_PATH_ROOT . "/.config.php")) include APP_PATH_ROOT . "/.config.php";
  18. require_once APP_PATH_ROOT . "/superedit-SEF.php";
  19. SEF('DEBUG_S');
  20. Lib::loadClass('ApiUser');
  21. Lib::loadClass('Api');
  22. session_start();
  23. session_write_close();
  24. $apiUser = new ApiUser();
  25. // ?LOGIN=LOGOUT
  26. if ('LOGOUT' == V::get('LOGIN', '', $_GET)) {
  27. $apiUser->logout();
  28. } else {
  29. $apiUser->auth();
  30. }
  31. set_time_limit(5 * 60);
  32. $taskPath = Request::getRewriteTaskPath();
  33. IF(V::get('DBG','',$_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">taskPath (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($taskPath);echo'</pre>';}
  34. if ('/xml/wfs' == substr($taskPath, 0, 8)) {
  35. $taskPath = "/xml/wfsQgis/" . substr($taskPath, 9);
  36. }
  37. $api = new Api();
  38. $api->setUser($apiUser);
  39. $apiBaseUri = Request::getScriptUri();
  40. $api->setBaseUri($apiBaseUri);
  41. try {
  42. $api->execute($taskPath);
  43. }
  44. catch (HttpException $e) {
  45. Http::sendHeaderByCode($e->getCode());
  46. echo $e->getMessage();
  47. }
  48. catch (Exception $e) {
  49. Http::sendHeaderByCode(500);
  50. echo $e->getMessage();
  51. }
  52. ?>