drupal core updated to 7.28
This commit is contained in:
@@ -458,7 +458,7 @@ function drupal_get_query_array($query) {
|
||||
$result = array();
|
||||
if (!empty($query)) {
|
||||
foreach (explode('&', $query) as $param) {
|
||||
$param = explode('=', $param);
|
||||
$param = explode('=', $param, 2);
|
||||
$result[$param[0]] = isset($param[1]) ? rawurldecode($param[1]) : '';
|
||||
}
|
||||
}
|
||||
@@ -929,7 +929,7 @@ function drupal_http_request($url, array $options = array()) {
|
||||
|
||||
// If the server URL has a user then attempt to use basic authentication.
|
||||
if (isset($uri['user'])) {
|
||||
$options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . (isset($uri['pass']) ? ':' . $uri['pass'] : ''));
|
||||
$options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . (isset($uri['pass']) ? ':' . $uri['pass'] : ':'));
|
||||
}
|
||||
|
||||
// If the database prefix is being used by SimpleTest to run the tests in a copied
|
||||
@@ -1134,7 +1134,7 @@ function _fix_gpc_magic(&$item) {
|
||||
* @param $key
|
||||
* The key for the item within $_FILES.
|
||||
*
|
||||
* @see http://php.net/manual/en/features.file-upload.php#42280
|
||||
* @see http://php.net/manual/features.file-upload.php#42280
|
||||
*/
|
||||
function _fix_gpc_magic_files(&$item, $key) {
|
||||
if ($key != 'tmp_name') {
|
||||
@@ -1426,7 +1426,6 @@ function filter_xss_admin($string) {
|
||||
* valid UTF-8.
|
||||
*
|
||||
* @see drupal_validate_utf8()
|
||||
* @ingroup sanitization
|
||||
*/
|
||||
function filter_xss($string, $allowed_tags = array('a', 'em', 'strong', 'cite', 'blockquote', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd')) {
|
||||
// Only operate on valid UTF-8 strings. This is necessary to prevent cross
|
||||
@@ -1950,7 +1949,7 @@ function format_interval($interval, $granularity = 2, $langcode = NULL) {
|
||||
* get interpreted as date format characters.
|
||||
* @param $timezone
|
||||
* (optional) Time zone identifier, as described at
|
||||
* http://php.net/manual/en/timezones.php Defaults to the time zone used to
|
||||
* http://php.net/manual/timezones.php Defaults to the time zone used to
|
||||
* display the page.
|
||||
* @param $langcode
|
||||
* (optional) Language code to translate to. Defaults to the language used to
|
||||
@@ -3673,17 +3672,23 @@ function drupal_load_stylesheet($file, $optimize = NULL, $reset_basepath = TRUE)
|
||||
if ($basepath && !file_uri_scheme($file)) {
|
||||
$file = $basepath . '/' . $file;
|
||||
}
|
||||
// Store the parent base path to restore it later.
|
||||
$parent_base_path = $basepath;
|
||||
// Set the current base path to process possible child imports.
|
||||
$basepath = dirname($file);
|
||||
|
||||
// Load the CSS stylesheet. We suppress errors because themes may specify
|
||||
// stylesheets in their .info file that don't exist in the theme's path,
|
||||
// but are merely there to disable certain module CSS files.
|
||||
$content = '';
|
||||
if ($contents = @file_get_contents($file)) {
|
||||
// Return the processed stylesheet.
|
||||
return drupal_load_stylesheet_content($contents, $_optimize);
|
||||
$content = drupal_load_stylesheet_content($contents, $_optimize);
|
||||
}
|
||||
|
||||
return '';
|
||||
// Restore the parent base path as the file and its childen are processed.
|
||||
$basepath = $parent_base_path;
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3700,7 +3705,7 @@ function drupal_load_stylesheet($file, $optimize = NULL, $reset_basepath = TRUE)
|
||||
*/
|
||||
function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
|
||||
// Remove multiple charset declarations for standards compliance (and fixing Safari problems).
|
||||
$contents = preg_replace('/^@charset\s+[\'"](\S*)\b[\'"];/i', '', $contents);
|
||||
$contents = preg_replace('/^@charset\s+[\'"](\S*?)\b[\'"];/i', '', $contents);
|
||||
|
||||
if ($optimize) {
|
||||
// Perform some safe CSS optimizations.
|
||||
@@ -3719,7 +3724,7 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
|
||||
// Remove certain whitespace.
|
||||
// There are different conditions for removing leading and trailing
|
||||
// whitespace.
|
||||
// @see http://php.net/manual/en/regexp.reference.subpatterns.php
|
||||
// @see http://php.net/manual/regexp.reference.subpatterns.php
|
||||
$contents = preg_replace('<
|
||||
# Strip leading and trailing whitespace.
|
||||
\s*([@{};,])\s*
|
||||
@@ -3833,7 +3838,14 @@ function drupal_clean_css_identifier($identifier, $filter = array(' ' => '-', '_
|
||||
* The cleaned class name.
|
||||
*/
|
||||
function drupal_html_class($class) {
|
||||
return drupal_clean_css_identifier(drupal_strtolower($class));
|
||||
// The output of this function will never change, so this uses a normal
|
||||
// static instead of drupal_static().
|
||||
static $classes = array();
|
||||
|
||||
if (!isset($classes[$class])) {
|
||||
$classes[$class] = drupal_clean_css_identifier(drupal_strtolower($class));
|
||||
}
|
||||
return $classes[$class];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4097,7 +4109,7 @@ function drupal_region_class($region) {
|
||||
* else being the same, JavaScript added by a call to drupal_add_js() that
|
||||
* happened later in the page request gets added to the page after one for
|
||||
* which drupal_add_js() happened earlier in the page request.
|
||||
* - defer: If set to TRUE, the defer attribute is set on the <script>
|
||||
* - defer: If set to TRUE, the defer attribute is set on the <script>
|
||||
* tag. Defaults to FALSE.
|
||||
* - cache: If set to FALSE, the JavaScript file is loaded anew on every page
|
||||
* call; in other words, it is not cached. Used only when 'type' references
|
||||
@@ -5042,7 +5054,7 @@ function drupal_json_output($var = NULL) {
|
||||
*/
|
||||
function drupal_get_private_key() {
|
||||
if (!($key = variable_get('drupal_private_key', 0))) {
|
||||
$key = drupal_hash_base64(drupal_random_bytes(55));
|
||||
$key = drupal_random_key();
|
||||
variable_set('drupal_private_key', $key);
|
||||
}
|
||||
return $key;
|
||||
@@ -5054,6 +5066,11 @@ function drupal_get_private_key() {
|
||||
* @param $value
|
||||
* An additional value to base the token on.
|
||||
*
|
||||
* The generated token is based on the session ID of the current user. Normally,
|
||||
* anonymous users do not have a session, so the generated token will be
|
||||
* different on every page request. To generate a token for users without a
|
||||
* session, manually start a session prior to calling this function.
|
||||
*
|
||||
* @return string
|
||||
* A 43-character URL-safe token for validation, based on the user session ID,
|
||||
* the hash salt provided from drupal_get_hash_salt(), and the
|
||||
@@ -5081,7 +5098,7 @@ function drupal_get_token($value = '') {
|
||||
*/
|
||||
function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) {
|
||||
global $user;
|
||||
return (($skip_anonymous && $user->uid == 0) || ($token == drupal_get_token($value)));
|
||||
return (($skip_anonymous && $user->uid == 0) || ($token === drupal_get_token($value)));
|
||||
}
|
||||
|
||||
function _drupal_bootstrap_full() {
|
||||
@@ -5114,6 +5131,10 @@ function _drupal_bootstrap_full() {
|
||||
module_load_all();
|
||||
// Make sure all stream wrappers are registered.
|
||||
file_get_stream_wrappers();
|
||||
// Ensure mt_rand is reseeded, to prevent random values from one page load
|
||||
// being exploited to predict random values in subsequent page loads.
|
||||
$seed = unpack("L", drupal_random_bytes(4));
|
||||
mt_srand($seed[1]);
|
||||
|
||||
$test_info = &$GLOBALS['drupal_test_info'];
|
||||
if (!empty($test_info['in_child_site'])) {
|
||||
@@ -5151,7 +5172,7 @@ function _drupal_bootstrap_full() {
|
||||
* client without gzip support.
|
||||
*
|
||||
* Page compression requires the PHP zlib extension
|
||||
* (http://php.net/manual/en/ref.zlib.php).
|
||||
* (http://php.net/manual/ref.zlib.php).
|
||||
*
|
||||
* @see drupal_page_header()
|
||||
*/
|
||||
@@ -5159,6 +5180,10 @@ function drupal_page_set_cache() {
|
||||
global $base_root;
|
||||
|
||||
if (drupal_page_is_cacheable()) {
|
||||
|
||||
// Check whether the current page might be compressed.
|
||||
$page_compressed = variable_get('page_compression', TRUE) && extension_loaded('zlib');
|
||||
|
||||
$cache = (object) array(
|
||||
'cid' => $base_root . request_uri(),
|
||||
'data' => array(
|
||||
@@ -5166,6 +5191,9 @@ function drupal_page_set_cache() {
|
||||
'body' => ob_get_clean(),
|
||||
'title' => drupal_get_title(),
|
||||
'headers' => array(),
|
||||
// We need to store whether page was compressed or not,
|
||||
// because by the time it is read, the configuration might change.
|
||||
'page_compressed' => $page_compressed,
|
||||
),
|
||||
'expire' => CACHE_TEMPORARY,
|
||||
'created' => REQUEST_TIME,
|
||||
@@ -5183,7 +5211,7 @@ function drupal_page_set_cache() {
|
||||
}
|
||||
|
||||
if ($cache->data['body']) {
|
||||
if (variable_get('page_compression', TRUE) && extension_loaded('zlib')) {
|
||||
if ($page_compressed) {
|
||||
$cache->data['body'] = gzencode($cache->data['body'], 9, FORCE_GZIP);
|
||||
}
|
||||
cache_set($cache->cid, $cache->data, 'cache_page', $cache->expire);
|
||||
@@ -5258,12 +5286,23 @@ function drupal_cron_run() {
|
||||
}
|
||||
|
||||
foreach ($queues as $queue_name => $info) {
|
||||
if (!empty($info['skip on cron'])) {
|
||||
// Do not run if queue wants to skip.
|
||||
continue;
|
||||
}
|
||||
$function = $info['worker callback'];
|
||||
$end = time() + (isset($info['time']) ? $info['time'] : 15);
|
||||
$queue = DrupalQueue::get($queue_name);
|
||||
while (time() < $end && ($item = $queue->claimItem())) {
|
||||
$function($item->data);
|
||||
$queue->deleteItem($item);
|
||||
try {
|
||||
$function($item->data);
|
||||
$queue->deleteItem($item);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// In case of exception log it and leave the item in the queue
|
||||
// to be processed again later.
|
||||
watchdog_exception('cron', $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore the user.
|
||||
@@ -5918,14 +5957,16 @@ function drupal_render(&$elements) {
|
||||
/**
|
||||
* Renders children of an element and concatenates them.
|
||||
*
|
||||
* This renders all children of an element using drupal_render() and then
|
||||
* joins them together into a single string.
|
||||
*
|
||||
* @param $element
|
||||
* @param array $element
|
||||
* The structured array whose children shall be rendered.
|
||||
* @param $children_keys
|
||||
* If the keys of the element's children are already known, they can be passed
|
||||
* in to save another run of element_children().
|
||||
* @param array $children_keys
|
||||
* (optional) If the keys of the element's children are already known, they
|
||||
* can be passed in to save another run of element_children().
|
||||
*
|
||||
* @return string
|
||||
* The rendered HTML of all children of the element.
|
||||
|
||||
* @see drupal_render()
|
||||
*/
|
||||
function drupal_render_children(&$element, $children_keys = NULL) {
|
||||
if ($children_keys === NULL) {
|
||||
@@ -7799,7 +7840,10 @@ function entity_load_unchanged($entity_type, $id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the entity controller class for an entity type.
|
||||
* Gets the entity controller for an entity type.
|
||||
*
|
||||
* @return DrupalEntityControllerInterface
|
||||
* The entity controller object for the specified entity type.
|
||||
*/
|
||||
function entity_get_controller($entity_type) {
|
||||
$controllers = &drupal_static(__FUNCTION__, array());
|
||||
|
||||
Reference in New Issue
Block a user