security update for uuid xmlsitemap file_field_path
This commit is contained in:
@@ -25,7 +25,7 @@ module_load_include('inc', 'uuid', 'uuid.entity');
|
||||
module_load_include('inc', 'uuid', 'uuid.core');
|
||||
|
||||
/**
|
||||
* Implements of hook_menu().
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function uuid_menu() {
|
||||
$items = array();
|
||||
@@ -34,6 +34,7 @@ function uuid_menu() {
|
||||
'title' => 'UUID redirector',
|
||||
'description' => 'Redirects requests for UUID URIs to the referenced entity.',
|
||||
'page callback' => 'uuid_redirector',
|
||||
// The access check is handled in the page callback.
|
||||
'access callback' => TRUE,
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
@@ -44,7 +45,6 @@ function uuid_menu() {
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('uuid_admin_form'),
|
||||
'access arguments' => array('administer uuid'),
|
||||
'type' => MENU_NORMAL_ITEM,
|
||||
'file' => 'uuid.admin.inc',
|
||||
);
|
||||
|
||||
@@ -72,7 +72,7 @@ function uuid_menu() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements of hook_ctools_plugin_directory().
|
||||
* Implements hook_ctools_plugin_directory().
|
||||
*/
|
||||
function uuid_ctools_plugin_directory($module, $plugin) {
|
||||
if ($module == 'ctools') {
|
||||
@@ -81,7 +81,7 @@ function uuid_ctools_plugin_directory($module, $plugin) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements of hook_permission().
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
function uuid_permission() {
|
||||
return array(
|
||||
@@ -123,9 +123,8 @@ function uuid_hook_info() {
|
||||
return array_fill_keys($hook_names, array('group' => 'uuid'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of hook_views_api().
|
||||
* Implements hook_views_api().
|
||||
*/
|
||||
function uuid_views_api() {
|
||||
return array(
|
||||
@@ -135,27 +134,27 @@ function uuid_views_api() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements of hook_module_implements_alter().
|
||||
* Implements hook_module_implements_alter().
|
||||
*
|
||||
* Moves implementation of hook_entity_info_alter() to the bottom so it is
|
||||
* Moves hook_entity_info_alter() implementation to the bottom so it is
|
||||
* invoked after all modules relying on the entity API.
|
||||
*
|
||||
* @see uuid_entity_info_alter()
|
||||
*/
|
||||
function uuid_module_implements_alter(&$Implementss, $hook) {
|
||||
function uuid_module_implements_alter(&$implementss, $hook) {
|
||||
if ($hook == 'entity_info_alter') {
|
||||
// Move our hook Implements to the bottom.
|
||||
$group = $Implementss['uuid'];
|
||||
unset($Implementss['uuid']);
|
||||
$Implementss['uuid'] = $group;
|
||||
$group = $implementss['uuid'];
|
||||
unset($implementss['uuid']);
|
||||
$implementss['uuid'] = $group;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements of hook_uuid_sync().
|
||||
* Implements hook_uuid_sync().
|
||||
*/
|
||||
function uuid_uuid_sync() {
|
||||
foreach (entity_get_info() as $entity_type => $info) {
|
||||
foreach (entity_get_info() as $info) {
|
||||
if (isset($info['uuid']) && $info['uuid'] == TRUE && !empty($info['entity keys']['uuid'])) {
|
||||
_uuid_sync_table($info['base table'], $info['entity keys']['id'], $info['entity keys']['uuid']);
|
||||
if (!empty($info['entity keys']['revision uuid'])) {
|
||||
@@ -185,7 +184,7 @@ function _uuid_sync_table($table, $id_field, $uuid_field) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_features_api().
|
||||
* Implements hook_features_api().
|
||||
*
|
||||
* The Features support consists of exporting entities from a Deploy
|
||||
* <em>fetch-only</em> plan. Deploy is only required to generate the feature
|
||||
@@ -202,7 +201,7 @@ function uuid_features_api() {
|
||||
'default_hook' => 'uuid_default_entities',
|
||||
'default_file' => FEATURES_DEFAULTS_INCLUDED,
|
||||
'feature_source' => TRUE,
|
||||
'file' => drupal_get_path('module', 'uuid') .'/uuid.features.inc',
|
||||
'file' => drupal_get_path('module', 'uuid') . '/uuid.features.inc',
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -212,18 +211,22 @@ function uuid_features_api() {
|
||||
*/
|
||||
function uuid_redirector() {
|
||||
$entity_data = uuid_uri_array_to_data(arg());
|
||||
|
||||
|
||||
$entity_info = entity_get_info($entity_data['entity_type']);
|
||||
if (empty($entity_info['uuid'])) {
|
||||
return drupal_not_found();
|
||||
return MENU_NOT_FOUND;
|
||||
}
|
||||
|
||||
$entities = entity_uuid_load($entity_data['entity_type'], array($entity_data['uuid']));
|
||||
if (!count($entities)) {
|
||||
return drupal_not_found();
|
||||
return MENU_NOT_FOUND;
|
||||
}
|
||||
|
||||
$uri = entity_uri($entity_data['entity_type'], current($entities));
|
||||
drupal_goto($uri['path'], array(), 301);
|
||||
}
|
||||
|
||||
if (!drupal_valid_path($uri['path'])) {
|
||||
return MENU_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
drupal_goto($uri['path'], $uri['options'], 301);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user