Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. /**************************
  2. * MantisBT Path Settings *
  3. **************************/
  4.  
  5. if ( isset ( $_SERVER['SCRIPT_NAME'] ) ) {
  6. $t_protocol = 'http';
  7. if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) {
  8. $t_protocol= $_SERVER['HTTP_X_FORWARDED_PROTO'];
  9. } else if ( isset( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) {
  10. $t_protocol = 'https';
  11. }
  12.  
  13. # $_SERVER['SERVER_PORT'] is not defined in case of php-cgi.exe
  14. if ( isset( $_SERVER['SERVER_PORT'] ) ) {
  15. $t_port = ':' . $_SERVER['SERVER_PORT'];
  16. if ( ( ':80' == $t_port && 'http' == $t_protocol )
  17. || ( ':443' == $t_port && 'https' == $t_protocol )) {
  18. $t_port = '';
  19. }
  20. } else {
  21. $t_port = '';
  22. }
  23.  
  24. if ( isset( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) { // Support ProxyPass
  25. $t_hosts = explode( ',', $_SERVER['HTTP_X_FORWARDED_HOST'] );
  26. $t_host = $t_hosts[0];
  27. } else if ( isset( $_SERVER['HTTP_HOST'] ) ) {
  28. $t_host = $_SERVER['HTTP_HOST'];
  29. } else if ( isset( $_SERVER['SERVER_NAME'] ) ) {
  30. $t_host = $_SERVER['SERVER_NAME'] . $t_port;
  31. } else if ( isset( $_SERVER['SERVER_ADDR'] ) ) {
  32. $t_host = $_SERVER['SERVER_ADDR'] . $t_port;
  33. } else {
  34. $t_host = 'mantis';
  35. }
  36.  
  37. $t_path = str_replace( basename( $_SERVER['PHP_SELF'] ), '', $_SERVER['PHP_SELF'] );
  38. $t_path = basename( $t_path ) == "admin" ? dirname( $t_path ) . DIRECTORY_SEPARATOR : $t_path;
  39. $t_path = basename( $t_path ) == "soap" ? dirname( dirname( $t_path ) ) . DIRECTORY_SEPARATOR : $t_path;
  40.  
  41. $t_url = $t_protocol . '://' . $t_host . $t_path;
  42.  
  43. } else {
  44. $t_path = '';
  45. $t_host = '';
  46. $t_protocol = '';
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement