tiki-admin_shoutbox_words.php 2.31 KB
Newer Older
1
<?php
2 3
// (c) Copyright 2002-2009 by authors of the Tiki Wiki/CMS/Groupware Project
// 
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: /cvsroot/tikiwiki/tiki/tiki-admin_shoutbox_words.php,v 1.6 2007-10-12 07:55:24 nyloth Exp $
7 8 9 10 11
// Admin to the filtering of bad shoutbox words
// First commit on cvs by damosoft aka damian
// Initialization
require_once ('tiki-setup.php');
include_once ('lib/shoutbox/shoutboxlib.php');
12
if ($prefs['feature_shoutbox'] != 'y') {
13 14 15
	$smarty->assign('msg', tra("This feature is disabled") . ": feature_shoutbox");
	$smarty->display("error.tpl");
	die;
16
}
17
if ($tiki_p_admin_shoutbox != 'y') {
18 19 20 21
	$smarty->assign('errortype', 401);
	$smarty->assign('msg', tra("You do not have permission to use this feature"));
	$smarty->display("error.tpl");
	die;
22 23 24
}
// Do the add bad word form here
if (isset($_REQUEST["add"])) {
25 26 27 28 29 30 31
	check_ticket('admin-shoutboxwords');
	if (empty($_REQUEST["word"])) {
		$smarty->assign('msg', tra("You have to provide a word"));
		$smarty->display("error.tpl");
		die;
	}
	$shoutboxlib->add_bad_word($_REQUEST["word"]);
32 33
}
if (isset($_REQUEST["remove"]) && !empty($_REQUEST["remove"])) {
34 35
	check_ticket('admin-shoutboxwords');
	$shoutboxlib->remove_bad_word($_REQUEST["remove"]);
36 37
}
if (!isset($_REQUEST["sort_mode"])) {
38
	$sort_mode = 'word_asc';
39
} else {
40
	$sort_mode = $_REQUEST["sort_mode"];
41 42 43 44 45 46
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
// 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
if (!isset($_REQUEST["offset"])) {
47
	$offset = 0;
48
} else {
49
	$offset = $_REQUEST["offset"];
50 51 52
}
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
53
	$find = $_REQUEST["find"];
54
} else {
55
	$find = '';
56 57 58
}
$smarty->assign('find', $find);
$words = $shoutboxlib->get_bad_words($offset, $maxRecords, $sort_mode, $find);
59
$smarty->assign_by_ref('cant_pages', $words["cant"]);
60 61 62
// Get users (list of users)
$smarty->assign_by_ref('words', $words["data"]);
ask_ticket('admin-shoutboxwords');
63 64
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
65 66 67
// Display the template
$smarty->assign('mid', 'tiki-admin_shoutbox_words.tpl');
$smarty->display("tiki.tpl");