wfs-data.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. // Api for QGIS moved to wfs-qgis.php
  3. require_once dirname(__FILE__) . '/se-lib/bootstrap.php';
  4. if (!Request::isHttps()) {
  5. header("Location: https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
  6. exit();
  7. }
  8. date_default_timezone_set('Europe/Warsaw');// PHP 5 >= 5.1.0 required by date functions
  9. $errorReportingLevel = E_ALL & ~E_NOTICE;
  10. error_reporting($errorReportingLevel);
  11. ini_set('error_reporting', $errorReportingLevel);
  12. if (file_exists(APP_PATH_ROOT . "/config/.config_{$_SERVER['SERVER_NAME']}.php")) {
  13. require APP_PATH_ROOT . "/config/.config_{$_SERVER['SERVER_NAME']}.php";
  14. }
  15. if (file_exists(APP_PATH_ROOT . "/.config.php")) include APP_PATH_ROOT . "/.config.php";
  16. require_once APP_PATH_ROOT . "/superedit-SEF.php";
  17. SEF('DEBUG_S');
  18. Lib::loadClass('ApiUser');
  19. Lib::loadClass('Api');
  20. session_start();
  21. session_write_close();
  22. $apiUser = new ApiUser();
  23. // ?LOGIN=LOGOUT
  24. if ('LOGOUT' == V::get('LOGIN', '', $_GET)) {
  25. $apiUser->logout();
  26. } else {
  27. $apiUser->auth();
  28. }
  29. set_time_limit(5 * 60);
  30. $taskPath = Request::getRewriteTaskPath();
  31. $taskPath = "/xml/wfsData{$taskPath}";
  32. 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>';}
  33. $api = new Api();
  34. $api->setUser($apiUser);
  35. $apiBaseUri = Request::getScriptUri();
  36. $api->setBaseUri($apiBaseUri);
  37. try {
  38. $api->execute($taskPath);
  39. }
  40. catch (HttpException $e) {
  41. Http::sendHeaderByCode($e->getCode());
  42. echo $e->getMessage();
  43. }
  44. catch (Exception $e) {
  45. Http::sendHeaderByCode(500);
  46. echo $e->getMessage();
  47. }
  48. ?>