Compare commits
72
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49a0944412 | ||
|
|
d6e525465b | ||
|
|
91e0ff102e | ||
|
|
be549a75f6 | ||
|
|
1e27fcca51 | ||
|
|
ab5d43a397 | ||
|
|
094d6ec86f | ||
|
|
6475b0c126 | ||
|
|
a7f0bb7650 | ||
|
|
50d08c7efd | ||
|
|
4e780cb6d4 | ||
|
|
26fadc74e4 | ||
|
|
9f043d25e9 | ||
|
|
72e8abe604 | ||
|
|
637ff76ca8 | ||
|
|
ad25acf851 | ||
|
|
0f3912f6fd | ||
|
|
2553869978 | ||
|
|
d1290e31bc | ||
|
|
598f09bba5 | ||
|
|
fb11eac920 | ||
|
|
0973d0afe5 | ||
|
|
785eea77db | ||
|
|
2e69e3fd4c | ||
|
|
dc39ddbbea | ||
|
|
c97e0f8ba1 | ||
|
|
9adc940a67 | ||
|
|
58cd990c8c | ||
|
|
e08a2639c6 | ||
|
|
2ffad14939 | ||
|
|
33210e10f2 | ||
|
|
472762edfa | ||
|
|
89287879bc | ||
|
|
3411804c42 | ||
|
|
de0f246fb3 | ||
|
|
a180696fc7 | ||
|
|
ccd47590d5 | ||
|
|
5dd6874488 | ||
|
|
514f3bd89e | ||
|
|
0aea7a0db1 | ||
|
|
b2fe2731c2 | ||
|
|
f6e72bbe19 | ||
|
|
6fb9e4806d | ||
|
|
b764ef206e | ||
|
|
0615369680 | ||
|
|
954fc9ead1 | ||
|
|
79db3e3896 | ||
|
|
5510ac0abf | ||
|
|
2d23821da4 | ||
|
|
fca4395934 | ||
|
|
31cfa90501 | ||
|
|
ccab226e12 | ||
|
|
1b53514906 | ||
|
|
25b41d2a43 | ||
|
|
eb20184257 | ||
|
|
c285c6ccb8 | ||
|
|
fa07acdd31 | ||
|
|
9ad0aa199f | ||
|
|
7ab8742528 | ||
|
|
8ec6b54b6c | ||
|
|
f21817dec1 | ||
|
|
4cb8f6aee1 | ||
|
|
b3e863e943 | ||
|
|
4aed87ebd0 | ||
|
|
fafd439b26 | ||
|
|
226561ffd4 | ||
|
|
85772b4ca7 | ||
|
|
57376251fa | ||
|
|
8a05ca54b2 | ||
|
|
9344a61b61 | ||
|
|
18f4aba146 | ||
|
|
1eb61fe020 |
@@ -27,3 +27,5 @@ typescript
|
||||
|
||||
sync_uploads
|
||||
|
||||
vendor
|
||||
|
||||
|
||||
Executable → Regular
+110
@@ -1,3 +1,113 @@
|
||||
Drupal 7.73, 2020-09-16
|
||||
-----------------------
|
||||
- Fixed security issues:
|
||||
- SA-CORE-2020-007
|
||||
|
||||
Drupal 7.72, 2020-06-17
|
||||
-----------------------
|
||||
- Fixed security issues:
|
||||
- SA-CORE-2020-004
|
||||
|
||||
Drupal 7.71, 2020-06-03
|
||||
-----------------------
|
||||
- Fix for jQuery Form bug in Chromium-based browsers
|
||||
- Full support for PHP 7.4
|
||||
|
||||
Drupal 7.70, 2020-05-19
|
||||
-----------------------
|
||||
- Fixed security issues:
|
||||
- SA-CORE-2020-002
|
||||
- SA-CORE-2020-003
|
||||
|
||||
Drupal 7.69, 2019-12-18
|
||||
-----------------------
|
||||
- Fixed security issues:
|
||||
- SA-CORE-2019-012
|
||||
|
||||
Drupal 7.68, 2019-12-04
|
||||
-----------------------
|
||||
- Fixed: Hide toolbar when printing
|
||||
- Fixed: Settings returned via ajax are not run through hook_js_alter()
|
||||
- Fixed: Use drupal_http_build_query() in drupal_http_request()
|
||||
- Fixed: DrupalRequestSanitizer not found fatal error when bootstrap phase order is changed
|
||||
- Fixed: Block web.config in .htaccess (and vice-versa)
|
||||
- Fixed: Create "scripts" element to align rendering workflow to how "styles" are handled
|
||||
- PHP 7.3: Fixed 'Cannot change session id when session is active'
|
||||
- PHP 7.1: Fixed 'A non-numeric value encountered in theme_pager()'
|
||||
- PHP 7.x: Fixed file.inc generated .htaccess does not cover PHP 7
|
||||
- PHP 5.3: Fixed check_plain() 'Invalid multibyte sequence in argument' test failures
|
||||
- Fixed: Allow passing data as array to drupal_http_request()
|
||||
- Fixed: Skip module_invoke/module_hook in calling hook_watchdog (excessive function_exist)
|
||||
- Fixed: HTTP status 200 returned for 'Additional uncaught exception thrown while handling exception'
|
||||
- Fixed: theme_table() should take an optional footer variable and produce <tfoot>
|
||||
- Fixed: 'uasort() expects parameter 1 to be array, null given in node_view_multiple()'
|
||||
- [regression] Fix default.settings.php permission
|
||||
|
||||
Drupal 7.67, 2019-05-08
|
||||
-----------------------
|
||||
- Fixed security issues:
|
||||
- SA-CORE-2019-007
|
||||
|
||||
Drupal 7.66, 2019-04-17
|
||||
-----------------------
|
||||
- Fixed security issues:
|
||||
- SA-CORE-2019-006
|
||||
|
||||
Drupal 7.65, 2019-03-20
|
||||
-----------------------
|
||||
- Fixed security issues:
|
||||
- SA-CORE-2019-004
|
||||
|
||||
Drupal 7.64, 2019-02-06
|
||||
-----------------------
|
||||
- [regression] Unset the 'host' header in drupal_http_request() during redirect
|
||||
- Fixed: 7.x does not have Phar protection and Phar tests are failing on Drupal 7
|
||||
- Fixed: Notice: Undefined index: display_field in file_field_widget_value() (line 582 of /module/file/file.field.inc)
|
||||
- Performance improvement: Registry rebuild should not parse the same file twice in the same request
|
||||
- Fixed _registry_update() to clear caches after transaction is committed
|
||||
|
||||
Drupal 7.63, 2019-01-16
|
||||
-----------------------
|
||||
- Fixed a fatal error for some Drush users introduced by SA-CORE-2019-002.
|
||||
|
||||
Drupal 7.62, 2019-01-15
|
||||
-----------------------
|
||||
- Fixed security issues:
|
||||
- SA-CORE-2019-001
|
||||
- SA-CORE-2019-002
|
||||
|
||||
Drupal 7.61, 2018-11-07
|
||||
-----------------------
|
||||
- File upload validation functions and hook_file_validate() implementations are
|
||||
now always passed the correct file URI.
|
||||
- The default form cache expiration of 6 hours is now configurable (API
|
||||
addition: https://www.drupal.org/node/2857751).
|
||||
- Allowed callers of drupal_http_request() to optionally specify an explicit
|
||||
Host header.
|
||||
- Allowed the + character to appear in usernames.
|
||||
- PHP 7.2: Fixed Archive_Tar incompatibility.
|
||||
- PHP 7.2: Removed deprecated function each().
|
||||
- PHP 7.2: Avoid count() calls on uncountable variables.
|
||||
- PHP 7.2: Removed deprecated create_function() call.
|
||||
- PHP 7.2: Make sure variables are arrays in theme_links().
|
||||
- Fixed theme-settings.php not being loaded on cached forms
|
||||
- Fixed problem with IE11 & Chrome(PointerEvents enabled) & some Firefox scroll to the top of the page after dragging the bottom item with jquery 1.5 <-> 1.11
|
||||
|
||||
Drupal 7.60, 2018-10-18
|
||||
------------------------
|
||||
- Fixed security issues. See SA-CORE-2018-006.
|
||||
|
||||
Drupal 7.59, 2018-04-25
|
||||
-----------------------
|
||||
- Fixed security issues (remote code execution). See SA-CORE-2018-004.
|
||||
|
||||
Drupal 7.58, 2018-03-28
|
||||
-----------------------
|
||||
- Fixed security issues (remote code execution). See SA-CORE-2018-002.
|
||||
|
||||
Drupal 7.57, 2018-02-21
|
||||
-----------------------
|
||||
- Fixed security issues (multiple vulnerabilities). See SA-CORE-2018-001.
|
||||
|
||||
Drupal 7.56, 2017-06-21
|
||||
-----------------------
|
||||
|
||||
Executable → Regular
Executable → Regular
+2
-5
@@ -11,10 +11,8 @@ The Drupal Core branch maintainers oversee the development of Drupal as a whole.
|
||||
The branch maintainers for Drupal 7 are:
|
||||
|
||||
- Dries Buytaert 'dries' https://www.drupal.org/u/dries
|
||||
- Angela Byron 'webchick' https://www.drupal.org/u/webchick
|
||||
- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx
|
||||
- David Rothstein 'David_Rothstein' https://www.drupal.org/u/david_rothstein
|
||||
- Stefan Ruijsenaars 'stefan.r' https://www.drupal.org/u/stefanr-0
|
||||
- (provisional) Drew Webber 'mcdruid' https://www.drupal.org/u/mcdruid
|
||||
|
||||
|
||||
Component maintainers
|
||||
@@ -44,10 +42,9 @@ Cron system
|
||||
- Derek Wright 'dww' https://www.drupal.org/u/dww
|
||||
|
||||
Database system
|
||||
- Larry Garfield 'Crell' https://www.drupal.org/u/crell
|
||||
- ?
|
||||
|
||||
- MySQL driver
|
||||
- Larry Garfield 'Crell' https://www.drupal.org/u/crell
|
||||
- David Strauss 'David Strauss' https://www.drupal.org/u/david-strauss
|
||||
|
||||
- PostgreSQL driver
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Core Patches :
|
||||
- Implement language aware tokens for one time login link and cancel link
|
||||
https://www.drupal.org/node/1754162
|
||||
|
||||
//- est-ce que je dois faire ce patch ???
|
||||
//includes/entity.inc
|
||||
//see https://www.drupal.org/node/1003788
|
||||
|
||||
# Modules :
|
||||
Redis
|
||||
- https://www.drupal.org/project/redis/issues/3074189
|
||||
cer
|
||||
contentadminrelink
|
||||
entityreference
|
||||
feedback
|
||||
filter_path_alias
|
||||
flag_lists
|
||||
- https://www.drupal.org/project/flag_lists/issues/2114731
|
||||
login_tobogan (pd with field permission et donc field collection)
|
||||
- https://www.drupal.org/node/1365764#comment-10286257
|
||||
- logintoboggan-exempting_lt_preauth_role_from_user_permissions_js-1365764-52.patch
|
||||
- interdiff-1365764-23-52-do-not-test.diff
|
||||
node_export :
|
||||
- https://www.drupal.org/node/1869918
|
||||
- https://www.drupal.org/node/1911638
|
||||
termreferencetree
|
||||
?? views
|
||||
views_rss_media
|
||||
- https://www.drupal.org/node/2472409
|
||||
- https://www.drupal.org/project/views_rss_media/issues/2149287
|
||||
wysiwyg
|
||||
@@ -1,35 +0,0 @@
|
||||
# Core Patches :
|
||||
- Implement language aware tokens for one time login link and cancel link
|
||||
https://www.drupal.org/node/1754162
|
||||
|
||||
//- est-ce que je dois faire ce patch ???
|
||||
//includes/entity.inc
|
||||
//see https://www.drupal.org/node/1003788
|
||||
|
||||
|
||||
# Modules :
|
||||
|
||||
link : allow any tld (https://www.drupal.org/node/2299657#comment-11414075)
|
||||
cer
|
||||
contentadminrelink
|
||||
// entity_translation_search_api
|
||||
entityreference
|
||||
feedback
|
||||
// field_group
|
||||
filter_path_alias
|
||||
// flag_lists
|
||||
// nodeformcols
|
||||
// search_api
|
||||
// search_api_page
|
||||
// search_api_solr
|
||||
termreferencetree
|
||||
views
|
||||
wysiwyg
|
||||
views_rss_media
|
||||
node_export :
|
||||
- https://www.drupal.org/node/1869918
|
||||
- https://www.drupal.org/node/1911638
|
||||
login_tobogan (pd with field permission et donc field collection)
|
||||
- https://www.drupal.org/node/1365764#comment-10286257
|
||||
- logintoboggan-exempting_lt_preauth_role_from_user_permissions_js-1365764-52.patch
|
||||
- interdiff-1365764-23-52-do-not-test.diff
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"require": {
|
||||
"drush/drush": "8.*"
|
||||
},
|
||||
"extra": {
|
||||
"installer-paths": {
|
||||
"core": ["type:drupal-core"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1354
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
diff --git a/flag_lists.module b/flag_lists.module
|
||||
index d829113..b3c04f0 100644
|
||||
--- a/flag_lists.module
|
||||
+++ b/flag_lists.module
|
||||
@@ -1587,6 +1587,32 @@ function flag_lists_fix_link(&$link, $action) {
|
||||
return $fcid;
|
||||
}
|
||||
|
||||
+
|
||||
+ /**
|
||||
+ * Remove all entries of entity_id and type
|
||||
+ *
|
||||
+ * @param $entity_id
|
||||
+ * Entity id which has been flagged.
|
||||
+ * @param $type
|
||||
+ * The entity type.
|
||||
+ */
|
||||
+ function _flag_lists_remove_entity($entity_id, $type) {
|
||||
+ $query = db_select('flag_lists_content')
|
||||
+ ->condition('entity_id', $entity_id)
|
||||
+ ->condition('entity_type', $type);
|
||||
+ $query->fields('flag_lists_content', array('fcid', 'fid', 'uid', 'sid'));
|
||||
+ $items = $query->execute()->fetchAll();
|
||||
+
|
||||
+ if ($items) {
|
||||
+ foreach ($items as $key => $value) {
|
||||
+ db_delete('flag_lists_content')
|
||||
+ ->condition('fcid', $value->fcid)
|
||||
+ ->execute();
|
||||
+ watchdog('flag_lists', t('Deleted entry @fcid from flat_lists_content', array('@fcid' => $value->fcid)));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Updates the flag count for this content
|
||||
*/
|
||||
@@ -1766,3 +1792,17 @@ function flag_lists_views_form_substitutions() {
|
||||
$select_all_placeholder => drupal_render($select_all),
|
||||
);
|
||||
}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * Implements hook_entity_delete
|
||||
+ */
|
||||
+function flag_lists_entity_delete($entity, $type) {
|
||||
+ foreach (flag_get_flags($type) as $flag) {
|
||||
+ if (isset($entity->vid)) {
|
||||
+ $items = _flag_lists_remove_entity($entity->vid, $type);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
Executable → Regular
Executable → Regular
+1
@@ -294,6 +294,7 @@ function ajax_render($commands = array()) {
|
||||
|
||||
// Now add a command to merge changes and additions to Drupal.settings.
|
||||
$scripts = drupal_add_js();
|
||||
drupal_alter('js', $scripts);
|
||||
if (!empty($scripts['settings'])) {
|
||||
$settings = $scripts['settings'];
|
||||
array_unshift($commands, ajax_command_settings(drupal_array_merge_deep_array($settings['data']), TRUE));
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
+7
-8
@@ -478,18 +478,17 @@ function _batch_finished() {
|
||||
$queue->deleteQueue();
|
||||
}
|
||||
}
|
||||
// Clean-up the session. Not needed for CLI updates.
|
||||
if (isset($_SESSION)) {
|
||||
unset($_SESSION['batches'][$batch['id']]);
|
||||
if (empty($_SESSION['batches'])) {
|
||||
unset($_SESSION['batches']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$_batch = $batch;
|
||||
$batch = NULL;
|
||||
|
||||
// Clean-up the session. Not needed for CLI updates.
|
||||
if (isset($_SESSION)) {
|
||||
unset($_SESSION['batches'][$batch['id']]);
|
||||
if (empty($_SESSION['batches'])) {
|
||||
unset($_SESSION['batches']);
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect if needed.
|
||||
if ($_batch['progressive']) {
|
||||
// Revert the 'destination' that was saved in batch_process().
|
||||
|
||||
Executable → Regular
Executable → Regular
+34
-6
@@ -8,7 +8,7 @@
|
||||
/**
|
||||
* The current system version.
|
||||
*/
|
||||
define('VERSION', '7.56');
|
||||
define('VERSION', '7.73');
|
||||
|
||||
/**
|
||||
* Core API compatibility.
|
||||
@@ -704,6 +704,19 @@ function drupal_environment_initialize() {
|
||||
// Set sane locale settings, to ensure consistent string, dates, times and
|
||||
// numbers handling.
|
||||
setlocale(LC_ALL, 'C');
|
||||
|
||||
// PHP's built-in phar:// stream wrapper is not sufficiently secure. Override
|
||||
// it with a more secure one, which requires PHP 5.3.3. For lower versions,
|
||||
// unregister the built-in one without replacing it. Sites needing phar
|
||||
// support for lower PHP versions must implement hook_stream_wrappers() to
|
||||
// register their desired implementation.
|
||||
if (in_array('phar', stream_get_wrappers(), TRUE)) {
|
||||
stream_wrapper_unregister('phar');
|
||||
if (version_compare(PHP_VERSION, '5.3.3', '>=')) {
|
||||
include_once DRUPAL_ROOT . '/includes/file.phar.inc';
|
||||
file_register_phar_wrapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1985,7 +1998,7 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
|
||||
|
||||
// It is possible that the error handling will itself trigger an error. In that case, we could
|
||||
// end up in an infinite loop. To avoid that, we implement a simple static semaphore.
|
||||
if (!$in_error_state && function_exists('module_implements')) {
|
||||
if (!$in_error_state && function_exists('module_invoke_all')) {
|
||||
$in_error_state = TRUE;
|
||||
|
||||
// The user object may not exist in all conditions, so 0 is substituted if needed.
|
||||
@@ -2008,9 +2021,7 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
|
||||
);
|
||||
|
||||
// Call the logging hooks to log/process the message
|
||||
foreach (module_implements('watchdog') as $module) {
|
||||
module_invoke($module, 'watchdog', $log_entry);
|
||||
}
|
||||
module_invoke_all('watchdog', $log_entry);
|
||||
|
||||
// It is critical that the semaphore is only cleared here, in the parent
|
||||
// watchdog() call (not outside the loop), to prevent recursive execution.
|
||||
@@ -2505,6 +2516,7 @@ function drupal_bootstrap($phase = NULL, $new_phase = TRUE) {
|
||||
|
||||
switch ($current_phase) {
|
||||
case DRUPAL_BOOTSTRAP_CONFIGURATION:
|
||||
require_once DRUPAL_ROOT . '/includes/request-sanitizer.inc';
|
||||
_drupal_bootstrap_configuration();
|
||||
break;
|
||||
|
||||
@@ -2609,6 +2621,10 @@ function _drupal_exception_handler($exception) {
|
||||
_drupal_log_error(_drupal_decode_exception($exception), TRUE);
|
||||
}
|
||||
catch (Exception $exception2) {
|
||||
// Add a 500 status code in case an exception was thrown before the 500
|
||||
// status could be set (e.g. while loading a maintenance theme from cache).
|
||||
drupal_add_http_header('Status', '500 Internal Server Error');
|
||||
|
||||
// Another uncaught exception was thrown while handling the first one.
|
||||
// If we are displaying errors, then do so with no possibility of a further uncaught exception being thrown.
|
||||
if (error_displayable()) {
|
||||
@@ -2632,6 +2648,9 @@ function _drupal_bootstrap_configuration() {
|
||||
timer_start('page');
|
||||
// Initialize the configuration, including variables from settings.php.
|
||||
drupal_settings_initialize();
|
||||
|
||||
// Sanitize unsafe keys from the request.
|
||||
DrupalRequestSanitizer::sanitize();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2774,6 +2793,11 @@ function _drupal_bootstrap_variables() {
|
||||
unset($_GET['destination']);
|
||||
unset($_REQUEST['destination']);
|
||||
}
|
||||
// Use the DrupalRequestSanitizer to ensure that the destination's query
|
||||
// parameters are not dangerous.
|
||||
if (isset($_GET['destination'])) {
|
||||
DrupalRequestSanitizer::cleanDestination();
|
||||
}
|
||||
// If there's still something in $_REQUEST['destination'] that didn't come
|
||||
// from $_GET, check it too.
|
||||
if (isset($_REQUEST['destination']) && (!isset($_GET['destination']) || $_REQUEST['destination'] != $_GET['destination']) && url_is_external($_REQUEST['destination'])) {
|
||||
@@ -3776,8 +3800,12 @@ function _drupal_shutdown_function() {
|
||||
chdir(DRUPAL_ROOT);
|
||||
|
||||
try {
|
||||
while (list($key, $callback) = each($callbacks)) {
|
||||
// Manually iterate over the array instead of using a foreach loop.
|
||||
// A foreach operates on a copy of the array, so any shutdown functions that
|
||||
// were added from other shutdown functions would never be called.
|
||||
while ($callback = current($callbacks)) {
|
||||
call_user_func_array($callback['callback'], $callback['arguments']);
|
||||
next($callbacks);
|
||||
}
|
||||
}
|
||||
catch (Exception $exception) {
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
+126
-49
@@ -391,7 +391,7 @@ function drupal_add_feed($url = NULL, $title = '') {
|
||||
*/
|
||||
function drupal_get_feeds($delimiter = "\n") {
|
||||
$feeds = drupal_add_feed();
|
||||
return implode($feeds, $delimiter);
|
||||
return implode($delimiter, $feeds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -611,8 +611,9 @@ function drupal_parse_url($url) {
|
||||
}
|
||||
// The 'q' parameter contains the path of the current page if clean URLs are
|
||||
// disabled. It overrides the 'path' of the URL when present, even if clean
|
||||
// URLs are enabled, due to how Apache rewriting rules work.
|
||||
if (isset($options['query']['q'])) {
|
||||
// URLs are enabled, due to how Apache rewriting rules work. The path
|
||||
// parameter must be a string.
|
||||
if (isset($options['query']['q']) && is_string($options['query']['q'])) {
|
||||
$options['path'] = $options['query']['q'];
|
||||
unset($options['query']['q']);
|
||||
}
|
||||
@@ -683,7 +684,10 @@ function drupal_goto($path = '', array $options = array(), $http_response_code =
|
||||
// We do not allow absolute URLs to be passed via $_GET, as this can be an attack vector.
|
||||
if (isset($_GET['destination']) && !url_is_external($_GET['destination'])) {
|
||||
$destination = drupal_parse_url($_GET['destination']);
|
||||
$path = $destination['path'];
|
||||
// Double check the path derived by drupal_parse_url() is not external.
|
||||
if (!url_is_external($destination['path'])) {
|
||||
$path = $destination['path'];
|
||||
}
|
||||
$options['query'] = $destination['query'];
|
||||
$options['fragment'] = $destination['fragment'];
|
||||
}
|
||||
@@ -759,9 +763,10 @@ function drupal_access_denied() {
|
||||
* (optional) An array that can have one or more of the following elements:
|
||||
* - headers: An array containing request headers to send as name/value pairs.
|
||||
* - method: A string containing the request method. Defaults to 'GET'.
|
||||
* - data: A string containing the request body, formatted as
|
||||
* 'param=value¶m=value&...'; to generate this, use http_build_query().
|
||||
* Defaults to NULL.
|
||||
* - data: An array containing the values for the request body or a string
|
||||
* containing the request body, formatted as
|
||||
* 'param=value¶m=value&...'; to generate this, use
|
||||
* drupal_http_build_query(). Defaults to NULL.
|
||||
* - max_redirects: An integer representing how many times a redirect
|
||||
* may be followed. Defaults to 3.
|
||||
* - timeout: A float representing the maximum number of seconds the function
|
||||
@@ -787,7 +792,7 @@ function drupal_access_denied() {
|
||||
* easy access the array keys are returned in lower case.
|
||||
* - data: A string containing the response body that was received.
|
||||
*
|
||||
* @see http_build_query()
|
||||
* @see drupal_http_build_query()
|
||||
*/
|
||||
function drupal_http_request($url, array $options = array()) {
|
||||
// Allow an alternate HTTP client library to replace Drupal's default
|
||||
@@ -866,8 +871,10 @@ function drupal_http_request($url, array $options = array()) {
|
||||
// Make the socket connection to a proxy server.
|
||||
$socket = 'tcp://' . $proxy_server . ':' . variable_get('proxy_port', 8080);
|
||||
// The Host header still needs to match the real request.
|
||||
$options['headers']['Host'] = $uri['host'];
|
||||
$options['headers']['Host'] .= isset($uri['port']) && $uri['port'] != 80 ? ':' . $uri['port'] : '';
|
||||
if (!isset($options['headers']['Host'])) {
|
||||
$options['headers']['Host'] = $uri['host'];
|
||||
$options['headers']['Host'] .= isset($uri['port']) && $uri['port'] != 80 ? ':' . $uri['port'] : '';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'http':
|
||||
@@ -877,14 +884,18 @@ function drupal_http_request($url, array $options = array()) {
|
||||
// RFC 2616: "non-standard ports MUST, default ports MAY be included".
|
||||
// We don't add the standard port to prevent from breaking rewrite rules
|
||||
// checking the host that do not take into account the port number.
|
||||
$options['headers']['Host'] = $uri['host'] . ($port != 80 ? ':' . $port : '');
|
||||
if (!isset($options['headers']['Host'])) {
|
||||
$options['headers']['Host'] = $uri['host'] . ($port != 80 ? ':' . $port : '');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'https':
|
||||
// Note: Only works when PHP is compiled with OpenSSL support.
|
||||
$port = isset($uri['port']) ? $uri['port'] : 443;
|
||||
$socket = 'ssl://' . $uri['host'] . ':' . $port;
|
||||
$options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : '');
|
||||
if (!isset($options['headers']['Host'])) {
|
||||
$options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : '');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -923,6 +934,11 @@ function drupal_http_request($url, array $options = array()) {
|
||||
$path .= '?' . $uri['query'];
|
||||
}
|
||||
|
||||
// Convert array $options['data'] to query string.
|
||||
if (is_array($options['data'])) {
|
||||
$options['data'] = drupal_http_build_query($options['data']);
|
||||
}
|
||||
|
||||
// Only add Content-Length if we actually have any content or if it is a POST
|
||||
// or PUT request. Some non-standard servers get confused by Content-Length in
|
||||
// at least HEAD/GET requests, and Squid always requires Content-Length in
|
||||
@@ -1087,6 +1103,11 @@ function drupal_http_request($url, array $options = array()) {
|
||||
elseif ($options['max_redirects']) {
|
||||
// Redirect to the new location.
|
||||
$options['max_redirects']--;
|
||||
|
||||
// We need to unset the 'Host' header
|
||||
// as we are redirecting to a new location.
|
||||
unset($options['headers']['Host']);
|
||||
|
||||
$result = drupal_http_request($location, $options);
|
||||
$result->redirect_code = $code;
|
||||
}
|
||||
@@ -2236,8 +2257,11 @@ function url($path = NULL, array $options = array()) {
|
||||
'prefix' => ''
|
||||
);
|
||||
|
||||
// Determine whether this is an external link, but ensure that the current
|
||||
// path is always treated as internal by default (to prevent external link
|
||||
// injection vulnerabilities).
|
||||
if (!isset($options['external'])) {
|
||||
$options['external'] = url_is_external($path);
|
||||
$options['external'] = $path === $_GET['q'] ? FALSE : url_is_external($path);
|
||||
}
|
||||
|
||||
// Preserve the original path before altering or aliasing.
|
||||
@@ -2307,7 +2331,10 @@ function url($path = NULL, array $options = array()) {
|
||||
$language = isset($options['language']) && isset($options['language']->language) ? $options['language']->language : '';
|
||||
$alias = drupal_get_path_alias($original_path, $language);
|
||||
if ($alias != $original_path) {
|
||||
$path = $alias;
|
||||
// Strip leading slashes from internal path aliases to prevent them
|
||||
// becoming external URLs without protocol. /example.com should not be
|
||||
// turned into //example.com.
|
||||
$path = ltrim($alias, '/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3716,7 +3743,7 @@ function _drupal_build_css_path($matches, $base = NULL) {
|
||||
}
|
||||
|
||||
// Prefix with base and remove '../' segments where possible.
|
||||
$path = $_base . $matches[1];
|
||||
$path = $_base . (isset($matches[1]) ? $matches[1] : '');
|
||||
$last = '';
|
||||
while ($path != $last) {
|
||||
$last = $path;
|
||||
@@ -4423,12 +4450,54 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
|
||||
}
|
||||
}
|
||||
|
||||
$output = '';
|
||||
// The index counter is used to keep aggregated and non-aggregated files in
|
||||
// order by weight.
|
||||
$index = 1;
|
||||
$processed = array();
|
||||
$files = array();
|
||||
// Sort the JavaScript so that it appears in the correct order.
|
||||
uasort($items, 'drupal_sort_css_js');
|
||||
|
||||
// Provide the page with information about the individual JavaScript files
|
||||
// used, information not otherwise available when aggregation is enabled.
|
||||
$setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1);
|
||||
unset($setting['ajaxPageState']['js']['settings']);
|
||||
drupal_add_js($setting, 'setting');
|
||||
|
||||
// If we're outputting the header scope, then this might be the final time
|
||||
// that drupal_get_js() is running, so add the setting to this output as well
|
||||
// as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's
|
||||
// because drupal_get_js() was intentionally passed a $javascript argument
|
||||
// stripped off settings, potentially in order to override how settings get
|
||||
// output, so in this case, do not add the setting to this output.
|
||||
if ($scope == 'header' && isset($items['settings'])) {
|
||||
$items['settings']['data'][] = $setting;
|
||||
}
|
||||
|
||||
$elements = array(
|
||||
'#type' => 'scripts',
|
||||
'#items' => $items,
|
||||
);
|
||||
|
||||
return drupal_render($elements);
|
||||
}
|
||||
|
||||
/**
|
||||
* The #pre_render callback for the "scripts" element.
|
||||
*
|
||||
* This callback adds elements needed for <script> tags to be rendered.
|
||||
*
|
||||
* @param array $elements
|
||||
* A render array containing:
|
||||
* - '#items': The JS items as returned by drupal_add_js() and altered by
|
||||
* drupal_get_js().
|
||||
*
|
||||
* @return array
|
||||
* The $elements variable passed as argument with two more children keys:
|
||||
* - "scripts": contains the Javascript items
|
||||
* - "settings": contains the Javascript settings items.
|
||||
* If those keys are already existing, then the items will be appended and
|
||||
* their keys will be preserved.
|
||||
*
|
||||
* @see drupal_get_js()
|
||||
* @see drupal_add_js()
|
||||
*/
|
||||
function drupal_pre_render_scripts(array $elements) {
|
||||
$preprocess_js = (variable_get('preprocess_js', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update'));
|
||||
|
||||
// A dummy query-string is added to filenames, to gain control over
|
||||
@@ -4449,34 +4518,29 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
|
||||
// third-party code might require the use of a different query string.
|
||||
$js_version_string = variable_get('drupal_js_version_query_string', 'v=');
|
||||
|
||||
// Sort the JavaScript so that it appears in the correct order.
|
||||
uasort($items, 'drupal_sort_css_js');
|
||||
$files = array();
|
||||
|
||||
// Provide the page with information about the individual JavaScript files
|
||||
// used, information not otherwise available when aggregation is enabled.
|
||||
$setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1);
|
||||
unset($setting['ajaxPageState']['js']['settings']);
|
||||
drupal_add_js($setting, 'setting');
|
||||
$scripts = isset($elements['scripts']) ? $elements['scripts'] : array();
|
||||
$scripts += array('#weight' => 0);
|
||||
|
||||
// If we're outputting the header scope, then this might be the final time
|
||||
// that drupal_get_js() is running, so add the setting to this output as well
|
||||
// as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's
|
||||
// because drupal_get_js() was intentionally passed a $javascript argument
|
||||
// stripped off settings, potentially in order to override how settings get
|
||||
// output, so in this case, do not add the setting to this output.
|
||||
if ($scope == 'header' && isset($items['settings'])) {
|
||||
$items['settings']['data'][] = $setting;
|
||||
}
|
||||
$settings = isset($elements['settings']) ? $elements['settings'] : array();
|
||||
$settings += array('#weight' => $scripts['#weight'] + 10);
|
||||
|
||||
// The index counter is used to keep aggregated and non-aggregated files in
|
||||
// order by weight. Use existing scripts count as a starting point.
|
||||
$index = count(element_children($scripts)) + 1;
|
||||
|
||||
// Loop through the JavaScript to construct the rendered output.
|
||||
$element = array(
|
||||
'#type' => 'html_tag',
|
||||
'#tag' => 'script',
|
||||
'#value' => '',
|
||||
'#attributes' => array(
|
||||
'type' => 'text/javascript',
|
||||
),
|
||||
);
|
||||
foreach ($items as $item) {
|
||||
|
||||
foreach ($elements['#items'] as $item) {
|
||||
$query_string = empty($item['version']) ? $default_query_string : $js_version_string . $item['version'];
|
||||
|
||||
switch ($item['type']) {
|
||||
@@ -4485,7 +4549,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
|
||||
$js_element['#value_prefix'] = $embed_prefix;
|
||||
$js_element['#value'] = 'jQuery.extend(Drupal.settings, ' . drupal_json_encode(drupal_array_merge_deep_array($item['data'])) . ");";
|
||||
$js_element['#value_suffix'] = $embed_suffix;
|
||||
$output .= theme('html_tag', array('element' => $js_element));
|
||||
$settings[] = $js_element;
|
||||
break;
|
||||
|
||||
case 'inline':
|
||||
@@ -4496,7 +4560,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
|
||||
$js_element['#value_prefix'] = $embed_prefix;
|
||||
$js_element['#value'] = $item['data'];
|
||||
$js_element['#value_suffix'] = $embed_suffix;
|
||||
$processed[$index++] = theme('html_tag', array('element' => $js_element));
|
||||
$scripts[$index++] = $js_element;
|
||||
break;
|
||||
|
||||
case 'file':
|
||||
@@ -4507,7 +4571,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
|
||||
}
|
||||
$query_string_separator = (strpos($item['data'], '?') !== FALSE) ? '&' : '?';
|
||||
$js_element['#attributes']['src'] = file_create_url($item['data']) . $query_string_separator . ($item['cache'] ? $query_string : REQUEST_TIME);
|
||||
$processed[$index++] = theme('html_tag', array('element' => $js_element));
|
||||
$scripts[$index++] = $js_element;
|
||||
}
|
||||
else {
|
||||
// By increasing the index for each aggregated file, we maintain
|
||||
@@ -4518,7 +4582,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
|
||||
// leading to better front-end performance of a website as a whole.
|
||||
// See drupal_add_js() for details.
|
||||
$key = 'aggregate_' . $item['group'] . '_' . $item['every_page'] . '_' . $index;
|
||||
$processed[$key] = '';
|
||||
$scripts[$key] = '';
|
||||
$files[$key][$item['data']] = $item;
|
||||
}
|
||||
break;
|
||||
@@ -4530,7 +4594,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
|
||||
$js_element['#attributes']['defer'] = 'defer';
|
||||
}
|
||||
$js_element['#attributes']['src'] = $item['data'];
|
||||
$processed[$index++] = theme('html_tag', array('element' => $js_element));
|
||||
$scripts[$index++] = $js_element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4545,14 +4609,18 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
|
||||
$preprocess_file = file_create_url($uri);
|
||||
$js_element = $element;
|
||||
$js_element['#attributes']['src'] = $preprocess_file;
|
||||
$processed[$key] = theme('html_tag', array('element' => $js_element));
|
||||
$scripts[$key] = $js_element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Keep the order of JS files consistent as some are preprocessed and others are not.
|
||||
// Make sure any inline or JS setting variables appear last after libraries have loaded.
|
||||
return implode('', $processed) . $output;
|
||||
// Keep the order of JS files consistent as some are preprocessed and others
|
||||
// are not. Make sure any inline or JS setting variables appear last after
|
||||
// libraries have loaded.
|
||||
$element['scripts'] = $scripts;
|
||||
$element['settings'] = $settings;
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6588,7 +6656,7 @@ function element_children(&$elements, $sort = FALSE) {
|
||||
$children = array();
|
||||
$sortable = FALSE;
|
||||
foreach ($elements as $key => $value) {
|
||||
if ($key === '' || $key[0] !== '#') {
|
||||
if (is_int($key) || $key === '' || $key[0] !== '#') {
|
||||
$children[$key] = $value;
|
||||
if (is_array($value) && isset($value['#weight'])) {
|
||||
$sortable = TRUE;
|
||||
@@ -6934,7 +7002,16 @@ function drupal_common_theme() {
|
||||
'variables' => array(),
|
||||
),
|
||||
'table' => array(
|
||||
'variables' => array('header' => NULL, 'rows' => NULL, 'attributes' => array(), 'caption' => NULL, 'colgroups' => array(), 'sticky' => TRUE, 'empty' => ''),
|
||||
'variables' => array(
|
||||
'header' => NULL,
|
||||
'footer' => NULL,
|
||||
'rows' => NULL,
|
||||
'attributes' => array(),
|
||||
'caption' => NULL,
|
||||
'colgroups' => array(),
|
||||
'sticky' => TRUE,
|
||||
'empty' => '',
|
||||
),
|
||||
),
|
||||
'tablesort_indicator' => array(
|
||||
'variables' => array('style' => NULL),
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+53
-5
@@ -532,6 +532,9 @@ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
|
||||
<IfModule mod_php5.c>
|
||||
php_flag engine off
|
||||
</IfModule>
|
||||
<IfModule mod_php7.c>
|
||||
php_flag engine off
|
||||
</IfModule>
|
||||
EOF;
|
||||
|
||||
if ($private) {
|
||||
@@ -993,8 +996,15 @@ function file_build_uri($path) {
|
||||
* @return
|
||||
* The destination filepath, or FALSE if the file already exists
|
||||
* and FILE_EXISTS_ERROR is specified.
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* Thrown if the filename contains invalid UTF-8.
|
||||
*/
|
||||
function file_destination($destination, $replace) {
|
||||
$basename = drupal_basename($destination);
|
||||
if (!drupal_validate_utf8($basename)) {
|
||||
throw new RuntimeException(sprintf("Invalid filename '%s'", $basename));
|
||||
}
|
||||
if (file_exists($destination)) {
|
||||
switch ($replace) {
|
||||
case FILE_EXISTS_REPLACE:
|
||||
@@ -1002,7 +1012,6 @@ function file_destination($destination, $replace) {
|
||||
break;
|
||||
|
||||
case FILE_EXISTS_RENAME:
|
||||
$basename = drupal_basename($destination);
|
||||
$directory = drupal_dirname($destination);
|
||||
$destination = file_create_filename($basename, $directory);
|
||||
break;
|
||||
@@ -1218,11 +1227,20 @@ function file_unmunge_filename($filename) {
|
||||
* @return
|
||||
* File path consisting of $directory and a unique filename based off
|
||||
* of $basename.
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* Thrown if the $basename is not valid UTF-8 or another error occurs
|
||||
* stripping control characters.
|
||||
*/
|
||||
function file_create_filename($basename, $directory) {
|
||||
$original = $basename;
|
||||
// Strip control characters (ASCII value < 32). Though these are allowed in
|
||||
// some filesystems, not many applications handle them well.
|
||||
$basename = preg_replace('/[\x00-\x1F]/u', '_', $basename);
|
||||
if (preg_last_error() !== PREG_NO_ERROR) {
|
||||
throw new RuntimeException(sprintf("Invalid filename '%s'", $original));
|
||||
}
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
// These characters are not allowed in Windows filenames
|
||||
$basename = str_replace(array(':', '*', '?', '"', '<', '>', '|'), '_', $basename);
|
||||
@@ -1534,9 +1552,9 @@ function file_save_upload($form_field_name, $validators = array(), $destination
|
||||
// rename filename.php.foo and filename.php to filename.php.foo.txt and
|
||||
// filename.php.txt, respectively). Don't rename if 'allow_insecure_uploads'
|
||||
// evaluates to TRUE.
|
||||
if (!variable_get('allow_insecure_uploads', 0) && preg_match('/\.(php|pl|py|cgi|asp|js)(\.|$)/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
|
||||
if (!variable_get('allow_insecure_uploads', 0) && preg_match('/\.(php|phar|pl|py|cgi|asp|js)(\.|$)/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
|
||||
$file->filemime = 'text/plain';
|
||||
$file->uri .= '.txt';
|
||||
// The destination filename will also later be used to create the URI.
|
||||
$file->filename .= '.txt';
|
||||
// The .txt extension may not be in the allowed list of extensions. We have
|
||||
// to add it here or else the file upload will fail.
|
||||
@@ -1563,7 +1581,13 @@ function file_save_upload($form_field_name, $validators = array(), $destination
|
||||
if (substr($destination, -1) != '/') {
|
||||
$destination .= '/';
|
||||
}
|
||||
$file->destination = file_destination($destination . $file->filename, $replace);
|
||||
try {
|
||||
$file->destination = file_destination($destination . $file->filename, $replace);
|
||||
}
|
||||
catch (RuntimeException $e) {
|
||||
drupal_set_message(t('The file %source could not be uploaded because the name is invalid.', array('%source' => $form_field_name)), 'error');
|
||||
return FALSE;
|
||||
}
|
||||
// If file_destination() returns FALSE then $replace == FILE_EXISTS_ERROR and
|
||||
// there's an existing file so we need to bail.
|
||||
if ($file->destination === FALSE) {
|
||||
@@ -2130,9 +2154,33 @@ function file_download_access($uri) {
|
||||
* 'filename', and 'name' members corresponding to the matching files.
|
||||
*/
|
||||
function file_scan_directory($dir, $mask, $options = array(), $depth = 0) {
|
||||
// Default nomask option.
|
||||
$nomask = '/(\.\.?|CVS)$/';
|
||||
|
||||
// Overrides the $nomask variable accordingly if $options['nomask'] is set.
|
||||
//
|
||||
// Allow directories specified in settings.php to be ignored. You can use this
|
||||
// to not check for files in common special-purpose directories. For example,
|
||||
// node_modules and bower_components. Ignoring irrelevant directories is a
|
||||
// performance boost.
|
||||
if (!isset($options['nomask'])) {
|
||||
$ignore_directories = variable_get(
|
||||
'file_scan_ignore_directories',
|
||||
array()
|
||||
);
|
||||
|
||||
foreach ($ignore_directories as $index => $ignore_directory) {
|
||||
$ignore_directories[$index] = preg_quote($ignore_directory, '/');
|
||||
}
|
||||
|
||||
if (!empty($ignore_directories)) {
|
||||
$nomask = '/^(\.\.?)|CVS|' . implode('|', $ignore_directories) . '$/';
|
||||
}
|
||||
}
|
||||
|
||||
// Merge in defaults.
|
||||
$options += array(
|
||||
'nomask' => '/(\.\.?|CVS)$/',
|
||||
'nomask' => $nomask,
|
||||
'callback' => 0,
|
||||
'recurse' => TRUE,
|
||||
'key' => 'uri',
|
||||
|
||||
Executable → Regular
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Drupal\Core\Security\PharExtensionInterceptor;
|
||||
use TYPO3\PharStreamWrapper\Manager as PharStreamWrapperManager;
|
||||
use TYPO3\PharStreamWrapper\Behavior as PharStreamWrapperBehavior;
|
||||
use TYPO3\PharStreamWrapper\PharStreamWrapper;
|
||||
|
||||
/**
|
||||
* Registers a phar stream wrapper that is more secure than PHP's built-in one.
|
||||
*
|
||||
* @see file_get_stream_wrappers()
|
||||
*/
|
||||
function file_register_phar_wrapper() {
|
||||
$directory = DRUPAL_ROOT . '/misc/typo3/phar-stream-wrapper/src';
|
||||
include_once $directory . '/Assertable.php';
|
||||
include_once $directory . '/Behavior.php';
|
||||
include_once $directory . '/Exception.php';
|
||||
include_once $directory . '/Helper.php';
|
||||
include_once $directory . '/Manager.php';
|
||||
include_once $directory . '/PharStreamWrapper.php';
|
||||
include_once $directory . '/Collectable.php';
|
||||
include_once $directory . '/Interceptor/ConjunctionInterceptor.php';
|
||||
include_once $directory . '/Interceptor/PharMetaDataInterceptor.php';
|
||||
include_once $directory . '/Phar/Container.php';
|
||||
include_once $directory . '/Phar/DeserializationException.php';
|
||||
include_once $directory . '/Phar/Manifest.php';
|
||||
include_once $directory . '/Phar/Reader.php';
|
||||
include_once $directory . '/Phar/ReaderException.php';
|
||||
include_once $directory . '/Phar/Stub.php';
|
||||
include_once $directory . '/Resolvable.php';
|
||||
include_once $directory . '/Resolver/PharInvocation.php';
|
||||
include_once $directory . '/Resolver/PharInvocationCollection.php';
|
||||
include_once $directory . '/Resolver/PharInvocationResolver.php';
|
||||
include_once DRUPAL_ROOT . '/misc/typo3/drupal-security/PharExtensionInterceptor.php';
|
||||
include_once DRUPAL_ROOT . '/misc/brumann/polyfill-unserialize/src/Unserialize.php';
|
||||
|
||||
// Set up a stream wrapper to handle insecurities due to PHP's built-in
|
||||
// phar stream wrapper.
|
||||
try {
|
||||
$behavior = new PharStreamWrapperBehavior();
|
||||
PharStreamWrapperManager::initialize(
|
||||
$behavior->withAssertion(new PharExtensionInterceptor())
|
||||
);
|
||||
}
|
||||
catch (\LogicException $e) {
|
||||
// Continue if the PharStreamWrapperManager is already initialized.
|
||||
// For example, this occurs following a drupal_static_reset(), such
|
||||
// as during tests.
|
||||
};
|
||||
|
||||
// To prevent file_stream_wrapper_valid_scheme() treating "phar" as a valid
|
||||
// scheme, this is registered with PHP only, not with hook_stream_wrappers()
|
||||
// or the internal storage of file_get_stream_wrappers().
|
||||
stream_wrapper_register('phar', '\\TYPO3\\PharStreamWrapper\\PharStreamWrapper');
|
||||
}
|
||||
Executable → Regular
+1
-1
@@ -301,7 +301,7 @@ abstract class FileTransfer {
|
||||
$parts = explode('/', $path);
|
||||
$chroot = '';
|
||||
while (count($parts)) {
|
||||
$check = implode($parts, '/');
|
||||
$check = implode('/', $parts);
|
||||
if ($this->isFile($check . '/' . drupal_basename(__FILE__))) {
|
||||
// Remove the trailing slash.
|
||||
return substr($chroot, 0, -1);
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+17
-9
@@ -555,8 +555,10 @@ function form_get_cache($form_build_id, &$form_state) {
|
||||
* Stores a form in the cache.
|
||||
*/
|
||||
function form_set_cache($form_build_id, $form, $form_state) {
|
||||
// 6 hours cache life time for forms should be plenty.
|
||||
$expire = 21600;
|
||||
// The default cache_form expiration is 6 hours. On busy sites, the cache_form
|
||||
// table can become very large. A shorter cache lifetime can help to keep the
|
||||
// table's size under control.
|
||||
$expire = variable_get('form_cache_expiration', 21600);
|
||||
|
||||
// Ensure that the form build_id embedded in the form structure is the same as
|
||||
// the one passed in as a parameter. This is an additional safety measure to
|
||||
@@ -1133,12 +1135,8 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
|
||||
* Helper function to call form_set_error() if there is a token error.
|
||||
*/
|
||||
function _drupal_invalid_token_set_form_error() {
|
||||
$path = current_path();
|
||||
$query = drupal_get_query_parameters();
|
||||
$url = url($path, array('query' => $query));
|
||||
|
||||
// Setting this error will cause the form to fail validation.
|
||||
form_set_error('form_token', t('The form has become outdated. Copy any unsaved work in the form below and then <a href="@link">reload this page</a>.', array('@link' => $url)));
|
||||
form_set_error('form_token', t('The form has become outdated. Press the back button, copy any unsaved work in the form, and then reload the page.'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1179,6 +1177,11 @@ function drupal_validate_form($form_id, &$form, &$form_state) {
|
||||
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();
|
||||
// Ignore all submitted values.
|
||||
$form_state['input'] = array();
|
||||
$_POST = array();
|
||||
// Make sure file uploads do not get processed.
|
||||
$_FILES = array();
|
||||
// Stop here and don't run any further validation handlers, because they
|
||||
// could invoke non-safe operations which opens the door for CSRF
|
||||
// vulnerabilities.
|
||||
@@ -1438,10 +1441,12 @@ function _form_validate(&$elements, &$form_state, $form_id = NULL) {
|
||||
// length if it's a string, and the item count if it's an array.
|
||||
// An unchecked checkbox has a #value of integer 0, different than string
|
||||
// '0', which could be a valid value.
|
||||
$is_empty_multiple = (!count($elements['#value']));
|
||||
$is_countable = is_array($elements['#value']) || $elements['#value'] instanceof Countable;
|
||||
$is_empty_multiple = $is_countable && count($elements['#value']) == 0;
|
||||
$is_empty_string = (is_string($elements['#value']) && drupal_strlen(trim($elements['#value'])) == 0);
|
||||
$is_empty_value = ($elements['#value'] === 0);
|
||||
if ($is_empty_multiple || $is_empty_string || $is_empty_value) {
|
||||
$is_empty_null = is_null($elements['#value']);
|
||||
if ($is_empty_multiple || $is_empty_string || $is_empty_value || $is_empty_null) {
|
||||
// Although discouraged, a #title is not mandatory for form elements. In
|
||||
// case there is no #title, we cannot set a form error message.
|
||||
// Instead of setting no #title, form constructors are encouraged to set
|
||||
@@ -1844,6 +1849,9 @@ function form_builder($form_id, &$element, &$form_state) {
|
||||
_drupal_invalid_token_set_form_error();
|
||||
// This value is checked in _form_builder_handle_input_element().
|
||||
$form_state['invalid_token'] = TRUE;
|
||||
// Ignore all submitted values.
|
||||
$form_state['input'] = array();
|
||||
$_POST = array();
|
||||
// Make sure file uploads do not get processed.
|
||||
$_FILES = array();
|
||||
}
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+1
-1
@@ -779,7 +779,7 @@ function drupal_uninstall_modules($module_list = array(), $uninstall_dependents
|
||||
$module_list = array_flip(array_values($module_list));
|
||||
|
||||
$profile = drupal_get_profile();
|
||||
while (list($module) = each($module_list)) {
|
||||
foreach (array_keys($module_list) as $module) {
|
||||
if (!isset($module_data[$module]) || drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) {
|
||||
// This module doesn't exist or is already uninstalled. Skip it.
|
||||
unset($module_list[$module]);
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+9
-3
@@ -576,7 +576,8 @@ function _menu_load_objects(&$item, &$map) {
|
||||
// 'load arguments' in the hook_menu() entry, but they need
|
||||
// some processing. In this case the $function is the key to the
|
||||
// load_function array, and the value is the list of arguments.
|
||||
list($function, $args) = each($function);
|
||||
$args = current($function);
|
||||
$function = key($function);
|
||||
$load_functions[$index] = $function;
|
||||
|
||||
// Some arguments are placeholders for dynamic items to process.
|
||||
@@ -2402,7 +2403,8 @@ function menu_set_active_trail($new_trail = NULL) {
|
||||
// a stripped down menu tree containing the active trail only, in case
|
||||
// the given menu has not been built in this request yet.
|
||||
$tree = menu_tree_page_data($preferred_link['menu_name'], NULL, TRUE);
|
||||
list($key, $curr) = each($tree);
|
||||
$curr = current($tree);
|
||||
next($tree);
|
||||
}
|
||||
// There is no link for the current path.
|
||||
else {
|
||||
@@ -2432,7 +2434,8 @@ function menu_set_active_trail($new_trail = NULL) {
|
||||
}
|
||||
$tree = $curr['below'] ? $curr['below'] : array();
|
||||
}
|
||||
list($key, $curr) = each($tree);
|
||||
$curr = current($tree);
|
||||
next($tree);
|
||||
}
|
||||
// Make sure the current page is in the trail to build the page title, by
|
||||
// appending either the preferred link or the menu router item for the
|
||||
@@ -2480,6 +2483,9 @@ function menu_link_get_preferred($path = NULL, $selected_menu = NULL) {
|
||||
// untranslated paths). Afterwards, the most relevant path is picked from
|
||||
// the menus, ordered by menu preference.
|
||||
$item = menu_get_item($path);
|
||||
if ($item === FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
$path_candidates = array();
|
||||
// 1. The current item href.
|
||||
$path_candidates[$item['href']] = $item['href'];
|
||||
|
||||
Executable → Regular
+10
-2
@@ -404,7 +404,11 @@ function module_enable($module_list, $enable_dependencies = TRUE) {
|
||||
// Create an associative array with weights as values.
|
||||
$module_list = array_flip(array_values($module_list));
|
||||
|
||||
while (list($module) = each($module_list)) {
|
||||
// The array is iterated over manually (instead of using a foreach) because
|
||||
// modules may be added to the list within the loop and we need to process
|
||||
// them.
|
||||
while ($module = key($module_list)) {
|
||||
next($module_list);
|
||||
if (!isset($module_data[$module])) {
|
||||
// This module is not found in the filesystem, abort.
|
||||
return FALSE;
|
||||
@@ -540,7 +544,11 @@ function module_disable($module_list, $disable_dependents = TRUE) {
|
||||
$module_list = array_flip(array_values($module_list));
|
||||
|
||||
$profile = drupal_get_profile();
|
||||
while (list($module) = each($module_list)) {
|
||||
// The array is iterated over manually (instead of using a foreach) because
|
||||
// modules may be added to the list within the loop and we need to process
|
||||
// them.
|
||||
while ($module = key($module_list)) {
|
||||
next($module_list);
|
||||
if (!isset($module_data[$module]) || !$module_data[$module]->status) {
|
||||
// This module doesn't exist or is already disabled, skip it.
|
||||
unset($module_list[$module]);
|
||||
|
||||
Executable → Regular
+31
-1
@@ -321,9 +321,19 @@ function theme_pager($variables) {
|
||||
$tags = $variables['tags'];
|
||||
$element = $variables['element'];
|
||||
$parameters = $variables['parameters'];
|
||||
$quantity = $variables['quantity'];
|
||||
$quantity = empty($variables['quantity']) ? 0 : $variables['quantity'];
|
||||
global $pager_page_array, $pager_total;
|
||||
|
||||
// Nothing to do if there is no pager.
|
||||
if (!isset($pager_page_array[$element]) || !isset($pager_total[$element])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Nothing to do if there is only one page.
|
||||
if ($pager_total[$element] <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate various markers within this pager piece:
|
||||
// Middle is used to "center" pages around the current page.
|
||||
$pager_middle = ceil($quantity / 2);
|
||||
@@ -455,6 +465,11 @@ function theme_pager_first($variables) {
|
||||
global $pager_page_array;
|
||||
$output = '';
|
||||
|
||||
// Nothing to do if there is no pager.
|
||||
if (!isset($pager_page_array[$element])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are anywhere but the first page
|
||||
if ($pager_page_array[$element] > 0) {
|
||||
$output = theme('pager_link', array('text' => $text, 'page_new' => pager_load_array(0, $element, $pager_page_array), 'element' => $element, 'parameters' => $parameters));
|
||||
@@ -485,6 +500,11 @@ function theme_pager_previous($variables) {
|
||||
global $pager_page_array;
|
||||
$output = '';
|
||||
|
||||
// Nothing to do if there is no pager.
|
||||
if (!isset($pager_page_array[$element])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are anywhere but the first page
|
||||
if ($pager_page_array[$element] > 0) {
|
||||
$page_new = pager_load_array($pager_page_array[$element] - $interval, $element, $pager_page_array);
|
||||
@@ -524,6 +544,11 @@ function theme_pager_next($variables) {
|
||||
global $pager_page_array, $pager_total;
|
||||
$output = '';
|
||||
|
||||
// Nothing to do if there is no pager.
|
||||
if (!isset($pager_page_array[$element]) || !isset($pager_total[$element])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are anywhere but the last page
|
||||
if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
|
||||
$page_new = pager_load_array($pager_page_array[$element] + $interval, $element, $pager_page_array);
|
||||
@@ -560,6 +585,11 @@ function theme_pager_last($variables) {
|
||||
global $pager_page_array, $pager_total;
|
||||
$output = '';
|
||||
|
||||
// Nothing to do if there is no pager.
|
||||
if (!isset($pager_page_array[$element]) || !isset($pager_total[$element])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are anywhere but the last page
|
||||
if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
|
||||
$output = theme('pager_link', array('text' => $text, 'page_new' => pager_load_array($pager_total[$element] - 1, $element, $pager_page_array), 'element' => $element, 'parameters' => $parameters));
|
||||
|
||||
Executable → Regular
Executable → Regular
+8
-6
@@ -466,13 +466,15 @@ function path_delete($criteria) {
|
||||
$criteria = array('pid' => $criteria);
|
||||
}
|
||||
$path = path_load($criteria);
|
||||
$query = db_delete('url_alias');
|
||||
foreach ($criteria as $field => $value) {
|
||||
$query->condition($field, $value);
|
||||
if (isset($path['source'])) {
|
||||
$query = db_delete('url_alias');
|
||||
foreach ($criteria as $field => $value) {
|
||||
$query->condition($field, $value);
|
||||
}
|
||||
$query->execute();
|
||||
module_invoke_all('path_delete', $path);
|
||||
drupal_clear_path_cache($path['source']);
|
||||
}
|
||||
$query->execute();
|
||||
module_invoke_all('path_delete', $path);
|
||||
drupal_clear_path_cache($path['source']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Executable → Regular
+30
-5
@@ -19,7 +19,6 @@
|
||||
* Does the work for registry_update().
|
||||
*/
|
||||
function _registry_update() {
|
||||
|
||||
// The registry serves as a central autoloader for all classes, including
|
||||
// the database query builders. However, the registry rebuild process
|
||||
// requires write ability to the database, which means having access to the
|
||||
@@ -33,6 +32,11 @@ function _registry_update() {
|
||||
require_once DRUPAL_ROOT . '/includes/database/select.inc';
|
||||
require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/query.inc';
|
||||
|
||||
// During the first registry rebuild in a request, we check all the files.
|
||||
// During subsequent rebuilds, we only add new files. It makes the rebuilding
|
||||
// process faster during installation of modules.
|
||||
static $check_existing_files = TRUE;
|
||||
|
||||
// Get current list of modules and their files.
|
||||
$modules = db_query("SELECT * FROM {system} WHERE type = 'module'")->fetchAll();
|
||||
// Get the list of files we are going to parse.
|
||||
@@ -55,6 +59,9 @@ function _registry_update() {
|
||||
$files["$filename"] = array('module' => '', 'weight' => 0);
|
||||
}
|
||||
|
||||
// Initialize an empty array for the unchanged files.
|
||||
$unchanged_files = array();
|
||||
|
||||
$transaction = db_transaction();
|
||||
try {
|
||||
// Allow modules to manually modify the list of files before the registry
|
||||
@@ -63,10 +70,19 @@ function _registry_update() {
|
||||
// list can then be added to the list of files that the registry will parse,
|
||||
// or modify attributes of a file.
|
||||
drupal_alter('registry_files', $files, $modules);
|
||||
|
||||
foreach (registry_get_parsed_files() as $filename => $file) {
|
||||
// Add the hash for those files we have already parsed.
|
||||
if (isset($files[$filename])) {
|
||||
$files[$filename]['hash'] = $file['hash'];
|
||||
if ($check_existing_files === TRUE) {
|
||||
$files[$filename]['hash'] = $file['hash'];
|
||||
}
|
||||
else {
|
||||
// Ignore that file for this request, it has been parsed previously
|
||||
// and it is unlikely it has changed.
|
||||
unset($files[$filename]);
|
||||
$unchanged_files[$filename] = $file;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Flush the registry of resources in files that are no longer on disc
|
||||
@@ -79,8 +95,12 @@ function _registry_update() {
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
||||
$parsed_files = _registry_parse_files($files);
|
||||
|
||||
// Add unchanged files to the files.
|
||||
$files += $unchanged_files;
|
||||
|
||||
$unchanged_resources = array();
|
||||
$lookup_cache = array();
|
||||
if ($cache = cache_get('lookup_cache', 'cache_bootstrap')) {
|
||||
@@ -89,12 +109,10 @@ function _registry_update() {
|
||||
foreach ($lookup_cache as $key => $file) {
|
||||
// If the file for this cached resource is carried over unchanged from
|
||||
// the last registry build, then we can safely re-cache it.
|
||||
if ($file && in_array($file, array_keys($files)) && !in_array($file, $parsed_files)) {
|
||||
if ($file && isset($files[$file]) && !in_array($file, $parsed_files, TRUE)) {
|
||||
$unchanged_resources[$key] = $file;
|
||||
}
|
||||
}
|
||||
module_implements('', FALSE, TRUE);
|
||||
_registry_check_code(REGISTRY_RESET_LOOKUP_CACHE);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$transaction->rollback();
|
||||
@@ -102,6 +120,13 @@ function _registry_update() {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
module_implements('', FALSE, TRUE);
|
||||
_registry_check_code(REGISTRY_RESET_LOOKUP_CACHE);
|
||||
|
||||
// During the next run in this request, don't bother re-checking existing
|
||||
// files.
|
||||
$check_existing_files = FALSE;
|
||||
|
||||
// We have some unchanged resources, warm up the cache - no need to pay
|
||||
// for looking them up again.
|
||||
if (count($unchanged_resources) > 0) {
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains code for sanitizing user input from the request.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sanitizes user input from the request.
|
||||
*/
|
||||
class DrupalRequestSanitizer {
|
||||
|
||||
/**
|
||||
* Tracks whether the request was already sanitized.
|
||||
*/
|
||||
protected static $sanitized = FALSE;
|
||||
|
||||
/**
|
||||
* Modifies the request to strip dangerous keys from user input.
|
||||
*/
|
||||
public static function sanitize() {
|
||||
if (!self::$sanitized) {
|
||||
$whitelist = variable_get('sanitize_input_whitelist', array());
|
||||
$log_sanitized_keys = variable_get('sanitize_input_logging', FALSE);
|
||||
|
||||
// Process query string parameters.
|
||||
$get_sanitized_keys = array();
|
||||
$_GET = self::stripDangerousValues($_GET, $whitelist, $get_sanitized_keys);
|
||||
if ($log_sanitized_keys && $get_sanitized_keys) {
|
||||
_drupal_trigger_error_with_delayed_logging(format_string('Potentially unsafe keys removed from query string parameters (GET): @keys', array('@keys' => implode(', ', $get_sanitized_keys))), E_USER_NOTICE);
|
||||
}
|
||||
|
||||
// Process request body parameters.
|
||||
$post_sanitized_keys = array();
|
||||
$_POST = self::stripDangerousValues($_POST, $whitelist, $post_sanitized_keys);
|
||||
if ($log_sanitized_keys && $post_sanitized_keys) {
|
||||
_drupal_trigger_error_with_delayed_logging(format_string('Potentially unsafe keys removed from request body parameters (POST): @keys', array('@keys' => implode(', ', $post_sanitized_keys))), E_USER_NOTICE);
|
||||
}
|
||||
|
||||
// Process cookie parameters.
|
||||
$cookie_sanitized_keys = array();
|
||||
$_COOKIE = self::stripDangerousValues($_COOKIE, $whitelist, $cookie_sanitized_keys);
|
||||
if ($log_sanitized_keys && $cookie_sanitized_keys) {
|
||||
_drupal_trigger_error_with_delayed_logging(format_string('Potentially unsafe keys removed from cookie parameters (COOKIE): @keys', array('@keys' => implode(', ', $cookie_sanitized_keys))), E_USER_NOTICE);
|
||||
}
|
||||
|
||||
$request_sanitized_keys = array();
|
||||
$_REQUEST = self::stripDangerousValues($_REQUEST, $whitelist, $request_sanitized_keys);
|
||||
|
||||
self::$sanitized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the destination if it is dangerous.
|
||||
*
|
||||
* Note this can only be called after common.inc has been included.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the destination has been removed from $_GET, FALSE if not.
|
||||
*/
|
||||
public static function cleanDestination() {
|
||||
$dangerous_keys = array();
|
||||
$log_sanitized_keys = variable_get('sanitize_input_logging', FALSE);
|
||||
|
||||
$parts = drupal_parse_url($_GET['destination']);
|
||||
// If there is a query string, check its query parameters.
|
||||
if (!empty($parts['query'])) {
|
||||
$whitelist = variable_get('sanitize_input_whitelist', array());
|
||||
|
||||
self::stripDangerousValues($parts['query'], $whitelist, $dangerous_keys);
|
||||
if (!empty($dangerous_keys)) {
|
||||
// The destination is removed rather than sanitized to mirror the
|
||||
// handling of external destinations.
|
||||
unset($_GET['destination']);
|
||||
unset($_REQUEST['destination']);
|
||||
if ($log_sanitized_keys) {
|
||||
trigger_error(format_string('Potentially unsafe destination removed from query string parameters (GET) because it contained the following keys: @keys', array('@keys' => implode(', ', $dangerous_keys))));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips dangerous keys from the provided input.
|
||||
*
|
||||
* @param mixed $input
|
||||
* The input to sanitize.
|
||||
* @param string[] $whitelist
|
||||
* An array of keys to whitelist as safe.
|
||||
* @param string[] $sanitized_keys
|
||||
* An array of keys that have been removed.
|
||||
*
|
||||
* @return mixed
|
||||
* The sanitized input.
|
||||
*/
|
||||
protected static function stripDangerousValues($input, array $whitelist, array &$sanitized_keys) {
|
||||
if (is_array($input)) {
|
||||
foreach ($input as $key => $value) {
|
||||
if ($key !== '' && is_string($key) && $key[0] === '#' && !in_array($key, $whitelist, TRUE)) {
|
||||
unset($input[$key]);
|
||||
$sanitized_keys[] = $key;
|
||||
}
|
||||
else {
|
||||
$input[$key] = self::stripDangerousValues($input[$key], $whitelist, $sanitized_keys);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+24
-1
@@ -371,8 +371,11 @@ function drupal_session_regenerate() {
|
||||
|
||||
if (drupal_session_started()) {
|
||||
$old_session_id = session_id();
|
||||
_drupal_session_regenerate_existing();
|
||||
}
|
||||
else {
|
||||
session_id(drupal_random_key());
|
||||
}
|
||||
session_id(drupal_random_key());
|
||||
|
||||
if (isset($old_session_id)) {
|
||||
$params = session_get_cookie_params();
|
||||
@@ -412,6 +415,26 @@ function drupal_session_regenerate() {
|
||||
date_default_timezone_set(drupal_get_user_timezone());
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerates an existing session.
|
||||
*/
|
||||
function _drupal_session_regenerate_existing() {
|
||||
global $user;
|
||||
// Preserve existing settings for the saving of sessions.
|
||||
$original_save_session_status = drupal_save_session();
|
||||
// Turn off saving of sessions.
|
||||
drupal_save_session(FALSE);
|
||||
session_write_close();
|
||||
drupal_session_started(FALSE);
|
||||
// Preserve the user object, as starting a new session will reset it.
|
||||
$original_user = $user;
|
||||
session_id(drupal_random_key());
|
||||
drupal_session_start();
|
||||
$user = $original_user;
|
||||
// Restore the original settings for the saving of sessions.
|
||||
drupal_save_session($original_save_session_status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Session handler assigned by session_set_save_handler().
|
||||
*
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
+70
-31
@@ -1776,13 +1776,13 @@ function theme_link($variables) {
|
||||
* http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
|
||||
*/
|
||||
function theme_links($variables) {
|
||||
$links = $variables['links'];
|
||||
$attributes = $variables['attributes'];
|
||||
$links = (array) $variables['links'];
|
||||
$attributes = (array) $variables['attributes'];
|
||||
$heading = $variables['heading'];
|
||||
global $language_url;
|
||||
$output = '';
|
||||
|
||||
if (count($links) > 0) {
|
||||
if (!empty($links)) {
|
||||
// Treat the heading first if it is present to prepend it to the
|
||||
// list of links.
|
||||
if (!empty($heading)) {
|
||||
@@ -1911,7 +1911,7 @@ function theme_breadcrumb($variables) {
|
||||
/**
|
||||
* Returns HTML for a table.
|
||||
*
|
||||
* @param $variables
|
||||
* @param array $variables
|
||||
* An associative array containing:
|
||||
* - header: An array containing the table headers. Each element of the array
|
||||
* can be either a localized string or an associative array with the
|
||||
@@ -1948,6 +1948,11 @@ function theme_breadcrumb($variables) {
|
||||
* )
|
||||
* );
|
||||
* @endcode
|
||||
* - footer: An array of table rows which will be printed within a <tfoot>
|
||||
* tag, in the same format as the rows element (see above).
|
||||
* The structure is the same the one defined for the "rows" key except
|
||||
* that the no_striping boolean has no effect, there is no rows striping
|
||||
* for the table footer.
|
||||
* - attributes: An array of HTML attributes to apply to the table tag.
|
||||
* - caption: A localized string to use for the <caption> tag.
|
||||
* - colgroups: An array of column groups. Each element of the array can be
|
||||
@@ -1984,8 +1989,11 @@ function theme_breadcrumb($variables) {
|
||||
* - sticky: Use a "sticky" table header.
|
||||
* - empty: The message to display in an extra row if table does not have any
|
||||
* rows.
|
||||
*
|
||||
* @return string
|
||||
* The HTML output.
|
||||
*/
|
||||
function theme_table($variables) {
|
||||
function theme_table(array $variables) {
|
||||
$header = $variables['header'];
|
||||
$rows = $variables['rows'];
|
||||
$attributes = $variables['attributes'];
|
||||
@@ -1995,7 +2003,7 @@ function theme_table($variables) {
|
||||
$empty = $variables['empty'];
|
||||
|
||||
// Add sticky headers, if applicable.
|
||||
if (count($header) && $sticky) {
|
||||
if (!empty($header) && $sticky) {
|
||||
drupal_add_js('misc/tableheader.js');
|
||||
// Add 'sticky-enabled' class to the table to identify it for JS.
|
||||
// This is needed to target tables constructed by this function.
|
||||
@@ -2009,7 +2017,7 @@ function theme_table($variables) {
|
||||
}
|
||||
|
||||
// Format the table columns:
|
||||
if (count($colgroups)) {
|
||||
if (!empty($colgroups)) {
|
||||
foreach ($colgroups as $number => $colgroup) {
|
||||
$attributes = array();
|
||||
|
||||
@@ -2044,46 +2052,74 @@ function theme_table($variables) {
|
||||
}
|
||||
|
||||
// Add the 'empty' row message if available.
|
||||
if (!count($rows) && $empty) {
|
||||
if (empty($rows) && $empty) {
|
||||
$header_count = 0;
|
||||
foreach ($header as $header_cell) {
|
||||
if (is_array($header_cell)) {
|
||||
$header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1;
|
||||
}
|
||||
else {
|
||||
$header_count++;
|
||||
if (!empty($header)) {
|
||||
foreach ($header as $header_cell) {
|
||||
if (is_array($header_cell)) {
|
||||
$header_count += isset($header_cell['colspan']) ?
|
||||
$header_cell['colspan'] : 1;
|
||||
}
|
||||
else {
|
||||
$header_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$rows[] = array(array('data' => $empty, 'colspan' => $header_count, 'class' => array('empty', 'message')));
|
||||
$rows[] = array(
|
||||
array(
|
||||
'data' => $empty,
|
||||
'colspan' => $header_count,
|
||||
'class' => array(
|
||||
'empty',
|
||||
'message'
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Format the table header:
|
||||
if (count($header)) {
|
||||
// Format the table header.
|
||||
if (!empty($header)) {
|
||||
$ts = tablesort_init($header);
|
||||
// HTML requires that the thead tag has tr tags in it followed by tbody
|
||||
// tags. Using ternary operator to check and see if we have any rows.
|
||||
$output .= (count($rows) ? ' <thead><tr>' : ' <tr>');
|
||||
$output .= (!empty($rows) ? ' <thead><tr>' : ' <tr>');
|
||||
foreach ($header as $cell) {
|
||||
$cell = tablesort_header($cell, $header, $ts);
|
||||
$output .= _theme_table_cell($cell, TRUE);
|
||||
}
|
||||
// Using ternary operator to close the tags based on whether or not there are rows
|
||||
$output .= (count($rows) ? " </tr></thead>\n" : "</tr>\n");
|
||||
// Using ternary operator to close the tags based on whether
|
||||
// or not there are rows.
|
||||
$output .= (!empty($rows) ? " </tr></thead>\n" : "</tr>\n");
|
||||
}
|
||||
else {
|
||||
$ts = array();
|
||||
}
|
||||
|
||||
// Format the table rows:
|
||||
if (count($rows)) {
|
||||
$output .= "<tbody>\n";
|
||||
// Format the table and footer rows.
|
||||
$sections = array();
|
||||
|
||||
if (!empty($rows)) {
|
||||
$sections['tbody'] = $rows;
|
||||
}
|
||||
|
||||
if (!empty($variables['footer'])) {
|
||||
$sections['tfoot'] = $variables['footer'];
|
||||
}
|
||||
|
||||
// tbody and tfoot have the same structure and are built using the same
|
||||
// procedure.
|
||||
foreach ($sections as $tag => $content) {
|
||||
$output .= "<" . $tag . ">\n";
|
||||
$flip = array('even' => 'odd', 'odd' => 'even');
|
||||
$class = 'even';
|
||||
foreach ($rows as $number => $row) {
|
||||
// Check if we're dealing with a simple or complex row
|
||||
$default_no_striping = ($tag === 'tfoot');
|
||||
|
||||
foreach ($content as $number => $row) {
|
||||
// Check if we're dealing with a simple or complex row.
|
||||
if (isset($row['data'])) {
|
||||
$cells = $row['data'];
|
||||
$no_striping = isset($row['no_striping']) ? $row['no_striping'] : FALSE;
|
||||
$no_striping = isset($row['no_striping']) ?
|
||||
$row['no_striping'] : $default_no_striping;
|
||||
|
||||
// Set the attributes array and exclude 'data' and 'no_striping'.
|
||||
$attributes = $row;
|
||||
@@ -2093,16 +2129,17 @@ function theme_table($variables) {
|
||||
else {
|
||||
$cells = $row;
|
||||
$attributes = array();
|
||||
$no_striping = FALSE;
|
||||
$no_striping = $default_no_striping;
|
||||
}
|
||||
if (count($cells)) {
|
||||
// Add odd/even class
|
||||
|
||||
if (!empty($cells)) {
|
||||
// Add odd/even class.
|
||||
if (!$no_striping) {
|
||||
$class = $flip[$class];
|
||||
$attributes['class'][] = $class;
|
||||
}
|
||||
|
||||
// Build row
|
||||
// Build row.
|
||||
$output .= ' <tr' . drupal_attributes($attributes) . '>';
|
||||
$i = 0;
|
||||
foreach ($cells as $cell) {
|
||||
@@ -2112,10 +2149,12 @@ function theme_table($variables) {
|
||||
$output .= " </tr>\n";
|
||||
}
|
||||
}
|
||||
$output .= "</tbody>\n";
|
||||
|
||||
$output .= "</" . $tag . ">\n";
|
||||
}
|
||||
|
||||
$output .= "</table>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+21
-1
@@ -149,7 +149,7 @@ Drupal.ajax = function (base, element, element_settings) {
|
||||
// The 'this' variable will not persist inside of the options object.
|
||||
var ajax = this;
|
||||
ajax.options = {
|
||||
url: ajax.url,
|
||||
url: Drupal.sanitizeAjaxUrl(ajax.url),
|
||||
data: ajax.submit,
|
||||
beforeSerialize: function (element_settings, options) {
|
||||
return ajax.beforeSerialize(element_settings, options);
|
||||
@@ -195,9 +195,29 @@ Drupal.ajax = function (base, element, element_settings) {
|
||||
}
|
||||
},
|
||||
dataType: 'json',
|
||||
jsonp: false,
|
||||
type: 'POST'
|
||||
};
|
||||
|
||||
// For multipart forms (e.g., file uploads), jQuery Form targets the form
|
||||
// submission to an iframe instead of using an XHR object. The initial "src"
|
||||
// of the iframe, prior to the form submission, is set to options.iframeSrc.
|
||||
// "about:blank" is the semantically correct, standards-compliant, way to
|
||||
// initialize a blank iframe; however, some old IE versions (possibly only 6)
|
||||
// incorrectly report a mixed content warning when iframes with an
|
||||
// "about:blank" src are added to a parent document with an https:// origin.
|
||||
// jQuery Form works around this by defaulting to "javascript:false" instead,
|
||||
// but that breaks on Chrome 83, so here we force the semantically correct
|
||||
// behavior for all browsers except old IE.
|
||||
// @see https://www.drupal.org/project/drupal/issues/3143016
|
||||
// @see https://github.com/jquery-form/form/blob/df9cb101b9c9c085c8d75ad980c7ff1cf62063a1/jquery.form.js#L68
|
||||
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=1084874
|
||||
// @see https://html.spec.whatwg.org/multipage/browsers.html#creating-browsing-contexts
|
||||
// @see https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
|
||||
if (navigator.userAgent.indexOf("MSIE") === -1) {
|
||||
ajax.options.iframeSrc = 'about:blank';
|
||||
}
|
||||
|
||||
// Bind the ajaxSubmit function to the element event.
|
||||
$(ajax.element).bind(element_settings.event, function (event) {
|
||||
if (!Drupal.settings.urlIsAjaxTrusted[ajax.url] && !Drupal.urlIsLocal(ajax.url)) {
|
||||
|
||||
Executable → Regular
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
Executable → Regular
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
Executable → Regular
Executable → Regular
+2
-1
@@ -297,8 +297,9 @@ Drupal.ACDB.prototype.search = function (searchString) {
|
||||
// encodeURIComponent to allow autocomplete search terms to contain slashes.
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: db.uri + '/' + Drupal.encodePath(searchString),
|
||||
url: Drupal.sanitizeAjaxUrl(db.uri + '/' + Drupal.encodePath(searchString)),
|
||||
dataType: 'json',
|
||||
jsonp: false,
|
||||
success: function (matches) {
|
||||
if (typeof matches.status == 'undefined' || matches.status != 0) {
|
||||
db.cache[searchString] = matches;
|
||||
|
||||
Executable → Regular
@@ -0,0 +1,4 @@
|
||||
/vendor/
|
||||
/phpunit.xml
|
||||
/.composer.lock
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
language: php
|
||||
|
||||
sudo: false
|
||||
|
||||
php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
|
||||
before_install:
|
||||
- phpenv config-rm xdebug.ini
|
||||
- composer self-update
|
||||
|
||||
install:
|
||||
- composer install
|
||||
|
||||
script: phpunit
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 Denis Brumann
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,61 @@
|
||||
Polyfill unserialize [](https://travis-ci.org/dbrumann/polyfill-unserialize)
|
||||
===
|
||||
|
||||
Backports unserialize options introduced in PHP 7.0 to older PHP versions.
|
||||
This was originally designed as a Proof of Concept for Symfony Issue [#21090](https://github.com/symfony/symfony/pull/21090).
|
||||
|
||||
You can use this package in projects that rely on PHP versions older than PHP 7.0.
|
||||
In case you are using PHP 7.0+ the original `unserialize()` will be used instead.
|
||||
|
||||
From the [documentation](https://secure.php.net/manual/en/function.unserialize.php):
|
||||
|
||||
> Warning: Do not pass untrusted user input to unserialize(). Unserialization can
|
||||
> result in code being loaded and executed due to object instantiation
|
||||
> and autoloading, and a malicious user may be able to exploit this.
|
||||
|
||||
This warning holds true even when `allowed_classes` is used.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
- PHP 5.3+
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
You can install this package via composer:
|
||||
|
||||
```
|
||||
composer require brumann/polyfill-unserialize "^1.0"
|
||||
```
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
|
||||
There is a mismatch in behavior when `allowed_classes` in `$options` is not
|
||||
of the correct type (array or boolean). PHP 7.1 will issue a warning, whereas
|
||||
PHP 7.0 will not. I opted to copy the behavior of the former.
|
||||
|
||||
Tests
|
||||
-----
|
||||
|
||||
You can run the test suite using PHPUnit. It is intentionally not bundled as
|
||||
dev dependency to make sure this package has the lowest restrictions on the
|
||||
implementing system as possible.
|
||||
|
||||
Please read the [PHPUnit Manual](https://phpunit.de/manual/current/en/installation.html)
|
||||
for information how to install it on your system.
|
||||
|
||||
You can run the test suite as follows:
|
||||
|
||||
```
|
||||
phpunit -c phpunit.xml.dist tests/
|
||||
```
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
This package is considered feature complete. As such I will likely not update it
|
||||
unless there are security issues.
|
||||
|
||||
Should you find any bugs or have questions, feel free to submit an Issue or a Pull Request.
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "brumann/polyfill-unserialize",
|
||||
"description": "Backports unserialize options introduced in PHP 7.0 to older PHP versions.",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Denis Brumann",
|
||||
"email": "denis.brumann@sensiolabs.de"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Brumann\\Polyfill\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\Brumann\\Polyfill\\": "tests/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"require": {
|
||||
"php": "^5.3|^7.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Brumann\Polyfill Test Suite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./src/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Brumann\Polyfill;
|
||||
|
||||
final class Unserialize
|
||||
{
|
||||
/**
|
||||
* @see https://secure.php.net/manual/en/function.unserialize.php
|
||||
*
|
||||
* @param string $serialized Serialized data
|
||||
* @param array $options Associative array containing options
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function unserialize($serialized, array $options = array())
|
||||
{
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
return \unserialize($serialized, $options);
|
||||
}
|
||||
if (!array_key_exists('allowed_classes', $options)) {
|
||||
$options['allowed_classes'] = true;
|
||||
}
|
||||
$allowedClasses = $options['allowed_classes'];
|
||||
if (true === $allowedClasses) {
|
||||
return \unserialize($serialized);
|
||||
}
|
||||
if (false === $allowedClasses) {
|
||||
$allowedClasses = array();
|
||||
}
|
||||
if (!is_array($allowedClasses)) {
|
||||
trigger_error(
|
||||
'unserialize(): allowed_classes option should be array or boolean',
|
||||
E_USER_WARNING
|
||||
);
|
||||
$allowedClasses = array();
|
||||
}
|
||||
|
||||
$sanitizedSerialized = preg_replace_callback(
|
||||
'/(^|;)O:\d+:"([^"]*)":(\d+):{/',
|
||||
function ($match) use ($allowedClasses) {
|
||||
list($completeMatch, $leftBorder, $className, $objectSize) = $match;
|
||||
if (in_array($className, $allowedClasses)) {
|
||||
return $completeMatch;
|
||||
} else {
|
||||
return sprintf(
|
||||
'%sO:22:"__PHP_Incomplete_Class":%d:{s:27:"__PHP_Incomplete_Class_Name";%s',
|
||||
$leftBorder,
|
||||
$objectSize + 1, // size of object + 1 for added string
|
||||
\serialize($className)
|
||||
);
|
||||
}
|
||||
},
|
||||
$serialized
|
||||
);
|
||||
|
||||
return \unserialize($sanitizedSerialized);
|
||||
}
|
||||
}
|
||||
Executable → Regular
Executable → Regular
|
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 248 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user