tiki-admin_hotwords.php 1.92 KB
Newer Older
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
rjsmelo's avatar
rjsmelo 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.
9
// $Id$
changi67's avatar
changi67 committed
10

rjsmelo's avatar
rjsmelo committed
11 12
require_once('tiki-setup.php');
include_once('lib/hotwords/hotwordlib.php');
13 14 15
$access->check_feature('feature_hotwords');
$access->check_permission('tiki_p_admin');

16
// Process the form to add a user here
17
if (isset($_REQUEST["add"])) {
18 19 20 21 22 23 24
	check_ticket('admin-hotwords');
	if (empty($_REQUEST["word"]) || empty($_REQUEST["url"])) {
		$smarty->assign('msg', tra("You have to provide a hotword and a URL"));
		$smarty->display("error.tpl");
		die;
	}
	$hotwordlib->add_hotword($_REQUEST["word"], $_REQUEST["url"]);
25
}
rjsmelo's avatar
rjsmelo committed
26
if (isset($_REQUEST["remove"]) && ! empty($_REQUEST["remove"])) {
27 28
	$access->check_authenticity();
	$hotwordlib->remove_hotword($_REQUEST["remove"]);
29
}
rjsmelo's avatar
rjsmelo committed
30
if (! isset($_REQUEST["sort_mode"])) {
31
	$sort_mode = 'word_desc';
32
} else {
33
	$sort_mode = $_REQUEST["sort_mode"];
34 35
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
36 37 38
// If offset is set use it if not then use offset =0
// use the maxRecords php variable to set the limit
// if sortMode is not set then use lastModif_desc
rjsmelo's avatar
rjsmelo committed
39
if (! isset($_REQUEST["offset"])) {
40
	$offset = 0;
41
} else {
42
	$offset = $_REQUEST["offset"];
43
}
44 45
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
46
	$find = $_REQUEST["find"];
47
} else {
48
	$find = '';
49
}
50 51
$smarty->assign('find', $find);
$words = $hotwordlib->list_hotwords($offset, $maxRecords, $sort_mode, $find);
52
$smarty->assign_by_ref('cant_pages', $words["cant"]);
53
// Get users (list of users)
54
$smarty->assign_by_ref('words', $words["data"]);
55
ask_ticket('admin-hotwords');
56 57
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
58
// Display the template
59
$smarty->assign('mid', 'tiki-admin_hotwords.tpl');
60
$smarty->display("tiki.tpl");