security update for uuid xmlsitemap file_field_path

This commit is contained in:
2018-10-13 16:01:24 +02:00
parent f7ae17e6c4
commit a163542966
109 changed files with 5458 additions and 1952 deletions

View File

@@ -1,5 +1,10 @@
<?php
/**
* @file
* Main file for XML sitemap taxonomy.
*/
/**
* Implements hook_entity_info_alter().
*/
@@ -43,7 +48,7 @@ function xmlsitemap_taxonomy_xmlsitemap_index_links($limit) {
/**
* Process taxonomy term sitemap links.
*
* @param $tids
* @param array $tids
* An array of taxonomy term IDs.
*/
function xmlsitemap_taxonomy_xmlsitemap_process_taxonomy_term_links(array $tids) {
@@ -103,7 +108,7 @@ function xmlsitemap_taxonomy_vocabulary_update(stdClass $vocabulary) {
}
/**
* Implements hook_taxonomy_term_insert() {
* Implements hook_taxonomy_term_insert().
*/
function xmlsitemap_taxonomy_term_insert(stdClass $term) {
$link = xmlsitemap_taxonomy_create_link($term);
@@ -111,7 +116,7 @@ function xmlsitemap_taxonomy_term_insert(stdClass $term) {
}
/**
* Implements hook_taxonomy_term_update() {
* Implements hook_taxonomy_term_update().
*/
function xmlsitemap_taxonomy_term_update(stdClass $term) {
$link = xmlsitemap_taxonomy_create_link($term);
@@ -119,7 +124,7 @@ function xmlsitemap_taxonomy_term_update(stdClass $term) {
}
/**
* Implements hook_taxonomy_term_delete() {
* Implements hook_taxonomy_term_delete().
*/
function xmlsitemap_taxonomy_term_delete(stdClass $term) {
xmlsitemap_link_delete('taxonomy_term', $term->tid);
@@ -143,9 +148,10 @@ function xmlsitemap_taxonomy_field_extra_fields() {
/**
* Create a sitemap link from a taxonomy term.
*
* @param $term
* @param object $term
* A taxonomy term object.
* @return
*
* @return array
* An array representing a sitemap link.
*/
function xmlsitemap_taxonomy_create_link(stdClass &$term) {
@@ -182,20 +188,22 @@ function xmlsitemap_taxonomy_create_link(stdClass &$term) {
/**
* Calculate the priority of a taxonomy term based on depth and weight.
*
* Function xmlsitemap_taxonomy_calculate_term_priority(stdClass $term) {
* // Calculate priority.
* // Min weight = -128
* // Max weight = 127
* // Max depth = ?
* }
*/
//function xmlsitemap_taxonomy_calculate_term_priority(stdClass $term) {
// // Calculate priority.
// // Min weight = -128
// // Max weight = 127
// // Max depth = ?
//}
/**
* Find the tree depth of a taxonomy term.
*
* @param $term
* @param object $term
* A taxonomy term object.
* @return
*
* @return array
* The tree depth of the term.
*/
function xmlsitemap_taxonomy_get_term_depth(stdClass $term) {
@@ -221,12 +229,16 @@ function xmlsitemap_taxonomy_get_term_depth(stdClass $term) {
/**
* Find the number of nodes that are associated with a taxonomy term.
*
* @param $term
* @param obejct $term
* A taxonomy term object.
* @return
*
* @return int
* The number of nodes associated with the term.
*
* @codingStandardsIgnoreStart
*/
function xmlsitemap_taxonomy_get_node_count(stdClass $term) {
// @codingStandardsIgnoreEnd
// @todo Use db_rewrite_sql() w/ switch user.
return db_query_range("SELECT COUNT(ti.nid) FROM {taxonomy_index} ti LEFT JOIN {node n} USING (nid) WHERE ti.tid = :tid AND n.status = 1", 0, 1, array(':tid' => $term->tid))->fetchField();
}
@@ -234,7 +246,7 @@ function xmlsitemap_taxonomy_get_node_count(stdClass $term) {
/**
* Implements hook_entity_query_alter().
*
* @todo Remove when http://drupal.org/node/1054162 is fixed.
* @todo Remove when https://www.drupal.org/node/1054162 is fixed.
*/
function xmlsitemap_taxonomy_entity_query_alter($query) {
$conditions = &$query->entityConditions;
@@ -243,7 +255,13 @@ function xmlsitemap_taxonomy_entity_query_alter($query) {
if (isset($conditions['entity_type']) && $conditions['entity_type']['value'] == 'taxonomy_term' && isset($conditions['bundle'])) {
// We can only support the operators that are explicit in values.
if (in_array($conditions['bundle']['operator'], array(NULL, '=', '!=', 'IN', 'NOT IN'))) {
if (in_array($conditions['bundle']['operator'], array(
NULL,
'=',
'!=',
'IN',
'NOT IN',
))) {
$vids = array();
// Convert vocabulary machine names to vocabulary IDs.