Skip to content

Commit

Permalink
#18 Update Context to 7.x-3.11 incl. SA-CONTRIB-2022-049
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Hunt committed Oct 5, 2022
1 parent c5bab70 commit 0565143
Show file tree
Hide file tree
Showing 11 changed files with 1,228 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docroot/sites/all/modules/contrib/context/context.info
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ files[] = tests/context.test
files[] = tests/context.conditions.test
files[] = tests/context.reactions.test

; Information added by Drupal.org packaging script on 2019-02-26
version = "7.x-3.10"
; Information added by Drupal.org packaging script on 2022-07-26
version = "7.x-3.11"
core = "7.x"
project = "context"
datestamp = "1551220089"
datestamp = "1658874334"
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ core = 7.x

files[] = plugins/context_layouts_reaction_block.inc

; Information added by Drupal.org packaging script on 2019-02-26
version = "7.x-3.10"
; Information added by Drupal.org packaging script on 2022-07-26
version = "7.x-3.11"
core = "7.x"
project = "context"
datestamp = "1551220089"
datestamp = "1658874334"
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ configure = admin/structure/context
files[] = context.module
files[] = tests/context_ui.test

; Information added by Drupal.org packaging script on 2019-02-26
version = "7.x-3.10"
; Information added by Drupal.org packaging script on 2022-07-26
version = "7.x-3.11"
core = "7.x"
project = "context"
datestamp = "1551220089"
datestamp = "1658874334"
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ DrupalContextBlockForm = function(blockForm) {
}
select += '</select></div>';
$(block).attr('id', $(this).attr('value')).addClass('draggable');
$(block).html("<td>"+ text + "</td><td>" + select + "</td><td><a href='' class='remove'>X</a></td>");
$(block).html("<td>"+ Drupal.checkPlain(text) + "</td><td>" + select + "</td><td><a href='' class='remove'>X</a></td>");

// add block item to region
//TODO : Fix it so long blocks don't get stuck when added to top regions and dragged towards bottom regions
Expand Down
339 changes: 339 additions & 0 deletions docroot/sites/all/modules/contrib/imagecache_external/LICENSE.txt

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions docroot/sites/all/modules/contrib/imagecache_external/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
========================
ABOUT
------------------------
Imagecache External is a utility module that allows you to store external
images on your server and apply your own imagecache (D6) / Image Styles (D7).

========================
CONFIGURATION
------------------------
To get the module to work, you need to visit
admin/config/media/imagecache_external and either:

- Add some domains to the whitelist -or-
- De-activate whitelist functionality


========================
USAGE INSTRUCTIONS
------------------------
In your module or theme, you may call the following theme function to
process an image via Imagecache External:

<?php
print theme('imagecache_external', array(
'path' => 'https://drupal.org/files/druplicon.large_.png',
'style_name'=> 'thumbnail',
'alt' => 'Druplicon'
));

or, in a render array, like this:

<?php
return array(
'#theme' => 'imagecache_external',
'#path' => 'https://drupal.org/files/druplicon.large_.png',
'#style_name' => 'thumbnail',
'#alt' => 'Druplicon',
);
?>

You can also use external images without coding at all by adding an Text or
Link field to a Node Type and then use the Imagecache External Image formatter.


========================
ADDITIONAL RESOURCES
------------------------
View the Imagecache External project page for additional information
https://drupal.org/project/imagecache_external
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/**
* @file
* Admin forms for this module.
*/

/**
* Form builder.
*/
function imagecache_external_admin_form($form, $form_state) {
$form = array();

$form['imagecache_directory'] = array(
'#type' => 'textfield',
'#title' => t('Imagecache Directory'),
'#required' => TRUE,
'#description' => t('Where, withing the files directory, should the downloaded images be stored?'),
'#default_value' => variable_get('imagecache_directory', 'externals'),
);

$form['imagecache_external_management'] = array(
'#type' => 'radios',
'#title' => t('How should Drupal handle the files?'),
'#description' => t('Managed files can be re-used elsewhere on the site, for instance in the Media Library if you use the Media module. Unmanaged files are not saved to the database, but can be cached using Image Styles.'),
'#options' => array(
'unmanaged' => t('Unmanaged: Only save the images to the files folder to be able to cache them. This is default.'),
'managed' => t('Managed: Download the images and save its metadata to the database.'),
),
'#default_value' => variable_get('imagecache_external_management', 'unmanaged'),
);

$form['imagecache_external_use_whitelist'] = array(
'#type' => 'checkbox',
'#title' => t('Use whitelist'),
'#description' => t('By default, all images are blocked except for images served from white-listed hosts. You can define hosts below.'),
'#default_value' => variable_get('imagecache_external_use_whitelist', TRUE),
);

$form['imagecache_external_hosts'] = array(
'#type' => 'textarea',
'#title' => t('Imagecache External hosts'),
'#description' => t('Add one host per line. You can use top-level domains to whitelist subdomains. Ex: staticflickr.com to whitelist farm1.staticflickr.com and farm2.staticflickr.com'),
'#default_value' => variable_get('imagecache_external_hosts', ''),
'#states' => array(
'visible' => array(
':input[name="imagecache_external_use_whitelist"]' => array('checked' => TRUE),
),
),
);
return system_settings_form($form);
}

