updated core to 7.54
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
/**
|
||||
* The current system version.
|
||||
*/
|
||||
define('VERSION', '7.53');
|
||||
define('VERSION', '7.54');
|
||||
|
||||
/**
|
||||
* Core API compatibility.
|
||||
@@ -718,6 +718,16 @@ function drupal_valid_http_host($host) {
|
||||
&& preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether an HTTPS request is being served.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the request is HTTPS, FALSE otherwise.
|
||||
*/
|
||||
function drupal_is_https() {
|
||||
return isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base URL, cookie domain, and session name from configuration.
|
||||
*/
|
||||
@@ -731,7 +741,7 @@ function drupal_settings_initialize() {
|
||||
if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) {
|
||||
include_once DRUPAL_ROOT . '/' . conf_path() . '/settings.php';
|
||||
}
|
||||
$is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
|
||||
$is_https = drupal_is_https();
|
||||
|
||||
if (isset($base_url)) {
|
||||
// Parse fixed base URL from settings.php.
|
||||
|
@@ -122,7 +122,12 @@ function cache_get_multiple(array &$cids, $bin = 'cache') {
|
||||
* the administrator panel.
|
||||
* - cache_path: Stores the system paths that have an alias.
|
||||
* @param $expire
|
||||
* (optional) One of the following values:
|
||||
* (optional) Controls the maximum lifetime of this cache entry. Note that
|
||||
* caches might be subject to clearing at any time, so this setting does not
|
||||
* guarantee a minimum lifetime. With this in mind, the cache should not be
|
||||
* used for data that must be kept during a cache clear, like sessions.
|
||||
*
|
||||
* Use one of the following values:
|
||||
* - CACHE_PERMANENT: Indicates that the item should never be removed unless
|
||||
* explicitly told to using cache_clear_all() with a cache ID.
|
||||
* - CACHE_TEMPORARY: Indicates that the item should be removed at the next
|
||||
@@ -262,7 +267,12 @@ interface DrupalCacheInterface {
|
||||
* 1MB in size to be stored by default. When caching large arrays or
|
||||
* similar, take care to ensure $data does not exceed this size.
|
||||
* @param $expire
|
||||
* (optional) One of the following values:
|
||||
* (optional) Controls the maximum lifetime of this cache entry. Note that
|
||||
* caches might be subject to clearing at any time, so this setting does not
|
||||
* guarantee a minimum lifetime. With this in mind, the cache should not be
|
||||
* used for data that must be kept during a cache clear, like sessions.
|
||||
*
|
||||
* Use one of the following values:
|
||||
* - CACHE_PERMANENT: Indicates that the item should never be removed unless
|
||||
* explicitly told to using cache_clear_all() with a cache ID.
|
||||
* - CACHE_TEMPORARY: Indicates that the item should be removed at the next
|
||||
|
@@ -3986,7 +3986,11 @@ function drupal_html_id($id) {
|
||||
// be merged with content already on the base page. The HTML IDs must be
|
||||
// unique for the fully merged content. Therefore, initialize $seen_ids to
|
||||
// take into account IDs that are already in use on the base page.
|
||||
$seen_ids_init = &drupal_static(__FUNCTION__ . ':init');
|
||||
static $drupal_static_fast;
|
||||
if (!isset($drupal_static_fast['seen_ids_init'])) {
|
||||
$drupal_static_fast['seen_ids_init'] = &drupal_static(__FUNCTION__ . ':init');
|
||||
}
|
||||
$seen_ids_init = &$drupal_static_fast['seen_ids_init'];
|
||||
if (!isset($seen_ids_init)) {
|
||||
// Ideally, Drupal would provide an API to persist state information about
|
||||
// prior page requests in the database, and we'd be able to add this
|
||||
@@ -4031,7 +4035,10 @@ function drupal_html_id($id) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$seen_ids = &drupal_static(__FUNCTION__, $seen_ids_init);
|
||||
if (!isset($drupal_static_fast['seen_ids'])) {
|
||||
$drupal_static_fast['seen_ids'] = &drupal_static(__FUNCTION__, $seen_ids_init);
|
||||
}
|
||||
$seen_ids = &$drupal_static_fast['seen_ids'];
|
||||
|
||||
$id = strtr(drupal_strtolower($id), array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
|
||||
|
||||
|
@@ -12,11 +12,6 @@ function system_default_date_formats() {
|
||||
$formats = array();
|
||||
|
||||
// Short date formats.
|
||||
$formats[] = array(
|
||||
'type' => 'short',
|
||||
'format' => 'Y-m-d H:i',
|
||||
'locales' => array(),
|
||||
);
|
||||
$formats[] = array(
|
||||
'type' => 'short',
|
||||
'format' => 'm/d/Y - H:i',
|
||||
@@ -37,6 +32,11 @@ function system_default_date_formats() {
|
||||
'format' => 'd.m.Y - H:i',
|
||||
'locales' => array('de-ch', 'de-de', 'de-lu', 'fi-fi', 'fr-ch', 'is-is', 'pl-pl', 'ro-ro', 'ru-ru'),
|
||||
);
|
||||
$formats[] = array(
|
||||
'type' => 'short',
|
||||
'format' => 'Y-m-d H:i',
|
||||
'locales' => array(),
|
||||
);
|
||||
$formats[] = array(
|
||||
'type' => 'short',
|
||||
'format' => 'm/d/Y - g:ia',
|
||||
@@ -84,11 +84,6 @@ function system_default_date_formats() {
|
||||
);
|
||||
|
||||
// Medium date formats.
|
||||
$formats[] = array(
|
||||
'type' => 'medium',
|
||||
'format' => 'D, Y-m-d H:i',
|
||||
'locales' => array(),
|
||||
);
|
||||
$formats[] = array(
|
||||
'type' => 'medium',
|
||||
'format' => 'D, m/d/Y - H:i',
|
||||
@@ -104,6 +99,11 @@ function system_default_date_formats() {
|
||||
'format' => 'D, Y/m/d - H:i',
|
||||
'locales' => array('en-ca', 'fr-ca', 'no-no', 'sv-se'),
|
||||
);
|
||||
$formats[] = array(
|
||||
'type' => 'medium',
|
||||
'format' => 'D, Y-m-d H:i',
|
||||
'locales' => array(),
|
||||
);
|
||||
$formats[] = array(
|
||||
'type' => 'medium',
|
||||
'format' => 'F j, Y - H:i',
|
||||
|
@@ -1176,7 +1176,7 @@ function drupal_validate_form($form_id, &$form, &$form_state) {
|
||||
// If the session token was set by drupal_prepare_form(), ensure that it
|
||||
// matches the current user's session. This is duplicate to code in
|
||||
// form_builder() but left to protect any custom form handling code.
|
||||
if (isset($form['#token'])) {
|
||||
if (!empty($form['#token'])) {
|
||||
if (!drupal_valid_token($form_state['values']['form_token'], $form['#token']) || !empty($form_state['invalid_token'])) {
|
||||
_drupal_invalid_token_set_form_error();
|
||||
// Stop here and don't run any further validation handlers, because they
|
||||
@@ -1837,7 +1837,7 @@ function form_builder($form_id, &$element, &$form_state) {
|
||||
// If the session token was set by drupal_prepare_form(), ensure that it
|
||||
// matches the current user's session.
|
||||
$form_state['invalid_token'] = FALSE;
|
||||
if (isset($element['#token'])) {
|
||||
if (!empty($element['#token'])) {
|
||||
if (empty($form_state['input']['form_token']) || !drupal_valid_token($form_state['input']['form_token'], $element['#token'])) {
|
||||
// Set an early form error to block certain input processing since that
|
||||
// opens the door for CSRF vulnerabilities.
|
||||
|
@@ -1606,6 +1606,7 @@ function _menu_tree_data(&$links, $parents, $depth) {
|
||||
* Implements template_preprocess_HOOK() for theme_menu_tree().
|
||||
*/
|
||||
function template_preprocess_menu_tree(&$variables) {
|
||||
$variables['#tree'] = $variables['tree'];
|
||||
$variables['tree'] = $variables['tree']['#children'];
|
||||
}
|
||||
|
||||
@@ -2682,7 +2683,7 @@ function menu_link_load($mlid) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cached cached data for a single named menu.
|
||||
* Clears the cached data for a single named menu.
|
||||
*/
|
||||
function menu_cache_clear($menu_name = 'navigation') {
|
||||
$cache_cleared = &drupal_static(__FUNCTION__, array());
|
||||
|
@@ -133,7 +133,7 @@ interface DrupalStreamWrapperInterface extends StreamWrapperInterface {
|
||||
* @param $uri
|
||||
* A string containing the URI that should be used for this instance.
|
||||
*/
|
||||
function setUri($uri);
|
||||
public function setUri($uri);
|
||||
|
||||
/**
|
||||
* Returns the stream resource URI.
|
||||
@@ -219,7 +219,6 @@ interface DrupalStreamWrapperInterface extends StreamWrapperInterface {
|
||||
public function dirname($uri = NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Drupal stream wrapper base class for local files.
|
||||
*
|
||||
@@ -549,6 +548,155 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface
|
||||
return fclose($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets metadata on the stream.
|
||||
*
|
||||
* WARNING: Do not call this method directly! It will be called internally by
|
||||
* PHP itself when one of the following functions is called on a stream URL:
|
||||
*
|
||||
* @param string $uri
|
||||
* A string containing the URI to the file to set metadata on.
|
||||
* @param int $option
|
||||
* One of:
|
||||
* - STREAM_META_TOUCH: The method was called in response to touch().
|
||||
* - STREAM_META_OWNER_NAME: The method was called in response to chown()
|
||||
* with string parameter.
|
||||
* - STREAM_META_OWNER: The method was called in response to chown().
|
||||
* - STREAM_META_GROUP_NAME: The method was called in response to chgrp().
|
||||
* - STREAM_META_GROUP: The method was called in response to chgrp().
|
||||
* - STREAM_META_ACCESS: The method was called in response to chmod().
|
||||
* @param mixed $value
|
||||
* If option is:
|
||||
* - STREAM_META_TOUCH: Array consisting of two arguments of the touch()
|
||||
* function.
|
||||
* - STREAM_META_OWNER_NAME or STREAM_META_GROUP_NAME: The name of the owner
|
||||
* user/group as string.
|
||||
* - STREAM_META_OWNER or STREAM_META_GROUP: The value of the owner
|
||||
* user/group as integer.
|
||||
* - STREAM_META_ACCESS: The argument of the chmod() as integer.
|
||||
*
|
||||
* @return bool
|
||||
* Returns TRUE on success or FALSE on failure. If $option is not
|
||||
* implemented, FALSE should be returned.
|
||||
*
|
||||
* @see touch()
|
||||
* @see chmod()
|
||||
* @see chown()
|
||||
* @see chgrp()
|
||||
* @link http://php.net/manual/streamwrapper.stream-metadata.php
|
||||
*/
|
||||
public function stream_metadata($uri, $option, $value) {
|
||||
$target = $this->getLocalPath($uri);
|
||||
$return = FALSE;
|
||||
switch ($option) {
|
||||
case STREAM_META_TOUCH:
|
||||
if (!empty($value)) {
|
||||
$return = touch($target, $value[0], $value[1]);
|
||||
}
|
||||
else {
|
||||
$return = touch($target);
|
||||
}
|
||||
break;
|
||||
|
||||
case STREAM_META_OWNER_NAME:
|
||||
case STREAM_META_OWNER:
|
||||
$return = chown($target, $value);
|
||||
break;
|
||||
|
||||
case STREAM_META_GROUP_NAME:
|
||||
case STREAM_META_GROUP:
|
||||
$return = chgrp($target, $value);
|
||||
break;
|
||||
|
||||
case STREAM_META_ACCESS:
|
||||
$return = chmod($target, $value);
|
||||
break;
|
||||
}
|
||||
if ($return) {
|
||||
// For convenience clear the file status cache of the underlying file,
|
||||
// since metadata operations are often followed by file status checks.
|
||||
clearstatcache(TRUE, $target);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncate stream.
|
||||
*
|
||||
* Will respond to truncation; e.g., through ftruncate().
|
||||
*
|
||||
* @param int $new_size
|
||||
* The new size.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE on success, FALSE otherwise.
|
||||
*/
|
||||
public function stream_truncate($new_size) {
|
||||
return ftruncate($this->handle, $new_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the underlying stream resource.
|
||||
*
|
||||
* This method is called in response to stream_select().
|
||||
*
|
||||
* @param int $cast_as
|
||||
* Can be STREAM_CAST_FOR_SELECT when stream_select() is calling
|
||||
* stream_cast() or STREAM_CAST_AS_STREAM when stream_cast() is called for
|
||||
* other uses.
|
||||
*
|
||||
* @return resource|false
|
||||
* The underlying stream resource or FALSE if stream_select() is not
|
||||
* supported.
|
||||
*
|
||||
* @see stream_select()
|
||||
* @link http://php.net/manual/streamwrapper.stream-cast.php
|
||||
*/
|
||||
public function stream_cast($cast_as) {
|
||||
return $this->handle ? $this->handle : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change stream options.
|
||||
*
|
||||
* This method is called to set options on the stream.
|
||||
*
|
||||
* Since Windows systems do not allow it and it is not needed for most use
|
||||
* cases anyway, this method is not supported on local files and will trigger
|
||||
* an error and return false. If needed, custom subclasses can provide
|
||||
* OS-specific implementations for advanced use cases.
|
||||
*
|
||||
* @param int $option
|
||||
* One of:
|
||||
* - STREAM_OPTION_BLOCKING: The method was called in response to
|
||||
* stream_set_blocking().
|
||||
* - STREAM_OPTION_READ_TIMEOUT: The method was called in response to
|
||||
* stream_set_timeout().
|
||||
* - STREAM_OPTION_WRITE_BUFFER: The method was called in response to
|
||||
* stream_set_write_buffer().
|
||||
* @param int $arg1
|
||||
* If option is:
|
||||
* - STREAM_OPTION_BLOCKING: The requested blocking mode:
|
||||
* - 1 means blocking.
|
||||
* - 0 means not blocking.
|
||||
* - STREAM_OPTION_READ_TIMEOUT: The timeout in seconds.
|
||||
* - STREAM_OPTION_WRITE_BUFFER: The buffer mode, STREAM_BUFFER_NONE or
|
||||
* STREAM_BUFFER_FULL.
|
||||
* @param int $arg2
|
||||
* If option is:
|
||||
* - STREAM_OPTION_BLOCKING: This option is not set.
|
||||
* - STREAM_OPTION_READ_TIMEOUT: The timeout in microseconds.
|
||||
* - STREAM_OPTION_WRITE_BUFFER: The requested buffer size.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE on success, FALSE otherwise. If $option is not implemented, FALSE
|
||||
* should be returned.
|
||||
*/
|
||||
public function stream_set_option($option, $arg1, $arg2) {
|
||||
trigger_error('stream_set_option() not supported for local file based stream wrappers', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Support for unlink().
|
||||
*
|
||||
|
Reference in New Issue
Block a user