<commit_before><?php
defined('C5_EXECUTE') or die("Access Denied.");

//Permissions Check
$nh = Loader::helper('validation/numbers');
if($_GET['bID'] && $_GET['cID'] && $nh->integer($_GET['bID']) && $nh->integer($_GET['cID'])) {
	$c = Page::getByID($_GET['cID']);
	if (is_object($c) && !$c->isError()) { 
		$a = Area::get($c, $_GET['arHandle']);
			
		//edit survey mode
		$b = Block::getByID($_GET['bID'],$c, $a);
		
		$controller = new PageListBlockController($b);
		$rssUrl = $controller->getRssUrl($b);
		
		$bp = new Permissions($b);
		if( $bp->canRead() && $controller->rss && ($b->getBlockFilename() == 'blog_index.php' || $b->getBlockFilename() == 'blog_index')) {
	
			$cArray = $controller->getPages();
			$nh = Loader::helper('navigation');
	
			header('Content-type: text/xml');
			echo "<" . "?" . "xml version=\"1.0\"?>\n";
	
	?>
			<rss version="2.0">
			  <channel>
				<title><?=$controller->rssTitle?></title>
				<link><?=BASE_URL.$rssUrl?></link>
				<description><?=$controller->rssDescription?></description> 
	<?
			for ($i = 0; $i < count($cArray); $i++ ) {
				$cobj = $cArray[$i]; 
				$title = $cobj->getCollectionName(); ?>
				<item>
				  <title><?=htmlspecialchars($title);?></title>
				  <link>
					<?= BASE_URL.$nh->getLinkToCollection($cobj) ?>		  
				  </link>
				  <description><![CDATA[
					<?php
					$a = new Area('Main');
					$a->disableControls();
					$a->display($cobj);
					?>
				  ]]></description>
				  <? /* <pubDate><?=$cobj->getCollectionDatePublic()?></pubDate>
				  Wed, 23 Feb 2005 16:12:56 GMT  */ ?>
				  <pubDate><?=date( 'D, d M Y H:i:s T',strtotime($cobj->getCollectionDatePublic())) ?></pubDate>
				</item>
			<? } ?>
				 </channel>
			</rss>
			
	<?	} else {  	
			$v = View::getInstance();
			$v->renderError(t('Permission Denied'), t("This page list doesn't use the custom blog template, or you don't have permission to access this RSS feed"));
			exit;
		}
	}
	
} else {
	echo t("You don't have permission to access this RSS feed");
}
exit;





<commit_msg>add category tags to the blog rss feed.<commit_after><?php
defined('C5_EXECUTE') or die("Access Denied.");

//Permissions Check
$nh = Loader::helper('validation/numbers');
if($_GET['bID'] && $_GET['cID'] && $nh->integer($_GET['bID']) && $nh->integer($_GET['cID'])) {
	$c = Page::getByID($_GET['cID']);
	if (is_object($c) && !$c->isError()) { 
		$a = Area::get($c, $_GET['arHandle']);
			
		//edit survey mode
		$b = Block::getByID($_GET['bID'],$c, $a);
		
		$controller = new PageListBlockController($b);
		$rssUrl = $controller->getRssUrl($b);
		
		$bp = new Permissions($b);
		if( $bp->canRead() && $controller->rss && ($b->getBlockFilename() == 'blog_index.php' || $b->getBlockFilename() == 'blog_index')) {
	
			$cArray = $controller->getPages();
			$nh = Loader::helper('navigation');
	
			header('Content-type: text/xml');
			echo "<" . "?" . "xml version=\"1.0\"?>\n";
	
	?>
			<rss version="2.0">
			  <channel>
				<title><?=$controller->rssTitle?></title>
				<link><?=BASE_URL.$rssUrl?></link>
				<description><?=$controller->rssDescription?></description> 
	<?
			for ($i = 0; $i < count($cArray); $i++ ) {
				$cobj = $cArray[$i]; 
				$title = $cobj->getCollectionName();
                                $attribs = $cobj->getSetCollectionAttributes();
                                $tags = Array();
                                foreach($attribs as $attrib) {
                                  $value_object = $cobj->getAttributeValueObject($attrib);
                                  if ($value_object->getAttributeKey()->getAttributeKeyHandle() == "tags") {
                                    $tags = preg_split('/\n/', $value_object->getValue()); 
                                  }
                                }
                                ?>
				<item>
				  <title><?=htmlspecialchars($title);?></title>
				  <link>
					<?= BASE_URL.$nh->getLinkToCollection($cobj) ?>		  
				  </link>
				  <description><![CDATA[
					<?php
					$a = new Area('Main');
					$a->disableControls();
					$a->display($cobj);
					?>
				  ]]></description>
                                  <? 
                                    foreach($tags as $tag) {
                                      echo "<category>";
                                      echo $tag;
                                      echo "</category>";
                                    }
                                  ?>
				  <? /* <pubDate><?=$cobj->getCollectionDatePublic()?></pubDate>
				  Wed, 23 Feb 2005 16:12:56 GMT  */ ?>
				  <pubDate><?=date( 'D, d M Y H:i:s T',strtotime($cobj->getCollectionDatePublic())) ?></pubDate>
				</item>
			<? } ?>
				 </channel>
			</rss>
			
	<?	} else {  	
			$v = View::getInstance();
			$v->renderError(t('Permission Denied'), t("This page list doesn't use the custom blog template, or you don't have permission to access this RSS feed"));
			exit;
		}
	}
	
} else {
	echo t("You don't have permission to access this RSS feed");
}
exit;






{'fraction_non_alphanumeric': 0.21072567783094098, 'fraction_numerical': 0.007177033492822967, 'mean_word_length': 2.3291307232913074, 'pattern_counts': {'":': 0, '<': 82, '<?xml version=': 2, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2361051', 'n_tokens_mistral': 1924, 'n_tokens_neox': 1610, 'n_words': 301}