tiki-admin_contribution.php 3.22 KB
Newer Older
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
3 4 5
// 
// 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.
changi67's avatar
changi67 committed
6 7
// $Id$

changi67's avatar
changi67 committed
8
require_once ('tiki-setup.php');
9 10
$access->check_feature('feature_contribution');

changi67's avatar
changi67 committed
11
include_once ('lib/contribution/contributionlib.php');
12
$access->check_permission(array('tiki_p_admin_contribution'));
13

14
if (isset($_REQUEST['setting'])) {
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
	check_ticket('admin_contribution');
	if (isset($_REQUEST['feature_contribution_mandatory']) && $_REQUEST['feature_contribution_mandatory'] == "on") {
		$tikilib->set_preference('feature_contribution_mandatory', 'y');
	} else {
		$tikilib->set_preference('feature_contribution_mandatory', 'n');
	}
	if (isset($_REQUEST['feature_contribution_mandatory_forum']) && $_REQUEST['feature_contribution_mandatory_forum'] == "on") {
		$tikilib->set_preference('feature_contribution_mandatory_forum', 'y');
	} else {
		$tikilib->set_preference('feature_contribution_mandatory_forum', 'n');
	}
	if (isset($_REQUEST['feature_contribution_mandatory_comment']) && $_REQUEST['feature_contribution_mandatory_comment'] == "on") {
		$tikilib->set_preference('feature_contribution_mandatory_comment', 'y');
	} else {
		$tikilib->set_preference('feature_contribution_mandatory_comment', 'n');
	}
	if (isset($_REQUEST['feature_contribution_mandatory_blog']) && $_REQUEST['feature_contribution_mandatory_blog'] == "on") {
		$tikilib->set_preference('feature_contribution_mandatory_blog', 'y');
	} else {
		$tikilib->set_preference('feature_contribution_mandatory_blog', 'n');
	}
	if (isset($_REQUEST['feature_contribution_display_in_comment']) && $_REQUEST['feature_contribution_display_in_comment'] == "on") {
		$tikilib->set_preference('feature_contribution_display_in_comment', 'y');
	} else {
		$tikilib->set_preference('feature_contribution_display_in_comment', 'n');
	}
	if (isset($_REQUEST['feature_contributor_wiki']) && $_REQUEST['feature_contributor_wiki'] == "on") {
		$tikilib->set_preference('feature_contributor_wiki', 'y');
	} else {
		$tikilib->set_preference('feature_contributor_wiki', 'n');
	}
46 47
}
if (isset($_REQUEST['add']) && isset($_REQUEST['name'])) {
48 49
	check_ticket('admin_contribution');
	$contributionlib->add_contribution($_REQUEST['name'], isset($_REQUEST['description']) ? $_REQUEST['description'] : '');
50 51
}
if (isset($_REQUEST['replace']) && isset($_REQUEST['name']) && isset($_REQUEST['contributionId'])) {
52 53 54
	check_ticket('admin_contribution');
	$contributionlib->replace_contribution($_REQUEST['contributionId'], $_REQUEST['name'], isset($_REQUEST['description']) ? $_REQUEST['description'] : '');
	unset($_REQUEST['contributionId']);
changi67's avatar
changi67 committed
55
}
56
if (isset($_REQUEST['remove'])) {
57 58
	check_ticket('admin_contribution');
	$contributionlib->remove_contribution($_REQUEST['remove']);
59 60
}
if (isset($_REQUEST['contributionId'])) {
61 62
	$contribution = $contributionlib->get_contribution($_REQUEST['contributionId']);
	$smarty->assign('contribution', $contribution);
63 64 65 66 67 68
}
$contributions = $contributionlib->list_contributions();
$smarty->assign_by_ref('contributions', $contributions['data']);
ask_ticket('admin_contribution');
$smarty->assign('mid', 'tiki-admin_contribution.tpl');
$smarty->display("tiki.tpl");