Index: trunk/tools/web-scripts/missing.php |
— | — | @@ -26,17 +26,13 @@ |
27 | 27 | */ |
28 | 28 | function getSelfUrl() { |
29 | 29 | |
30 | | - /* faking https on secure.wikimedia.org - thanks Ryan for hint */ |
| 30 | + // faking https on secure.wikimedia.org - thanks Ryan for hint |
31 | 31 | if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { |
32 | 32 | $_SERVER['HTTPS'] = 'on'; |
33 | 33 | } |
34 | 34 | |
35 | | - $s = empty( $_SERVER['HTTPS'] ) ? '' : ( $_SERVER['HTTPS'] == 'on' ) ? 's' : ''; |
36 | | - |
37 | | - $protocol = substr( strtolower( $_SERVER['SERVER_PROTOCOL'] ), 0, strpos( strtolower( $_SERVER['SERVER_PROTOCOL'] ), '/' ) ) . $s; |
38 | | - |
39 | | - $port = ( $_SERVER['SERVER_PORT'] == '80') ? '' : ( ':' . $_SERVER['SERVER_PORT'] ); |
40 | | - |
| 35 | + $protocol = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ? 'https' : 'http'; |
| 36 | + $port = ( $_SERVER['SERVER_PORT'] == '80' ) ? '' : ( ':' . $_SERVER['SERVER_PORT'] ); |
41 | 37 | return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']; |
42 | 38 | } |
43 | 39 | |
— | — | @@ -55,6 +51,7 @@ |
56 | 52 | |
57 | 53 | $url = parse_url( getSelfUrl() ); |
58 | 54 | |
| 55 | +// FIXME: the code below assumes getSelfUrl() contains /wiki/ , it should verify that |
59 | 56 | if( $url['host'] == 'secure.wikimedia.org' ) { |
60 | 57 | |
61 | 58 | # https://secure.wikimedia.org/$project/$language/wiki/$page |