updated core to 7.73
This commit is contained in:
+106
-29
@@ -242,6 +242,7 @@ function system_permission() {
|
||||
),
|
||||
'access site reports' => array(
|
||||
'title' => t('View site reports'),
|
||||
'restrict access' => TRUE,
|
||||
),
|
||||
'block IP addresses' => array(
|
||||
'title' => t('Block IP addresses'),
|
||||
@@ -322,6 +323,10 @@ function system_element_info() {
|
||||
'#group_callback' => 'drupal_group_css',
|
||||
'#aggregate_callback' => 'drupal_aggregate_css',
|
||||
);
|
||||
$types['scripts'] = array(
|
||||
'#items' => array(),
|
||||
'#pre_render' => array('drupal_pre_render_scripts'),
|
||||
);
|
||||
|
||||
// Input elements.
|
||||
$types['submit'] = array(
|
||||
@@ -358,7 +363,7 @@ function system_element_info() {
|
||||
'#size' => 60,
|
||||
'#maxlength' => 128,
|
||||
'#autocomplete_path' => FALSE,
|
||||
'#process' => array('ajax_process_form'),
|
||||
'#process' => array('form_process_autocomplete', 'ajax_process_form'),
|
||||
'#theme' => 'textfield',
|
||||
'#theme_wrappers' => array('form_element'),
|
||||
);
|
||||
@@ -373,6 +378,9 @@ function system_element_info() {
|
||||
'#element_validate' => array('form_validate_machine_name'),
|
||||
'#theme' => 'textfield',
|
||||
'#theme_wrappers' => array('form_element'),
|
||||
// Use the same value callback as for textfields; this ensures that we only
|
||||
// get string values.
|
||||
'#value_callback' => 'form_type_textfield_value',
|
||||
);
|
||||
$types['password'] = array(
|
||||
'#input' => TRUE,
|
||||
@@ -381,6 +389,9 @@ function system_element_info() {
|
||||
'#process' => array('ajax_process_form'),
|
||||
'#theme' => 'password',
|
||||
'#theme_wrappers' => array('form_element'),
|
||||
// Use the same value callback as for textfields; this ensures that we only
|
||||
// get string values.
|
||||
'#value_callback' => 'form_type_textfield_value',
|
||||
);
|
||||
$types['password_confirm'] = array(
|
||||
'#input' => TRUE,
|
||||
@@ -1175,6 +1186,10 @@ function system_library() {
|
||||
'version' => '1.4.4',
|
||||
'js' => array(
|
||||
'misc/jquery.js' => array('group' => JS_LIBRARY, 'weight' => -20),
|
||||
// These include security fixes, so assign a weight that makes them load
|
||||
// as soon after jquery.js is loaded as possible.
|
||||
'misc/jquery-extend-3.4.0.js' => array('group' => JS_LIBRARY, 'weight' => -19),
|
||||
'misc/jquery-html-prefilter-3.5.0-backport.js' => array('group' => JS_LIBRARY, 'weight' => -19),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -2023,7 +2038,6 @@ function system_user_timezone(&$form, &$form_state) {
|
||||
'#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
|
||||
);
|
||||
if (!isset($account->timezone) && $account->uid == $user->uid && empty($form_state['input']['timezone'])) {
|
||||
$form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Confirm the selection and click save.');
|
||||
$form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect'));
|
||||
drupal_add_js('misc/timezone.js');
|
||||
}
|
||||
@@ -2398,9 +2412,17 @@ function _system_rebuild_module_data() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the info file modification time, so it becomes available for
|
||||
// contributed modules to use for ordering module lists.
|
||||
$module->info['mtime'] = filemtime(dirname($module->uri) . '/' . $module->name . '.info');
|
||||
|
||||
// Merge in defaults and save.
|
||||
$modules[$key]->info = $module->info + $defaults;
|
||||
|
||||
// The "name" key is required, but to avoid a fatal error in the menu system
|
||||
// we set a reasonable default if it is not provided.
|
||||
$modules[$key]->info += array('name' => $key);
|
||||
|
||||
// Prefix stylesheets and scripts with module path.
|
||||
$path = dirname($module->uri);
|
||||
if (isset($module->info['stylesheets'])) {
|
||||
@@ -2507,6 +2529,16 @@ function _system_rebuild_theme_data() {
|
||||
|
||||
// Find theme engines
|
||||
$engines = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.engine$/', 'themes/engines');
|
||||
// Allow modules to add further theme engines.
|
||||
if ($module_engines = module_invoke_all('system_theme_engine_info')) {
|
||||
foreach ($module_engines as $name => $theme_engine_path) {
|
||||
$engines[$name] = (object) array(
|
||||
'uri' => $theme_engine_path,
|
||||
'filename' => basename($theme_engine_path),
|
||||
'name' => $name,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set defaults for theme info.
|
||||
$defaults = array(
|
||||
@@ -2536,6 +2568,14 @@ function _system_rebuild_theme_data() {
|
||||
$themes[$key]->filename = $theme->uri;
|
||||
$themes[$key]->info = drupal_parse_info_file($theme->uri) + $defaults;
|
||||
|
||||
// The "name" key is required, but to avoid a fatal error in the menu system
|
||||
// we set a reasonable default if it is not provided.
|
||||
$themes[$key]->info += array('name' => $key);
|
||||
|
||||
// Add the info file modification time, so it becomes available for
|
||||
// contributed modules to use for ordering theme lists.
|
||||
$themes[$key]->info['mtime'] = filemtime($theme->uri);
|
||||
|
||||
// Invoke hook_system_info_alter() to give installed modules a chance to
|
||||
// modify the data in the .info files if necessary.
|
||||
$type = 'theme';
|
||||
@@ -2683,10 +2723,17 @@ function system_find_base_themes($themes, $key, $used_keys = array()) {
|
||||
* @param $show
|
||||
* Possible values: REGIONS_ALL or REGIONS_VISIBLE. Visible excludes hidden
|
||||
* regions.
|
||||
* @return
|
||||
* An array of regions in the form $region['name'] = 'description'.
|
||||
* @param bool $labels
|
||||
* (optional) Boolean to specify whether the human readable machine names
|
||||
* should be returned or not. Defaults to TRUE, but calling code can set
|
||||
* this to FALSE for better performance, if it only needs machine names.
|
||||
*
|
||||
* @return array
|
||||
* An associative array of regions in the form $region['name'] = 'description'
|
||||
* if $labels is set to TRUE, or $region['name'] = 'name', if $labels is set
|
||||
* to FALSE.
|
||||
*/
|
||||
function system_region_list($theme_key, $show = REGIONS_ALL) {
|
||||
function system_region_list($theme_key, $show = REGIONS_ALL, $labels = TRUE) {
|
||||
$themes = list_themes();
|
||||
if (!isset($themes[$theme_key])) {
|
||||
return array();
|
||||
@@ -2697,10 +2744,14 @@ function system_region_list($theme_key, $show = REGIONS_ALL) {
|
||||
// If requested, suppress hidden regions. See block_admin_display_form().
|
||||
foreach ($info['regions'] as $name => $label) {
|
||||
if ($show == REGIONS_ALL || !isset($info['regions_hidden']) || !in_array($name, $info['regions_hidden'])) {
|
||||
$list[$name] = t($label);
|
||||
if ($labels) {
|
||||
$list[$name] = t($label);
|
||||
}
|
||||
else {
|
||||
$list[$name] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
@@ -2721,16 +2772,27 @@ function system_system_info_alter(&$info, $file, $type) {
|
||||
*
|
||||
* @param $theme
|
||||
* The name of a theme.
|
||||
*
|
||||
* @return
|
||||
* A string that is the region name.
|
||||
*/
|
||||
function system_default_region($theme) {
|
||||
$regions = array_keys(system_region_list($theme, REGIONS_VISIBLE));
|
||||
return isset($regions[0]) ? $regions[0] : '';
|
||||
$regions = system_region_list($theme, REGIONS_VISIBLE, FALSE);
|
||||
return $regions ? reset($regions) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add default buttons to a form and set its prefix.
|
||||
* Sets up a form to save information automatically.
|
||||
*
|
||||
* This function adds a submit handler and a submit button to a form array. The
|
||||
* submit function saves all the data in the form, using variable_set(), to
|
||||
* variables named the same as the keys in the form array. Note that this means
|
||||
* you should normally prefix your form array keys with your module name, so
|
||||
* that they are unique when passed into variable_set().
|
||||
*
|
||||
* If you need to manipulate the data in a custom manner, you can either put
|
||||
* your own submission handler in the form array before calling this function,
|
||||
* or just use your own submission handler instead of calling this function.
|
||||
*
|
||||
* @param $form
|
||||
* An associative array containing the structure of the form.
|
||||
@@ -2739,6 +2801,7 @@ function system_default_region($theme) {
|
||||
* The form structure.
|
||||
*
|
||||
* @see system_settings_form_submit()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function system_settings_form($form) {
|
||||
@@ -2757,7 +2820,7 @@ function system_settings_form($form) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the system_settings_form.
|
||||
* Form submission handler for system_settings_form().
|
||||
*
|
||||
* If you want node type configure style handling of your checkboxes,
|
||||
* add an array_filter value to your form.
|
||||
@@ -2782,7 +2845,7 @@ function system_settings_form_submit($form, &$form_state) {
|
||||
function _system_sort_requirements($a, $b) {
|
||||
if (!isset($a['weight'])) {
|
||||
if (!isset($b['weight'])) {
|
||||
return strcmp($a['title'], $b['title']);
|
||||
return strcasecmp($a['title'], $b['title']);
|
||||
}
|
||||
return -$b['weight'];
|
||||
}
|
||||
@@ -2838,7 +2901,7 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL,
|
||||
|
||||
// Prepare cancel link.
|
||||
if (isset($_GET['destination'])) {
|
||||
$options = drupal_parse_url(urldecode($_GET['destination']));
|
||||
$options = drupal_parse_url($_GET['destination']);
|
||||
}
|
||||
elseif (is_array($path)) {
|
||||
$options = $path;
|
||||
@@ -3023,8 +3086,20 @@ function system_cron() {
|
||||
}
|
||||
}
|
||||
|
||||
$core = array('cache', 'cache_path', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
|
||||
$cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
|
||||
// Delete expired cache entries.
|
||||
// Avoid invoking hook_flush_cashes() on every cron run because some modules
|
||||
// use this hook to perform expensive rebuilding operations (which are only
|
||||
// designed to happen on full cache clears), rather than just returning a
|
||||
// list of cache tables to be cleared.
|
||||
$cache_object = cache_get('system_cache_tables');
|
||||
if (empty($cache_object)) {
|
||||
$core = array('cache', 'cache_path', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
|
||||
$cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
|
||||
cache_set('system_cache_tables', $cache_tables);
|
||||
}
|
||||
else {
|
||||
$cache_tables = $cache_object->data;
|
||||
}
|
||||
foreach ($cache_tables as $table) {
|
||||
cache_clear_all(NULL, $table);
|
||||
}
|
||||
@@ -3272,7 +3347,7 @@ function system_goto_action_form($context) {
|
||||
$form['url'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('URL'),
|
||||
'#description' => t('The URL to which the user should be redirected. This can be an internal URL like node/1234 or an external URL like http://drupal.org.'),
|
||||
'#description' => t('The URL to which the user should be redirected. This can be an internal path like node/1234 or an external URL like http://example.com.'),
|
||||
'#default_value' => isset($context['url']) ? $context['url'] : '',
|
||||
'#required' => TRUE,
|
||||
);
|
||||
@@ -3309,7 +3384,8 @@ function system_goto_action($entity, $context) {
|
||||
*/
|
||||
function system_block_ip_action() {
|
||||
$ip = ip_address();
|
||||
db_insert('blocked_ips')
|
||||
db_merge('blocked_ips')
|
||||
->key(array('ip' => $ip))
|
||||
->fields(array('ip' => $ip))
|
||||
->execute();
|
||||
watchdog('action', 'Banned IP address %ip', array('%ip' => $ip));
|
||||
@@ -3374,7 +3450,7 @@ function system_timezone($abbreviation = '', $offset = -1, $is_daylight_saving_t
|
||||
* @ingroup themeable
|
||||
*/
|
||||
function theme_system_powered_by() {
|
||||
return '<span>' . t('Powered by <a href="@poweredby">Drupal</a>', array('@poweredby' => 'http://drupal.org')) . '</span>';
|
||||
return '<span>' . t('Powered by <a href="@poweredby">Drupal</a>', array('@poweredby' => 'https://www.drupal.org')) . '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3411,30 +3487,32 @@ function system_image_toolkits() {
|
||||
/**
|
||||
* Attempts to get a file using drupal_http_request and to store it locally.
|
||||
*
|
||||
* @param $url
|
||||
* @param string $url
|
||||
* The URL of the file to grab.
|
||||
*
|
||||
* @param $destination
|
||||
* @param string $destination
|
||||
* Stream wrapper URI specifying where the file should be placed. If a
|
||||
* directory path is provided, the file is saved into that directory under
|
||||
* its original name. If the path contains a filename as well, that one will
|
||||
* be used instead.
|
||||
* If this value is omitted, the site's default files scheme will be used,
|
||||
* usually "public://".
|
||||
*
|
||||
* @param $managed boolean
|
||||
* @param bool $managed
|
||||
* If this is set to TRUE, the file API hooks will be invoked and the file is
|
||||
* registered in the database.
|
||||
*
|
||||
* @param $replace boolean
|
||||
* @param int $replace
|
||||
* Replace behavior when the destination file already exists:
|
||||
* - FILE_EXISTS_REPLACE: Replace the existing file.
|
||||
* - FILE_EXISTS_RENAME: Append _{incrementing number} until the filename is
|
||||
* unique.
|
||||
* - FILE_EXISTS_ERROR: Do nothing and return FALSE.
|
||||
*
|
||||
* @return
|
||||
* On success the location the file was saved to, FALSE on failure.
|
||||
* @return mixed
|
||||
* One of these possibilities:
|
||||
* - If it succeeds and $managed is FALSE, the location where the file was
|
||||
* saved.
|
||||
* - If it succeeds and $managed is TRUE, a \Drupal\file\FileInterface
|
||||
* object which describes the file.
|
||||
* - If it fails, FALSE.
|
||||
*/
|
||||
function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $replace = FILE_EXISTS_RENAME) {
|
||||
$parsed_url = parse_url($url);
|
||||
@@ -3469,8 +3547,7 @@ function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $repl
|
||||
function system_page_alter(&$page) {
|
||||
// Find all non-empty page regions, and add a theme wrapper function that
|
||||
// allows them to be consistently themed.
|
||||
$regions = system_region_list($GLOBALS['theme']);
|
||||
foreach (array_keys($regions) as $region) {
|
||||
foreach (system_region_list($GLOBALS['theme'], REGIONS_ALL, FALSE) as $region) {
|
||||
if (!empty($page[$region])) {
|
||||
$page[$region]['#theme_wrappers'][] = 'region';
|
||||
$page[$region]['#region'] = $region;
|
||||
|
||||
Reference in New Issue
Block a user