wfs.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /* QGIS- reverse inginiering:
  3. ?SERVICE=WFS&REQUEST=GetCapabilities&VERSION=1.0.0
  4. */
  5. if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
  6. header("Location: https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
  7. exit();
  8. }
  9. require_once dirname(__FILE__) . '/se-lib/bootstrap.php';
  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. $reqUri = V::get('REQUEST_URI', '', $_SERVER);
  33. $reqScript = V::get('SCRIPT_NAME', '', $_SERVER);
  34. $taskPath = str_replace($reqScript, '', $reqUri);
  35. 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>';}
  36. $api = new Api();
  37. $api->setUser($apiUser);
  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. IF(V::get('DBG','',$_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">PHP_AUTH_USER (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($_SERVER['PHP_AUTH_USER']);echo'</pre>';}
  50. IF(V::get('DBG','',$_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">REQUEST_URI (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($_SERVER['REQUEST_URI']);echo'</pre>';}
  51. IF(V::get('DBG','',$_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">SCRIPT_NAME (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($_SERVER['SCRIPT_NAME']);echo'</pre>';}
  52. IF(V::get('DBG','',$_GET)){die("\nEOF L." . __LINE__);}
  53. ?>