Révision 4444412d
Ajouté par Julien Enselme il y a presque 10 ans
drupal7/modules/simpletest/tests/system_test.module | ||
---|---|---|
114 | 114 |
} |
115 | 115 |
|
116 | 116 |
function system_test_basic_auth_page() { |
117 |
$output = t('$_SERVER[\'PHP_AUTH_USER\'] is @username.', array('@username' => $_SERVER['PHP_AUTH_USER'])); |
|
118 |
$output .= t('$_SERVER[\'PHP_AUTH_PW\'] is @password.', array('@password' => $_SERVER['PHP_AUTH_PW'])); |
|
117 |
// The Authorization HTTP header is forwarded via Drupal's .htaccess file even |
|
118 |
// for PHP CGI SAPIs. |
|
119 |
if (isset($_SERVER['HTTP_AUTHORIZATION'])) { |
|
120 |
$authorization_header = $_SERVER['HTTP_AUTHORIZATION']; |
|
121 |
} |
|
122 |
// If using CGI on Apache with mod_rewrite, the forwarded HTTP header appears |
|
123 |
// in the redirected HTTP headers. See |
|
124 |
// https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/ServerBag.php#L61 |
|
125 |
elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { |
|
126 |
$authorization_header = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; |
|
127 |
} |
|
128 |
// Resemble PHP_AUTH_USER and PHP_AUTH_PW for a Basic authentication from |
|
129 |
// the HTTP_AUTHORIZATION header. See |
|
130 |
// http://www.php.net/manual/features.http-auth.php |
|
131 |
list($user, $pw) = explode(':', base64_decode(substr($authorization_header, 6))); |
|
132 |
$output = t('Username is @username.', array('@username' => $user)); |
|
133 |
$output .= t('Password is @password.', array('@password' => $pw)); |
|
119 | 134 |
return $output; |
120 | 135 |
} |
121 | 136 |
|
Formats disponibles : Unified diff
Update drupal 7.27 -> 7.28