Révision b4adf10d
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/includes/bootstrap.inc | ||
---|---|---|
8 | 8 |
/** |
9 | 9 |
* The current system version. |
10 | 10 |
*/ |
11 |
define('VERSION', '7.32');
|
|
11 |
define('VERSION', '7.33');
|
|
12 | 12 |
|
13 | 13 |
/** |
14 | 14 |
* Core API compatibility. |
... | ... | |
248 | 248 |
*/ |
249 | 249 |
define('DRUPAL_PHP_FUNCTION_PATTERN', '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'); |
250 | 250 |
|
251 |
/** |
|
252 |
* A RFC7231 Compliant date. |
|
253 |
* |
|
254 |
* http://tools.ietf.org/html/rfc7231#section-7.1.1.1 |
|
255 |
* |
|
256 |
* Example: Sun, 06 Nov 1994 08:49:37 GMT |
|
257 |
*/ |
|
258 |
define('DATE_RFC7231', 'D, d M Y H:i:s \G\M\T'); |
|
259 |
|
|
251 | 260 |
/** |
252 | 261 |
* Provides a caching wrapper to be used in place of large array structures. |
253 | 262 |
* |
... | ... | |
852 | 861 |
try { |
853 | 862 |
if (function_exists('db_query')) { |
854 | 863 |
$file = db_query("SELECT filename FROM {system} WHERE name = :name AND type = :type", array(':name' => $name, ':type' => $type))->fetchField(); |
855 |
if (file_exists(DRUPAL_ROOT . '/' . $file)) { |
|
864 |
if ($file !== FALSE && file_exists(DRUPAL_ROOT . '/' . $file)) {
|
|
856 | 865 |
$files[$type][$name] = $file; |
857 | 866 |
} |
858 | 867 |
} |
... | ... | |
1266 | 1275 |
|
1267 | 1276 |
$default_headers = array( |
1268 | 1277 |
'Expires' => 'Sun, 19 Nov 1978 05:00:00 GMT', |
1269 |
'Last-Modified' => gmdate(DATE_RFC1123, REQUEST_TIME),
|
|
1278 |
'Last-Modified' => gmdate(DATE_RFC7231, REQUEST_TIME),
|
|
1270 | 1279 |
'Cache-Control' => 'no-cache, must-revalidate, post-check=0, pre-check=0', |
1271 | 1280 |
'ETag' => '"' . REQUEST_TIME . '"', |
1272 | 1281 |
); |
... | ... | |
1336 | 1345 |
drupal_add_http_header($name, $value); |
1337 | 1346 |
} |
1338 | 1347 |
|
1339 |
$default_headers['Last-Modified'] = gmdate(DATE_RFC1123, $cache->created);
|
|
1348 |
$default_headers['Last-Modified'] = gmdate(DATE_RFC7231, $cache->created);
|
|
1340 | 1349 |
|
1341 | 1350 |
// HTTP/1.0 proxies does not support the Vary header, so prevent any caching |
1342 | 1351 |
// by sending an Expires date in the past. HTTP/1.1 clients ignores the |
... | ... | |
1559 | 1568 |
* Also validates strings as UTF-8 to prevent cross site scripting attacks on |
1560 | 1569 |
* Internet Explorer 6. |
1561 | 1570 |
* |
1562 |
* @param $text |
|
1571 |
* @param string $text
|
|
1563 | 1572 |
* The text to be checked or processed. |
1564 | 1573 |
* |
1565 |
* @return |
|
1566 |
* An HTML safe version of $text, or an empty string if $text is not |
|
1567 |
* valid UTF-8. |
|
1574 |
* @return string |
|
1575 |
* An HTML safe version of $text. If $text is not valid UTF-8, an empty string |
|
1576 |
* is returned and, on PHP < 5.4, a warning may be issued depending on server |
|
1577 |
* configuration (see @link https://bugs.php.net/bug.php?id=47494 @endlink). |
|
1568 | 1578 |
* |
1569 | 1579 |
* @see drupal_validate_utf8() |
1570 | 1580 |
* @ingroup sanitization |
... | ... | |
2176 | 2186 |
* drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); |
2177 | 2187 |
* @endcode |
2178 | 2188 |
* |
2179 |
* @param $phase |
|
2189 |
* @param int $phase
|
|
2180 | 2190 |
* A constant telling which phase to bootstrap to. When you bootstrap to a |
2181 | 2191 |
* particular phase, all earlier phases are run automatically. Possible |
2182 | 2192 |
* values: |
... | ... | |
2189 | 2199 |
* - DRUPAL_BOOTSTRAP_LANGUAGE: Finds out the language of the page. |
2190 | 2200 |
* - DRUPAL_BOOTSTRAP_FULL: Fully loads Drupal. Validates and fixes input |
2191 | 2201 |
* data. |
2192 |
* @param $new_phase |
|
2202 |
* @param boolean $new_phase
|
|
2193 | 2203 |
* A boolean, set to FALSE if calling drupal_bootstrap from inside a |
2194 | 2204 |
* function called from drupal_bootstrap (recursion). |
2195 | 2205 |
* |
2196 |
* @return |
|
2206 |
* @return int
|
|
2197 | 2207 |
* The most recently completed phase. |
2198 | 2208 |
*/ |
2199 | 2209 |
function drupal_bootstrap($phase = NULL, $new_phase = TRUE) { |
... | ... | |
2215 | 2225 |
// bootstrap state. |
2216 | 2226 |
static $stored_phase = -1; |
2217 | 2227 |
|
2218 |
// When not recursing, store the phase name so it's not forgotten while |
|
2219 |
// recursing. |
|
2220 |
if ($new_phase) { |
|
2221 |
$final_phase = $phase; |
|
2222 |
} |
|
2223 | 2228 |
if (isset($phase)) { |
2229 |
// When not recursing, store the phase name so it's not forgotten while |
|
2230 |
// recursing but take care of not going backwards. |
|
2231 |
if ($new_phase && $phase >= $stored_phase) { |
|
2232 |
$final_phase = $phase; |
|
2233 |
} |
|
2234 |
|
|
2224 | 2235 |
// Call a phase if it has not been called before and is below the requested |
2225 | 2236 |
// phase. |
2226 | 2237 |
while ($phases && $phase > $stored_phase && $final_phase > $stored_phase) { |
... | ... | |
2508 | 2519 |
* @see drupal_bootstrap() |
2509 | 2520 |
*/ |
2510 | 2521 |
function drupal_get_bootstrap_phase() { |
2511 |
return drupal_bootstrap(); |
|
2522 |
return drupal_bootstrap(NULL, FALSE);
|
|
2512 | 2523 |
} |
2513 | 2524 |
|
2514 | 2525 |
/** |
... | ... | |
3328 | 3339 |
* @param $default_value |
3329 | 3340 |
* Optional default value. |
3330 | 3341 |
* @param $reset |
3331 |
* TRUE to reset a specific named variable, or all variables if $name is NULL. |
|
3332 |
* Resetting every variable should only be used, for example, for running |
|
3333 |
* unit tests with a clean environment. Should be used only though via |
|
3334 |
* function drupal_static_reset() and the return value should not be used in |
|
3335 |
* this case. |
|
3342 |
* TRUE to reset one or all variables(s). This parameter is only used |
|
3343 |
* internally and should not be passed in; use drupal_static_reset() instead. |
|
3344 |
* (This function's return value should not be used when TRUE is passed in.) |
|
3336 | 3345 |
* |
3337 | 3346 |
* @return |
3338 | 3347 |
* Returns a variable by reference. |
... | ... | |
3377 | 3386 |
* |
3378 | 3387 |
* @param $name |
3379 | 3388 |
* Name of the static variable to reset. Omit to reset all variables. |
3389 |
* Resetting all variables should only be used, for example, for running unit |
|
3390 |
* tests with a clean environment. |
|
3380 | 3391 |
*/ |
3381 | 3392 |
function drupal_static_reset($name = NULL) { |
3382 | 3393 |
drupal_static($name, NULL, TRUE); |
Formats disponibles : Unified diff
Udpate to 7.33