<commit_before><?php
// $Header: /cvsroot/tikiwiki/tiki/contribution.php,v 1.7 2007-02-16 19:22:33 sylvieg Exp $
// Copyright (c) 2002-2005, <NAME>, <NAME>, <NAME>, et. al.
// 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.

// the script uses the var $_REQUEST['contributions'] = the list of selected contributions to preselect the contributions
//						$contributionItemId = the commentId if the object exists and you want to preselect  the comment contribuions
//						$section: to know where you are

// param: $contributionItemId: id of the comment if in coment/forum

if (strpos($_SERVER['SCRIPT_NAME'],basename(__FILE__)) !== FALSE) {
  //smarty is not there - we need setup
  require_once('tiki-setup.php');
  $smarty->assign('msg',tra('This script cannot be called directly'));
  $smarty->display('error.tpl');
  die;
}

require_once('tiki-setup.php'); 
global $feature_contribution;

if ($feature_contribution == 'y') {
	global $contributionlib; include_once('lib/contribution/contributionlib.php');
	$contributions = $contributionlib->list_contributions();
	if (!empty($_REQUEST['contributions'])) {
		for ($i = $contributions['cant'] - 1; $i >= 0; -- $i) {
			if (in_array($contributions['data'][$i]['contributionId'], $_REQUEST['contributions'])) {
				$contributions['data'][$i]['selected'] = 'y';
				$oneSelected = 'y';
			}
		}
	}
	if (!empty($contributionItemId)) {
		$assignedContributions = $contributionlib->get_assigned_contributions($contributionItemId, 'comment');
		if (!empty($assignedContributions)) {
			foreach ($assignedContributions as $a) {
				for ($i = $contributions['cant'] - 1; $i >= 0; -- $i) {
					if ($a['contributionId'] == $contributions['data'][$i]['contributionId']) {
						$contributions['data'][$i]['selected'] = 'y';
						$oneSelected = 'y';
						break;
					}
				}
			}
		}
	}
	if (!empty($oneSelected)) {
		if ((isset($section) && $section == 'forum' && $feature_contribution_mandatory_forum != 'y') || ((!isset($section) || $section != 'forum') && $feature_contribution_mandatory_comment != 'y'))
		$contributions['data'][] = array('contributionId'=>0, 'name'=>'');
	}		
	$smarty->assign_by_ref('contributions', $contributions['data']);

	if ($feature_contributor_wiki == 'y' && !empty($section) && $section == 'wiki page') {
		$users = $userlib->list_all_users();
		$smarty->assign_by_ref('users', $users);
		if (!empty($_REQUEST['contributors'])) {
			$smarty->assign_by_ref('contributors', $_REQUEST['contributors']);
		}
	}
}
?><commit_msg>notice<commit_after><?php
// $Header: /cvsroot/tikiwiki/tiki/contribution.php,v 1.8 2007-05-03 11:00:18 sylvieg Exp $
// Copyright (c) 2002-2005, <NAME>, <NAME>, <NAME>, et. al.
// 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.

// the script uses the var $_REQUEST['contributions'] = the list of selected contributions to preselect the contributions
//						$contributionItemId = the commentId if the object exists and you want to preselect  the comment contribuions
//						$section: to know where you are

// param: $contributionItemId: id of the comment if in coment/forum

if (strpos($_SERVER['SCRIPT_NAME'],basename(__FILE__)) !== FALSE) {
  //smarty is not there - we need setup
  require_once('tiki-setup.php');
  $smarty->assign('msg',tra('This script cannot be called directly'));
  $smarty->display('error.tpl');
  die;
}

require_once('tiki-setup.php'); 
global $feature_contribution;

if ($feature_contribution == 'y') {
	global $contributionlib; include_once('lib/contribution/contributionlib.php');
	$contributions = $contributionlib->list_contributions();
	if (!empty($_REQUEST['contributions'])) {
		for ($i = $contributions['cant'] - 1; $i >= 0; -- $i) {
			if (in_array($contributions['data'][$i]['contributionId'], $_REQUEST['contributions'])) {
				$contributions['data'][$i]['selected'] = 'y';
				$oneSelected = 'y';
			}
		}
	}
	if (!empty($contributionItemId)) {
		$assignedContributions = $contributionlib->get_assigned_contributions($contributionItemId, 'comment');
		if (!empty($assignedContributions)) {
			foreach ($assignedContributions as $a) {
				for ($i = $contributions['cant'] - 1; $i >= 0; -- $i) {
					if ($a['contributionId'] == $contributions['data'][$i]['contributionId']) {
						$contributions['data'][$i]['selected'] = 'y';
						$oneSelected = 'y';
						break;
					}
				}
			}
		}
	}
	if (!empty($oneSelected)) {
		if ((isset($section) && $section == 'forum' && $feature_contribution_mandatory_forum != 'y') || ((!isset($section) || $section != 'forum') && $feature_contribution_mandatory_comment != 'y'))
		$contributions['data'][] = array('contributionId'=>0, 'name'=>'');
	}		
	$smarty->assign_by_ref('contributions', $contributions['data']);

	global $feature_contributor_wiki;
	if ($feature_contributor_wiki == 'y' && !empty($section) && $section == 'wiki page') {
		$users = $userlib->list_all_users();
		$smarty->assign_by_ref('users', $users);
		if (!empty($_REQUEST['contributors'])) {
			$smarty->assign_by_ref('contributors', $_REQUEST['contributors']);
		}
	}
}
?>
{'fraction_non_alphanumeric': 0.18602885345482156, 'fraction_numerical': 0.011009870918754746, 'mean_word_length': 4.933558558558558, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 35, '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': '5410438', 'n_tokens_mistral': 1969, 'n_tokens_neox': 1701, 'n_words': 386}