PageRenderTime 78ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/examples/dynamictable/public/phpolait/rpcproxy_constructor.php

http://pyjamas.googlecode.com/
PHP | 30 lines | 23 code | 1 blank | 6 comment | 8 complexity | bf2a14df4f1a235bb448242ab1351fba MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * Internal code for the JSONRpcProxy::JSONRpcProxy() function
  4. * This _extremely_ annoying approach is necessitated to have PHP 4 and PHP 5 compatibility with the same code-base.
  5. * I SINCERELY hope it works!
  6. */
  7. // Converts from relative to absolute URL's. Permits relative URL's and prevents local filesystem access.
  8. if (! ((substr($url, 0, 7) == "http://") || (substr($url, 0, 8) == "https://")) ){
  9. if (substr($_SERVER["SERVER_PROTOCOL"],0,5)=="HTTPS") {
  10. $newUrl = "https";
  11. } else {
  12. $newUrl = "http";
  13. }
  14. $newUrl .= "://";
  15. $newUrl .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"];
  16. $newUrl .= dirname($_SERVER['PHP_SELF']);
  17. if (substr($newUrl, -1)!="/") $newUrl .= "/";
  18. $url = $newUrl . $url;
  19. }
  20. $this->url = $url;
  21. if (!(is_object($httpWrapper))) {
  22. $this->httpWrap = HttpWrapper::GetWrapper();
  23. } else {
  24. $this->httpWrap = $httpWrapper;
  25. }
  26. $this->jsonlib = JSON_PHP_FILE;
  27. if ($jsonlib!=null)
  28. $this->jsonlib = $jsonlib;
  29. ?>