tiki-admin_links.php 1.89 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.
6
// $Id$
changi67's avatar
changi67 committed
7

8 9
require_once ('tiki-setup.php');
include_once ('lib/featured_links/flinkslib.php');
10 11
$access->check_feature('feature_featuredLinks');
$access->check_permission('tiki_p_admin');
12 13 14 15
$smarty->assign('title', '');
$smarty->assign('type', 'f');
$smarty->assign('position', 1);
if (isset($_REQUEST["generate"])) {
16 17
	check_ticket('admin-links');
	$flinkslib->generate_featured_links_positions();
lrargerich's avatar
lrargerich committed
18
}
19
if (!isset($_REQUEST["editurl"])) {
20
	$_REQUEST["editurl"] = 'n';
lrargerich's avatar
lrargerich committed
21
}
22
if ($_REQUEST["editurl"] != 'n') {
23 24 25 26 27 28 29 30 31
	$info = $flinkslib->get_featured_link($_REQUEST["editurl"]);
	if (!$info) {
		$smarty->assign('msg', tra("Non-existent link"));
		$smarty->display("error.tpl");
		die;
	}
	$smarty->assign('title', $info["title"]);
	$smarty->assign('position', $info["position"]);
	$smarty->assign('type', $info["type"]);
32
}
33 34
$smarty->assign('editurl', $_REQUEST["editurl"]);
if (isset($_REQUEST["add"])) {
35 36 37 38 39 40 41 42
	check_ticket('admin-links');
	if (!empty($_REQUEST["url"]) && !empty($_REQUEST["url"])) {
		if ($_REQUEST["editurl"] == 0) {
			$flinkslib->add_featured_link($_REQUEST["url"], $_REQUEST["title"], '', $_REQUEST["position"], $_REQUEST["type"]);
		} else {
			$flinkslib->update_featured_link($_REQUEST["url"], $_REQUEST["$title"], '', $_REQUEST["position"], $_REQUEST["type"]);
		}
	}
43
}
44
if (isset($_REQUEST["remove"])) {
45 46
	$access->check_authenticity();
	$flinkslib->remove_featured_link($_REQUEST["remove"]);
47 48 49
}
$links = $tikilib->get_featured_links(999999);
$smarty->assign_by_ref('links', $links);
50
ask_ticket('admin-links');
51 52
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
53
$smarty->assign('mid', 'tiki-admin_links.tpl');
54
$smarty->display("tiki.tpl");