wfs-data.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. if (!empty($_GET['sid'])) session_id($_GET['sid']); // TODO: security BUG
  21. session_start();
  22. session_write_close();
  23. $apiUser = new ApiUser();
  24. // ?LOGIN=LOGOUT
  25. if ('LOGOUT' == V::get('LOGIN', '', $_GET)) {
  26. $apiUser->logout();
  27. } else {
  28. $apiUser->auth();
  29. }
  30. set_time_limit(5 * 60);
  31. $taskPath = Request::getRewriteTaskPath();
  32. $taskPath = "/xml/wfsData{$taskPath}";
  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. $api = new Api();
  35. $api->setUser($apiUser);
  36. $apiBaseUri = Request::getScriptUri();
  37. $api->setBaseUri($apiBaseUri);// TODO: RMME - replaced with Api_WfsNs::getBaseWfsUri();
  38. try {
  39. $api->execute($taskPath);
  40. }
  41. catch (HttpException $e) {
  42. Http::sendHeaderByCode($e->getCode());
  43. echo $e->getMessage();
  44. }
  45. catch (Exception $e) {
  46. Http::sendHeaderByCode(500);
  47. echo $e->getMessage();
  48. }
  49. ?>