<commit_before><?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/trackers/trackerlib.php');
require_once ('lib/rss/rsslib.php');
if ($prefs['rss_tracker'] != 'y') {
	$errmsg = tra("rss feed disabled");
	require_once ('tiki-rss_error.php');
}
if ($prefs['feature_trackers'] != 'y') {
	$errmsg = tra("This feature is disabled") . ": feature_trackers";
	require_once ('tiki-rss_error.php');
}
if (!isset($_REQUEST["trackerId"])) {
	$errmsg = tra("No trackerId specified");
	require_once ('tiki-rss_error.php');
}
if ($tiki_p_admin_trackers != 'y' && !$tikilib->user_has_perm_on_object($user, $_REQUEST['trackerId'], 'tracker', 'tiki_p_view_trackers')) {
	$smarty->assign('errortype', 401);
	$errmsg = tra("Permission denied. You cannot view this section");
	require_once ('tiki-rss_error.php');
}
$feed = "tracker";
$id = "trackerId";
$uniqueid = "$feed.id=" . $_REQUEST["trackerId"];
if (isset($_REQUEST['sort_mode'])) {
	$sort_mode = $_REQUEST['sort_mode'];
	$uniqueid.= $sort_mode;
} else {
	$sort_mode = 'created_desc';
}
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
	$tmp = $tikilib->get_tracker($_REQUEST["$id"]);
	$title = tra("Tiki RSS feed for individual trackers: ") . $tmp["name"];
	$desc = $tmp["description"];
	$tmp = null;
	$tmp = $prefs['title_rss_' . $feed];
	if ($tmp <> '') $title = $tmp;
	$tmp = $prefs['desc_rss_' . $feed];
	if ($desc <> '') $desc = $tmp;
	$titleId = "rss_subject";
	$descId = "rss_description";
	$authorId = ""; // "user";
	$dateId = "created";
	$urlparam = "itemId";
	$readrepl = "tiki-view_tracker_item.php?$id=%s&$urlparam=%s";
	$listfields = $trklib->list_tracker_fields($_REQUEST[$id]);
	$fields = array();
	foreach($listfields['data'] as $f) {
		if ($f['isHidden'] == 'y' || $f['isHidden'] == 'c') continue;
		$fields[$f['fieldId']] = $f;
	}
	if (isset($_REQUEST['filterfield'])) {
		$filterfield = explode(':', $_REQUEST['filterfield']);
		if (isset($_REQUEST['exactvalue'])) {
			$exactvalue = explode(':', $_REQUEST['exactvalue']);
		}
		if (isset($_REQUEST['filtertvalue'])) {
			$exactvalue = explode(':', $_REQUEST['filtervalue']);
		}
	} else {
		$filterfield = null;
		$exactvalue = null;
		$filtervalue = null;
	}
	if (isset($_REQUEST['status'])) {
		$status = $_REQUEST['status'];
	} else {
		$status = null;
	}
	$tmp = $trklib->list_items($_REQUEST[$id], 0, $prefs['max_rss_tracker'], $sort_mode, $fields, $filterfield, $filtervalue, $status, null, $exactvalue);
	foreach($tmp["data"] as $data) {
		$data[$titleId] = tra('Tracker item:') . ' #' . $data[$urlparam];
		$data[$descId] = '';
		$first_text_field = null;
		$aux_subject = null;
		foreach($data["field_values"] as $data2) {
			if (isset($data2["name"])) {
				$smarty->assign_by_ref('field_value', $data2);
				$smarty->assign_by_ref('item', $data);
				$data2['value'] = $smarty->fetch('tracker_item_field_value.tpl');
				if ($data2['value'] == '') {
					$data2['value'] = '(' . tra('empty') . ')';
				} else {
					$data2['value'] = htmlspecialchars_decode($data2['value']);
				}
				$data[$descId].= $data2["name"] . ": " . $data2["value"] . "<br />";
				$field_name_check = strtolower($data2["name"]);<commit_msg>[FIX]tracker: rss must respect perms on closed, pending..<commit_after><?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/trackers/trackerlib.php');
require_once ('lib/rss/rsslib.php');
if ($prefs['rss_tracker'] != 'y') {
	$errmsg = tra("rss feed disabled");
	require_once ('tiki-rss_error.php');
}
if ($prefs['feature_trackers'] != 'y') {
	$errmsg = tra("This feature is disabled") . ": feature_trackers";
	require_once ('tiki-rss_error.php');
}
if (!isset($_REQUEST["trackerId"])) {
	$errmsg = tra("No trackerId specified");
	require_once ('tiki-rss_error.php');
}
$perms = Perms::get(array('type' => 'tracker', 'object' => $_REQUEST['trackerId']));
if ($tiki_p_admin_trackers != 'y' && (!$perms->view_trackers && !$perms->view_trackers_pending && !$perms->view_trackers_closed)) {
	$smarty->assign('errortype', 401);
	$errmsg = tra("Permission denied. You cannot view this section");
	require_once ('tiki-rss_error.php');
}
$feed = "tracker";
$id = "trackerId";
$uniqueid = "$feed.id=" . $_REQUEST["trackerId"];
if (isset($_REQUEST['sort_mode'])) {
	$sort_mode = $_REQUEST['sort_mode'];
	$uniqueid.= $sort_mode;
} else {
	$sort_mode = 'created_desc';
}
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
	$tmp = $tikilib->get_tracker($_REQUEST["$id"]);
	$title = tra("Tiki RSS feed for individual trackers: ") . $tmp["name"];
	$desc = $tmp["description"];
	$tmp = null;
	$tmp = $prefs['title_rss_' . $feed];
	if ($tmp <> '') $title = $tmp;
	$tmp = $prefs['desc_rss_' . $feed];
	if ($desc <> '') $desc = $tmp;
	$titleId = "rss_subject";
	$descId = "rss_description";
	$authorId = ""; // "user";
	$dateId = "created";
	$urlparam = "itemId";
	$readrepl = "tiki-view_tracker_item.php?$id=%s&$urlparam=%s";
	$listfields = $trklib->list_tracker_fields($_REQUEST[$id]);
	$fields = array();
	foreach($listfields['data'] as $f) {
		if ($f['isHidden'] == 'y' || $f['isHidden'] == 'c') continue;
		$fields[$f['fieldId']] = $f;
	}
	if (isset($_REQUEST['filterfield'])) {
		$filterfield = explode(':', $_REQUEST['filterfield']);
		if (isset($_REQUEST['exactvalue'])) {
			$exactvalue = explode(':', $_REQUEST['exactvalue']);
		}
		if (isset($_REQUEST['filtertvalue'])) {
			$exactvalue = explode(':', $_REQUEST['filtervalue']);
		}
	} else {
		$filterfield = null;
		$exactvalue = null;
		$filtervalue = null;
	}
	if (isset($_REQUEST['status'])) {
		if (!$trklib->valid_status($_REQUEST['status'])) {
			$errmsg = tra("Incorrect parameter");
			require_once ('tiki-rss_error.php');
		}
		$status = $_REQUEST['status'];
	} else {
		$status = 'opc';
	}
	if (!$perms->view_trackers) {
		$status = str_replace('o', '', $status);
	}
	if (!$perms->view_trackers_pending) {
		$status = str_replace('p', '', $status);
	}
	if (!$perms->view_trackers_closed) {
		$status = str_replace('c', '', $status);
	}
	if (empty($status)) {
		$smarty->assign('errortype', 401);
		$errmsg = tra("Permission denied. You cannot view this section");
		require_once ('tiki-rss_error.php');
	}
	$tmp = $trklib->list_items($_REQUEST[$id], 0, $prefs['max_rss_tracker'], $sort_mode, $fields, $filterfield, $filtervalue, $status, null, $exactvalue);
	foreach($tmp["data"] as $data) {
		$data[$titleId] = tra('Tracker item:') . ' #' . $data[$urlparam];
		$data[$descId] = '';
		$first_text_field = null;
		$aux_subject = null;
		foreach($data["field_values"] as $data2) {
			if (isset($data2["name"])) {
				$smarty->assign_by_ref('field_value', $data2);
				$smarty->assign_by_ref('item', $data);
				$data2['value'] = $smarty->fetch('tracker_item_field_value.tpl');
				if ($data2['value'] == '') {
					$data2['value'] = '(' . tra('empty') . ')';
				} else {
					$data2['value'] = htmlspecialchars_decode($data2['value']);
				}
				$data[$descId].= $data2["name"] . ": " . $data2["value"] . "<br />";
				$field_name_check = strtolower($data2["name"]);
{'fraction_non_alphanumeric': 0.22569216638236453, 'fraction_numerical': 0.006429602414381314, 'mean_word_length': 5.201790073230269, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4783591', 'n_tokens_mistral': 2975, 'n_tokens_neox': 2803, 'n_words': 537}