Skip to content

Commit

Permalink
Merge pull request #106 from webbuilders-group/not-allowed-block
Browse files Browse the repository at this point in the history
BUGFIX: Fixed issue where classes not in the sitemap would cause a crash
  • Loading branch information
wilr committed Jun 29, 2016
2 parents 49053f7 + cc0c20b commit bb7fbb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion code/GoogleSitemap.php
Expand Up @@ -118,7 +118,13 @@ public static function register_dataobjects($dataobjects, $changeFreq = 'monthly
*/
public static function is_registered($className)
{
return isset(self::$dataobjects[$className]);
if (!isset(self::$dataobjects[$className])) {
$lowerKeys = array_change_key_case(self::$dataobjects);

return isset($lowerKeys[$className]);
}

return true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/GoogleSitemapController.php
Expand Up @@ -60,7 +60,7 @@ public function sitemap()
$class = $this->unsanitiseClassName($this->request->param('ID'));
$page = $this->request->param('OtherID');

if (GoogleSitemap::enabled() && $class && $page) {
if (GoogleSitemap::enabled() && $class && $page && ($class == 'SiteTree' || $class == 'GoogleSitemapRoute' || GoogleSitemap::is_registered($class))) {
Config::inst()->update('SSViewer', 'set_source_file_comments', false);

$this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
Expand Down

0 comments on commit bb7fbb8

Please sign in to comment.