Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7d36bd8b8069
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 78821cbbd768
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Oct 1, 2012

  1. Fix $t_path on windows

    Backported from master e7ee768
    
    Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
    mantis authored and dregad committed Oct 1, 2012
    Copy the full SHA
    426fdbd View commit details
  2. Streamline $g_path definition

    Simplify the code by replacing uses of ternary operator with switch
    statement and removing unnecessary variable assignments.
    
    We now also cover the (admittedly unlikely) scenario where the
    temporary path is empty, to ensure we always generate a valid path
    that includes a trailing '/'.
    dregad committed Oct 1, 2012
    4
    Copy the full SHA
    78821cb View commit details
Showing with 16 additions and 14 deletions.
  1. +16 −14 config_defaults_inc.php
30 changes: 16 additions & 14 deletions config_defaults_inc.php
Original file line number Diff line number Diff line change
@@ -80,8 +80,9 @@
* MantisBT Path Settings *
**************************/

$t_protocol = 'http';
$t_host = 'localhost';
if ( isset ( $_SERVER['SCRIPT_NAME'] ) ) {
$t_protocol = 'http';
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) {
$t_protocol= $_SERVER['HTTP_X_FORWARDED_PROTO'];
} else if ( !empty( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) {
@@ -108,34 +109,35 @@
$t_host = $_SERVER['SERVER_NAME'] . $t_port;
} else if ( isset( $_SERVER['SERVER_ADDR'] ) ) {
$t_host = $_SERVER['SERVER_ADDR'] . $t_port;
} else {
$t_host = 'localhost';
}

$t_self = $_SERVER['SCRIPT_NAME'];
$t_self = trim( str_replace( "\0", '', $t_self ) );
$t_self = trim( str_replace( "\0", '', $_SERVER['SCRIPT_NAME'] ) );
$t_path = str_replace( basename( $t_self ), '', $t_self );
$t_path = basename( $t_path ) == "admin" ? dirname( $t_path ) . '/' : $t_path;
$t_path = basename( $t_path ) == "soap" ? dirname( dirname( $t_path ) ) . '/' : $t_path;
switch( basename( $t_path ) ) {
case 'admin':
$t_path = rtrim( dirname( $t_path ), '/\\' ) . '/';
break;
case 'soap':
$t_path = rtrim( dirname( dirname( $t_path ) ), '/\\' ) . '/';
break;
case '':
$t_path = '/';
break;
}
if ( strpos( $t_path, '&#' ) ) {
echo 'Can not safely determine $g_path. Please set $g_path manually in config_inc.php';
die;
}

$t_url = $t_protocol . '://' . $t_host . $t_path;

} else {
$t_path = '';
$t_host = '';
$t_protocol = '';
$t_path = 'mantisbt/';
}

/**
* path to your installation as seen from the web browser
* requires trailing /
* @global string $g_path
*/
$g_path = isset( $t_url ) ? $t_url : 'http://localhost/mantisbt/';
$g_path = $t_protocol . '://' . $t_host . $t_path;

/**
* path to your images directory (for icons)