/**
* Validate callback for the admin form.
*/
function imagecache_external_admin_form_validate($form, $form_state) {
$scheme = file_default_scheme();
$directory = $scheme . '://' . $form_state['values']['imagecache_directory'];
if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {
form_set_error('imagecache_directory', t('The directory %directory does not exist or is not writable.', array('%directory' => $directory)));
watchdog('imagecache_external', 'The directory %directory does not exist or is not writable.', array('%directory' => $directory), WATCHDOG_ERROR);
}
}

/**
* Form builder.
*/
function imagecache_external_flush_form($form, $form_state) {
return confirm_form($form,
t('Flush all external images?'),
'admin/config/media/imagecache_external',
t('Are you sure? This cannot be undone.'),
t('Flush'),
t('Cancel')
);
}

/**
* Submit handler.
*/
function imagecache_external_flush_form_submit($form, &$form_state) {
if (imagecache_external_flush_cache()) {
drupal_set_message(t('Flushed external images'));
}
else {
drupal_set_message(t('Could not flush external images'), 'error');
}
$form_state['redirect'] = 'admin/config/media/imagecache_external';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name = Imagecache External
description = Allows you to fetch external images and use image styles on them.
dependencies[] = image
files[] = imagecache_external.test
core = 7.x
configure = admin/config/media/imagecache_external

; Information added by Drupal.org packaging script on 2015-04-28
version = "7.x-2.1"
core = "7.x"
project = "imagecache_external"
datestamp = "1430249582"

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php
/**
* @file
* (Un)install and update functions.
*/

/**
* Implements hook_requirements().
*/
function imagecache_external_requirements($phase) {
$requirements = array();

// Ensure translations don't break at install time.
$t = get_t();

// Check the Imagecache External configuration.
if ($phase == 'runtime') {
$hosts = variable_get('imagecache_external_hosts', '');
$use_whitelist = variable_get('imagecache_external_use_whitelist', TRUE);
if ($use_whitelist && empty($hosts)) {
$requirements['imagecache_external'] = array(
'title' => $t('Imagecache External'),
'value' => $t('Not properly configured'),
'description' => $t('The configuration is set to use a whitelist but no hostname(s) are configured. <a href="@link">Add one or more trusted hostnames</a> or <a href="@link">disable the whitelist functionality</a>.', array('@link' => url('admin/config/media/imagecache_external'))),
'severity' => REQUIREMENT_WARNING,
);
}
else {
$requirements['imagecache_external'] = array(
'title' => $t('Imagecache External'),
'value' => $t('Properly configured'),
'severity' => REQUIREMENT_OK,
);
}
}

return $requirements;
}

/**
* Implements hook_uninstall().
*/
function imagecache_external_uninstall() {
variable_del('imagecache_directory');
variable_del('imagecache_external_hosts');
variable_del('imagecache_external_option');
variable_del('imagecache_external_management');
variable_del('imagecache_external_allowed_mimetypes');
}

/**
* Set the File Mode to 'managed' as the new default is 'unmanaged'.
*/
function imagecache_external_update_7100() {
variable_set('imagecache_external_management', 'managed');
}

/**
* Set the Imagecache Externals directory to 'imagecache/external'.
*/
function imagecache_external_update_7101() {
variable_set('imagecache_directory', 'imagecache/external');
}

/**
* Change the white-/blacklist functionality to whitelist-only.
*/
function imagecache_external_update_7102() {
$use_whitelist = variable_get('imagecache_external_option', 'white') == 'white';
variable_set('imagecache_external_use_whitelist', $use_whitelist);
variable_del('imagecache_external_option');
}


Loading

0 comments on commit 0565143

Please sign in to comment.