copyrights.php 2.92 KB
Newer Older
axonrg's avatar
axonrg committed
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
6
// 
7 8
// 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
9
// $Id$
10 11

require_once ('tiki-setup.php');
12
$access->check_feature('wiki_feature_copyrights');
michael_davey's avatar
michael_davey committed
13
$access->check_permission(array('tiki_p_edit_copyrights'), tra("Copyright management"));
axonrg's avatar
axonrg committed
14

15
include_once ("lib/copyrights/copyrightslib.php");
axonrg's avatar
axonrg committed
16
global $dbTiki;
17
$copyrightslib = new CopyrightsLib;
axonrg's avatar
axonrg committed
18

19
if (!isset($_REQUEST["page"])) {
20 21 22
	$smarty->assign('msg', tra("No page indicated"));
	$smarty->display("error.tpl");
	die;
axonrg's avatar
axonrg committed
23 24
}

25
$smarty->assign('page', $_REQUEST["page"]);
axonrg's avatar
axonrg committed
26 27
$page = $_REQUEST["page"];

28
if (isset($_REQUEST['addcopyright'])) {
29
	if ($prefs['wiki_feature_copyrights'] == 'y' && isset($_REQUEST['copyrightTitle']) && isset($_REQUEST['copyrightYear'])
30 31
		&& isset($_REQUEST['copyrightAuthors']) && !empty($_REQUEST['copyrightYear']) && !empty($_REQUEST['copyrightTitle'])) {
		$copyrightYear = $_REQUEST['copyrightYear'];
axonrg's avatar
axonrg committed
32

33 34
		$copyrightTitle = $_REQUEST['copyrightTitle'];
		$copyrightAuthors = $_REQUEST['copyrightAuthors'];
35 36
		$copyrightHolder = $_REQUEST['copyrightHolder'];
		$copyrightslib->add_copyright($page, $copyrightTitle, $copyrightYear, $copyrightAuthors, $copyrightHolder, $user);
37
	} else {
michael_davey's avatar
michael_davey committed
38 39
		$msg = tra("You must supply all the information, including title and year.");
		$access->display_error(basename(__FILE__), $msg);
40
	}
axonrg's avatar
axonrg committed
41 42
}

43
if (isset($_REQUEST['editcopyright'])) {
44
	if ($prefs['wiki_feature_copyrights'] == 'y' && isset($_REQUEST['copyrightTitle']) && isset($_REQUEST['copyrightYear']) && isset($_REQUEST['copyrightHolder'])
45 46 47 48 49 50
		&& isset($_REQUEST['copyrightAuthors']) && !empty($_REQUEST['copyrightYear']) && !empty($_REQUEST['copyrightTitle'])) {
		$copyrightId = $_REQUEST['copyrightId'];

		$copyrightYear = $_REQUEST['copyrightYear'];
		$copyrightTitle = $_REQUEST['copyrightTitle'];
		$copyrightAuthors = $_REQUEST['copyrightAuthors'];
51 52
		$copyrightHolder = $_REQUEST['copyrightHolder'];
		$copyrightslib->edit_copyright($copyrightId, $copyrightTitle, $copyrightYear, $copyrightAuthors, $copyrightHolder, $user);
53
	} else {
michael_davey's avatar
michael_davey committed
54 55
		$msg = tra("You must supply all the information, including title and year.");
		$access->display_error(basename(__FILE__), $msg);
56
	}
axonrg's avatar
axonrg committed
57 58
}

59 60 61 62 63 64
if (isset($_REQUEST['action']) && isset($_REQUEST['copyrightId'])) {
	if ($_REQUEST['action'] == 'up') {
		$copyrightslib->up_copyright($_REQUEST['copyrightId']);
	} elseif ($_REQUEST['action'] == 'down') {
		$copyrightslib->down_copyright($_REQUEST['copyrightId']);
	} elseif ($_REQUEST['action'] == 'delete') {
65 66
		$access->check_authenticity();
		$copyrightslib->remove_copyright($_REQUEST['copyrightId']);
67
	}
axonrg's avatar
axonrg committed
68 69 70
}

$copyrights = $copyrightslib->list_copyrights($_REQUEST["page"]);
71
$smarty->assign('copyrights', $copyrights["data"]);
axonrg's avatar
axonrg committed
72 73

// Display the template
74
$smarty->assign('mid', 'copyrights.tpl');
75
$smarty->display("tiki.tpl");