security update for uuid xmlsitemap file_field_path
This commit is contained in:
76
sites/all/modules/xmlsitemap/xmlsitemap_custom/README.txt
Normal file
76
sites/all/modules/xmlsitemap/xmlsitemap_custom/README.txt
Normal file
@@ -0,0 +1,76 @@
|
||||
CONTENTS OF THIS FILE
|
||||
---------------------
|
||||
|
||||
* Introduction
|
||||
* Requirements
|
||||
* Recommended modules
|
||||
* Installation
|
||||
* Configuration
|
||||
* Maintainers
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
------------
|
||||
|
||||
The XML sitemap custom module, part of the XML sitemap
|
||||
(https://www.drupal.org/project/xmlsitemap) package, adds user configurable
|
||||
links to the sitemap. The XML sitemap module creates a sitemap that conforms to
|
||||
the sitemaps.org specification. This helps search engines to more intelligently
|
||||
crawl a website and keep their results up to date.
|
||||
|
||||
* For a full description of the module, visit
|
||||
https://www.drupal.org/documentation/modules/xmlsitemap
|
||||
|
||||
* To submit bug reports and feature suggestions, or to track changes visit
|
||||
https://www.drupal.org/project/issues/xmlsitemap
|
||||
|
||||
|
||||
REQUIREMENTS
|
||||
------------
|
||||
|
||||
This module requires the following module:
|
||||
|
||||
* XML sitemap - https://www.drupal.org/project/xmlsitemap
|
||||
|
||||
|
||||
RECOMMENDED MODULES
|
||||
-------------------
|
||||
|
||||
* Ctools - https://www.drupal.org/project/ctools
|
||||
* RobotsTxt - https://www.drupal.org/project/robotstxt
|
||||
* Site Verification - https://www.drupal.org/project/site_verify
|
||||
* Browscap - https://www.drupal.org/project/browscap
|
||||
* Vertical Tabs - https://www.drupal.org/project/vertical_tabs
|
||||
|
||||
|
||||
INSTALLATION
|
||||
------------
|
||||
|
||||
This is a submodule of the XML sitemap module. Install the XML sitemap module as
|
||||
you would normally install a contributed Drupal module. Visit
|
||||
https://www.drupal.org/node/895232 for further information.
|
||||
|
||||
|
||||
CONFIGURATION
|
||||
-------------
|
||||
|
||||
1. Install the XML sitemap module.
|
||||
2. Enable the XML sitemap module.
|
||||
3. To include custom links in the sitemap, enable the XML custom submodule.
|
||||
4. Navigate to Administration > Configuration > Search > XML Sitemap.
|
||||
5. Select on the Custom Links tab to add a custom link.
|
||||
6. Enter the address and select Save.
|
||||
7. Select on the XML sitemap vertical tab.
|
||||
8. Select on the Rebuild Links tab in the upper right.
|
||||
9. Select on "Rebuild sitemap" even if the message says that you do not need to.
|
||||
10. Now you're taken back to the config page which shows you the link to your
|
||||
XML sitemap which you can click and confirm that pages have been added.
|
||||
|
||||
|
||||
MAINTAINERS
|
||||
-----------
|
||||
|
||||
* Andrei Mateescu (amateescu) - https://www.drupal.org/u/amateescu
|
||||
* Dave Reid - https://www.drupal.org/u/dave-reid
|
||||
* Juampy NR (juampynr) - https://www.drupal.org/u/juampynr
|
||||
* Tasya Rukmana (tadityar) - https://www.drupal.org/u/tadityar
|
@@ -2,9 +2,12 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Administrative page callbacks for the xmlsitemap_custom module.
|
||||
* Administrative page callbacks for the xmlsitemap_custom.
|
||||
*/
|
||||
|
||||
/**
|
||||
* List Links.
|
||||
*/
|
||||
function xmlsitemap_custom_list_links() {
|
||||
$header = array(
|
||||
'loc' => array('data' => t('Location'), 'field' => 'loc', 'sort' => 'asc'),
|
||||
@@ -62,6 +65,9 @@ function xmlsitemap_custom_list_links() {
|
||||
return $build;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Link Form.
|
||||
*/
|
||||
function xmlsitemap_custom_edit_link_form($form, &$form_state, $link = array()) {
|
||||
module_load_include('inc', 'xmlsitemap', 'xmlsitemap.admin');
|
||||
_xmlsitemap_set_breadcrumb('admin/config/search/xmlsitemap/custom');
|
||||
@@ -116,7 +122,7 @@ function xmlsitemap_custom_edit_link_form($form, &$form_state, $link = array())
|
||||
);
|
||||
|
||||
$form['actions'] = array(
|
||||
'#type' => 'actions'
|
||||
'#type' => 'actions',
|
||||
);
|
||||
$form['actions']['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
@@ -131,6 +137,9 @@ function xmlsitemap_custom_edit_link_form($form, &$form_state, $link = array())
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Link Form Validate.
|
||||
*/
|
||||
function xmlsitemap_custom_edit_link_form_validate($form, &$form_state) {
|
||||
$link = &$form_state['values'];
|
||||
|
||||
@@ -143,12 +152,16 @@ function xmlsitemap_custom_edit_link_form_validate($form, &$form_state) {
|
||||
$menu_item = menu_get_item($link['loc']);
|
||||
xmlsitemap_restore_user();
|
||||
|
||||
// Since the menu item access results are cached, manually check the current path.
|
||||
// Since the menu item access results are cached, manually check the current
|
||||
// path.
|
||||
if ($menu_item && strpos($link['loc'], 'admin/config/search/xmlsitemap/custom') === 0 && !user_access('administer xmlsitemap', drupal_anonymous_user())) {
|
||||
$menu_item['access'] = FALSE;
|
||||
}
|
||||
|
||||
if (db_query_range("SELECT 1 FROM {xmlsitemap} WHERE type <> 'custom' AND loc = :loc AND status = 1 AND access = 1 AND language IN (:languages)", 0, 1, array(':loc' => $link['loc'], ':languages' => array(LANGUAGE_NONE, $link['language'])))->fetchField()) {
|
||||
if (db_query_range("SELECT 1 FROM {xmlsitemap} WHERE type <> 'custom' AND loc = :loc AND status = 1 AND access = 1 AND language IN (:languages)", 0, 1, array(
|
||||
':loc' => $link['loc'],
|
||||
':languages' => array(LANGUAGE_NONE, $link['language']),
|
||||
))->fetchField()) {
|
||||
form_set_error('loc', t('There is already an existing link in the sitemap with the path %link.', array('%link' => $link['loc'])));
|
||||
}
|
||||
elseif (empty($menu_item['access']) && !is_readable('./' . $link['loc'])) {
|
||||
@@ -158,6 +171,9 @@ function xmlsitemap_custom_edit_link_form_validate($form, &$form_state) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit Link Form Submit.
|
||||
*/
|
||||
function xmlsitemap_custom_edit_link_form_submit($form, &$form_state) {
|
||||
$link = $form_state['values'];
|
||||
xmlsitemap_link_save($link);
|
||||
@@ -165,8 +181,11 @@ function xmlsitemap_custom_edit_link_form_submit($form, &$form_state) {
|
||||
$form_state['redirect'] = 'admin/config/search/xmlsitemap/custom';
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Link Form.
|
||||
*/
|
||||
function xmlsitemap_custom_delete_link_form($form, &$form_state, array $link) {
|
||||
// @todo Remove when http://drupal.org/node/576290 is fixed.
|
||||
// @todo Remove when https://www.drupal.org/node/576290 is fixed.
|
||||
_xmlsitemap_set_breadcrumb('admin/config/search/xmlsitemap/custom');
|
||||
|
||||
$form['#link'] = $link;
|
||||
@@ -189,6 +208,9 @@ function xmlsitemap_custom_delete_link_form($form, &$form_state, array $link) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Link Form Submit.
|
||||
*/
|
||||
function xmlsitemap_custom_delete_link_form_submit($form, &$form_state) {
|
||||
$link = $form_state['values']['link'];
|
||||
xmlsitemap_link_delete('custom', $link['id']);
|
||||
|
@@ -3,15 +3,11 @@ description = Adds user configurable links to the sitemap.
|
||||
package = XML sitemap
|
||||
core = 7.x
|
||||
dependencies[] = xmlsitemap
|
||||
files[] = xmlsitemap_custom.module
|
||||
files[] = xmlsitemap_custom.admin.inc
|
||||
files[] = xmlsitemap_custom.install
|
||||
files[] = xmlsitemap_custom.test
|
||||
configure = admin/config/search/xmlsitemap/custom
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-05-25
|
||||
version = "7.x-2.3"
|
||||
; Information added by Drupal.org packaging script on 2018-10-09
|
||||
version = "7.x-2.6"
|
||||
core = "7.x"
|
||||
project = "xmlsitemap"
|
||||
datestamp = "1464191061"
|
||||
|
||||
datestamp = "1539120486"
|
||||
|
@@ -1,5 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Main file for XML sitemap Custom.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
@@ -42,7 +47,7 @@ function xmlsitemap_custom_menu() {
|
||||
/**
|
||||
* Menu load callback; load a custom sitemap link from the {xmlsitemap} table.
|
||||
*
|
||||
* @param $id
|
||||
* @param string $id
|
||||
* The sitemap link ID of the custom link to load.
|
||||
*
|
||||
* @see xmlsitemap_link_load()
|
||||
|
@@ -2,10 +2,17 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Unit tests for the xmlsitemap_custom module.
|
||||
* Unit tests for the xmlsitemap_custom.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class with Functional Test for XML Sitemap Custom.
|
||||
*/
|
||||
class XMLSitemapCustomFunctionalTest extends XMLSitemapTestHelper {
|
||||
|
||||
/**
|
||||
* Get Info.
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'XML sitemap custom interface tests',
|
||||
@@ -14,7 +21,10 @@ class XMLSitemapCustomFunctionalTest extends XMLSitemapTestHelper {
|
||||
);
|
||||
}
|
||||
|
||||
function setUp($modules = array()) {
|
||||
/**
|
||||
* Setup.
|
||||
*/
|
||||
public function setUp($modules = array()) {
|
||||
$modules[] = 'xmlsitemap_custom';
|
||||
$modules[] = 'path';
|
||||
parent::setUp($modules);
|
||||
@@ -23,7 +33,10 @@ class XMLSitemapCustomFunctionalTest extends XMLSitemapTestHelper {
|
||||
$this->drupalLogin($this->admin_user);
|
||||
}
|
||||
|
||||
function testCustomLinks() {
|
||||
/**
|
||||
* Test Custom Links.
|
||||
*/
|
||||
public function testCustomLinks() {
|
||||
// Set a path alias for the node page.
|
||||
$alias = array('source' => 'system/files', 'alias' => 'public-files');
|
||||
path_save($alias);
|
||||
@@ -57,7 +70,12 @@ class XMLSitemapCustomFunctionalTest extends XMLSitemapTestHelper {
|
||||
$links = xmlsitemap_link_load_multiple(array('type' => 'custom', 'loc' => 'system/files'));
|
||||
$this->assertEqual(count($links), 1, t('Custom link saved in the database.'));
|
||||
$link = reset($links);
|
||||
$this->assertSitemapLinkValues('custom', $link['id'], array('priority' => 0.5, 'changefreq' => 0, 'access' => 1, 'status' => 1));
|
||||
$this->assertSitemapLinkValues('custom', $link['id'], array(
|
||||
'priority' => 0.5,
|
||||
'changefreq' => 0,
|
||||
'access' => 1,
|
||||
'status' => 1,
|
||||
));
|
||||
|
||||
$this->clickLink('Edit');
|
||||
$edit = array(
|
||||
@@ -66,7 +84,12 @@ class XMLSitemapCustomFunctionalTest extends XMLSitemapTestHelper {
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertText('The custom link for system/files was saved');
|
||||
$this->assertSitemapLinkValues('custom', $link['id'], array('priority' => 0.1, 'changefreq' => XMLSITEMAP_FREQUENCY_ALWAYS, 'access' => 1, 'status' => 1));
|
||||
$this->assertSitemapLinkValues('custom', $link['id'], array(
|
||||
'priority' => 0.1,
|
||||
'changefreq' => XMLSITEMAP_FREQUENCY_ALWAYS,
|
||||
'access' => 1,
|
||||
'status' => 1,
|
||||
));
|
||||
|
||||
$this->clickLink('Delete');
|
||||
$this->drupalPost(NULL, array(), t('Delete'));
|
||||
@@ -77,7 +100,7 @@ class XMLSitemapCustomFunctionalTest extends XMLSitemapTestHelper {
|
||||
/**
|
||||
* Test adding files as custom links.
|
||||
*/
|
||||
function testCustomFileLinks() {
|
||||
public function testCustomFileLinks() {
|
||||
// Test an invalid file.
|
||||
$edit['loc'] = $this->randomName();
|
||||
$this->drupalPost('admin/config/search/xmlsitemap/custom/add', $edit, t('Save'));
|
||||
@@ -85,11 +108,12 @@ class XMLSitemapCustomFunctionalTest extends XMLSitemapTestHelper {
|
||||
$this->assertNoSitemapLink(array('type' => 'custom', 'loc' => $edit['loc']));
|
||||
|
||||
// Test an unaccessible file .
|
||||
//$edit['loc'] = '.htaccess';
|
||||
//$this->drupalPost('admin/config/search/xmlsitemap/custom/add', $edit, t('Save'));
|
||||
//$this->assertText(t('The custom link @link is either invalid or it cannot be accessed by anonymous users.', array('@link' => $edit['loc'])));
|
||||
//$this->assertNoSitemapLink(array('type' => 'custom', 'loc' => $edit['loc']));
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
// $edit['loc'] = '.htaccess';
|
||||
// $this->drupalPost('admin/config/search/xmlsitemap/custom/add', $edit, t('Save'));
|
||||
// $this->assertText(t('The custom link @link is either invalid or it cannot be accessed by anonymous users.', array('@link' => $edit['loc'])));
|
||||
// $this->assertNoSitemapLink(array('type' => 'custom', 'loc' => $edit['loc']));
|
||||
// @codingStandardsIgnoreEnd
|
||||
// Test a valid file.
|
||||
$edit['loc'] = 'misc/drupal.js';
|
||||
$this->drupalPost('admin/config/search/xmlsitemap/custom/add', $edit, t('Save'));
|
||||
@@ -104,4 +128,5 @@ class XMLSitemapCustomFunctionalTest extends XMLSitemapTestHelper {
|
||||
$links = xmlsitemap_link_load_multiple(array('type' => 'custom', 'loc' => $edit['loc']));
|
||||
$this->assertEqual(count($links), 1, t('Custom link saved in the database.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user