all contrib module security updates done

This commit is contained in:
2020-09-24 22:47:32 +02:00
parent 7d87153100
commit 0fbb9c4610
1612 changed files with 116663 additions and 32269 deletions
@@ -1,14 +1,23 @@
<?php
// Menu callback that shows menu item.
/**
* @file
* Page callbacks for Devel.
*/
/**
* Page callback: Shows a menu item.
*/
function devel_menu_item() {
$item = menu_get_item($_GET['path']);
return kdevel_print_object($item);
}
/**
* Returns a list of all currently defined user functions in the current
* request lifecycle, with links their documentation.
* Page callback: Returns a list of all currently defined user functions.
*
* Returns a list of all currently defined user functions in the current request
* lifecycle, with links their documentation.
*/
function devel_function_reference() {
$functions = get_defined_functions();
@@ -23,9 +32,13 @@ function devel_function_reference() {
}
/**
* Menu callback; clears all caches, then redirects to the previous page.
* Page callback: Clears all caches, then redirects to the previous page.
*/
function devel_cache_clear() {
if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'devel-cache-clear')) {
return MENU_ACCESS_DENIED;
}
drupal_flush_all_caches();
drupal_set_message('Cache cleared.');
@@ -33,7 +46,9 @@ function devel_cache_clear() {
drupal_goto();
}
// A menu callback. Called by the AJAX link in query log.
/**
* Page callback: Called by the AJAX link in query log.
*/
function devel_querylog_explain($request_id, $qid) {
if (!is_numeric($request_id)) {
return MENU_ACCESS_DENIED;
@@ -41,25 +56,39 @@ function devel_querylog_explain($request_id, $qid) {
$path = "temporary://devel_querylog/$request_id.txt";
$path = file_stream_wrapper_uri_normalize($path);
$queries = json_decode(file_get_contents($path));
$query = $queries[$qid];
$result = db_query('EXPLAIN ' . $query->query, (array)$query->args)->fetchAllAssoc('table');
$i = 1;
foreach ($result as $row) {
$row = (array)$row;
if ($i == 1) {
$header = array_keys($row);
$output = t('No explain log found.');
if (file_exists($path)) {
$queries = json_decode(file_get_contents($path));
if ($queries !== FALSE && isset($queries[$qid])) {
$header = $rows = array();
$query = $queries[$qid];
$result = db_query('EXPLAIN ' . $query->query, (array)$query->args)->fetchAllAssoc('table');
$i = 1;
foreach ($result as $row) {
$row = (array)$row;
if ($i == 1) {
$header = array_keys($row);
}
$rows[] = array_values($row);
$i++;
}
$output = theme('table', array('header' => $header, 'rows' => $rows));
}
$rows[] = array_values($row);
$i++;
}
// Print and return nothing thus avoiding page wrapper.
$output = theme('table', array('header' => $header, 'rows' => $rows));
print $output;
$GLOBALS['devel_shutdown'] = FALSE;
}
// A menu callback. Called by the AJAX link in query log.
/**
* Page callback: Called by the AJAX link in query log.
*/
function devel_querylog_arguments($request_id, $qid) {
if (!is_numeric($request_id)) {
return MENU_ACCESS_DENIED;
@@ -67,22 +96,30 @@ function devel_querylog_arguments($request_id, $qid) {
$path = "temporary://devel_querylog/$request_id.txt";
$path = file_stream_wrapper_uri_normalize($path);
$queries = json_decode(file_get_contents($path));
$query = $queries[$qid];
$conn = Database::getConnection();
$quoted = array();
foreach ((array)$query->args as $key => $val) {
$quoted[$key] = $conn->quote($val);
}
$output = strtr($query->query, $quoted);
// print and return nothing thus avoiding page wrapper.
$output = t('No arguments log found.');
if (file_exists($path)) {
$queries = json_decode(file_get_contents($path));
if ($queries !== FALSE && isset($queries[$qid])) {
$query = $queries[$qid];
$conn = Database::getConnection();
$quoted = array();
foreach ((array)$query->args as $key => $val) {
$quoted[$key] = $conn->quote($val);
}
$output = strtr($query->query, $quoted);
}
}
// Print and return nothing thus avoiding page wrapper.
print $output;
$GLOBALS['devel_shutdown'] = FALSE;
}
/**
* Menu callback; clear the database, resetting the menu to factory defaults.
* Page callback: Clears the database, resetting the menu to factory defaults.
*/
function devel_menu_rebuild() {
menu_rebuild();
@@ -91,7 +128,11 @@ function devel_menu_rebuild() {
}
/**
* Display a dropdown of installed modules with the option to reinstall them.
* Form constructor for reinstalling any module from a dropdown.
*
* @see devel_reinstall_submit()
*
* @ingroup forms
*/
function devel_reinstall($form, &$form_state) {
$output = '';
@@ -103,7 +144,8 @@ function devel_reinstall($form, &$form_state) {
'#options' => $options,
'#description' => t('Uninstall and then install the selected modules. <code>hook_uninstall()</code> and <code>hook_install()</code> will be executed and the schema version number will be set to the most recent update number. You may have to manually clear out any existing tables first if the module doesn\'t implement <code>hook_uninstall()</code>.'),
);
$form['submit'] = array(
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#value' => t('Reinstall'),
'#type' => 'submit',
);
@@ -111,7 +153,7 @@ function devel_reinstall($form, &$form_state) {
}
/**
* Process reinstall menu form submissions.
* Form submission callback for devel_reinstall().
*/
function devel_reinstall_submit($form, &$form_state) {
// require_once './includes/install.inc';
@@ -122,7 +164,9 @@ function devel_reinstall_submit($form, &$form_state) {
drupal_set_message(t('Uninstalled and installed: %names.', array('%names' => implode(', ', $modules))));
}
// Menu callback.
/**
* Page callback: Rebuilds the theme registry.
*/
function devel_theme_registry() {
drupal_theme_initialize();
$hooks = theme_get_registry();
@@ -130,14 +174,26 @@ function devel_theme_registry() {
return kprint_r($hooks, TRUE);
}
// Menu callback. $entity_type argument not currently used in the UI.
/**
* Page callback: Returns information from hook_entity_info().
*
* @param string $entity_type
* (optional) Limit results to the specified entity type. The default is to
* return information about all entity types. The $entity_type argument is not
* currently used in the UI.
*
* @return
* The results from kprint_r().
*/
function devel_entity_info_page($entity_type = NULL) {
$info = entity_get_info($entity_type);
ksort($info);
return kprint_r($info, TRUE);
}
// Menu callback.
/**
* Page callback: Returns information about fields.
*/
function devel_field_info_page() {
$info = field_info_fields();
$output = kprint_r($info, TRUE, t('Fields'));
@@ -145,20 +201,24 @@ function devel_field_info_page() {
$output .= kprint_r($info, TRUE, t('Instances'));
$info = field_info_bundles();
$output .= kprint_r($info, TRUE, t('Bundles'));
$info = field_info_field_types();
$output .= kprint_r($info, TRUE, t('Field types'));
$info = field_info_formatter_types();
$output .= kprint_r($info, TRUE, t('Formatter types'));
$info = field_info_storage_types();
$output .= kprint_r($info, TRUE, t('Storage types'));
$info = field_info_widget_types();
$output .= kprint_r($info, TRUE, t('Widget types'));
return $output;
}
/**
* Menu callback; display all variables.
* Form constructor for displaying and editing variables.
*
* @see devel_variable_form_submit()
*
* @ingroup forms.
*/
function devel_variable_page() {
// We return our own $page so as to avoid blocks.
$output = drupal_get_form('devel_variable_form');
drupal_set_page_content($output);
$page = element_info('page');
return $page;
}
function devel_variable_form() {
$header = array(
'name' => array('data' => t('Name'), 'field' => 'name', 'sort' => 'asc'),
@@ -166,7 +226,9 @@ function devel_variable_form() {
'length' => array('data' => t('Length'), 'field' => 'length'),
'edit' => array('data' => t('Operations')),
);
// TODO: we could get variables out of $conf but that would include hard coded ones too. ideally i would highlight overrridden/hard coded variables
// @todo: We could get variables out of $conf but that would include
// hard-coded ones too. Ideally I would highlight overridden/hard-coded
// variables.
$query = db_select('variable', 'v')->extend('TableSort');
$query->fields('v', array('name', 'value'));
switch (db_driver()) {
@@ -205,15 +267,20 @@ function devel_variable_form() {
'#options' => $options,
'#empty' => t('No variables.'),
);
$form['submit'] = array(
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
);
$form['#after_build'][] = 'devel_variable_form_after_build';
// krumo($form);
return $form;
}
/**
* Form submission handler for devel_variable_form().
*/
function devel_variable_form_submit($form, &$form_state) {
$deletes = array_filter($form_state['values']['variables']);
array_walk($deletes, 'variable_del');
@@ -222,6 +289,25 @@ function devel_variable_form_submit($form, &$form_state) {
}
}
/**
* After build callback for devel_variable_form().
*
* Wrap each variable name in a <label> element.
*/
function devel_variable_form_after_build($form, &$form_state) {
foreach ($form['variables']['#options'] as $variable => $element) {
$form['variables']['#options'][$variable]['name'] = '<label for="' . $form['variables'][$variable]['#id'] . '">' . $element['name'] . '</label>';
}
return $form;
}
/**
* Form constructor for editing a variable.
*
* @see devel_variable_edit_submit()
*
* @ingroup forms
*/
function devel_variable_edit($form, &$form_state, $name) {
$value = variable_get($name, 'not found');
$form['name'] = array(
@@ -239,7 +325,8 @@ function devel_variable_edit($form, &$form_state, $name) {
'#title' => t('New value'),
'#default_value' => $value
);
$form['submit'] = array(
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
@@ -256,6 +343,9 @@ function devel_variable_edit($form, &$form_state, $name) {
return $form;
}
/**
* Form submission handler for devel_variable_edit().
*/
function devel_variable_edit_submit($form, &$form_state) {
variable_set($form_state['values']['name'], $form_state['values']['new']);
drupal_set_message(t('Saved new value for %name.', array('%name' => $form_state['values']['name'])));
@@ -263,7 +353,7 @@ function devel_variable_edit_submit($form, &$form_state) {
}
/**
* Menu callback: display the session.
* Page callback: Displays the session.
*/
function devel_session() {
global $user;
@@ -274,7 +364,7 @@ function devel_session() {
}
/**
* Menu callback; prints the loaded structure of the current node/user.
* Page callback: Prints the loaded structure of the current node/user.
*/
function devel_load_object($type, $object, $name = NULL) {
$name = isset($name) ? $name : $type;
@@ -282,19 +372,45 @@ function devel_load_object($type, $object, $name = NULL) {
}
/**
* Menu callback; prints the render structure of the current object (currently node or user).
* Page callback: Prints the render structure of the current object.
*
* @param string $type
* The type of entity that will be displayed.
* @param object $object
* The entity to display.
* @param string $name
* (optional) The label to use when displaying the entity.
*
* @return
* The results from kdevel_print_object().
*/
function devel_render_object($type, $object, $name = NULL) {
$name = isset($name) ? $name : $type;
$function = $type . '_view';
$build = $function($object);
switch ($function) {
case 'comment_view':
$node = node_load($object->nid);
$build = $function($object, $node);
break;
default:
$build = $function($object);
}
return kdevel_print_object($build, '$'. $name .'->');
}
/**
* Page callback: Returns information from hook_elements().
*/
function devel_elements_page() {
return kdevel_print_object(module_invoke_all('element_info'));
}
/**
* Page callback: Returns the results from phpinfo().
*/
function devel_phpinfo() {
print phpinfo();
drupal_exit();