tiki-list_banners.php 2.3 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
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.
changi67's avatar
changi67 committed
6
// $Id: /cvsroot/tikiwiki/tiki/tiki-list_banners.php,v 1.16 2007-10-12 07:55:28 nyloth Exp $
7 8 9
require_once ('tiki-setup.php');
include_once ('lib/banners/bannerlib.php');
if (!isset($bannerlib)) {
10
	$bannerlib = new BannerLib;
11
}
12
// CHECK FEATURE BANNERS HERE
13
if ($prefs['feature_banners'] != 'y') {
changi67's avatar
changi67 committed
14
	$smarty->assign('msg', tra("This feature is disabled") . ": feature_banners");
15
	$smarty->display("error.tpl");
16
	die;
17
}
18

19 20
if (isset($_REQUEST["remove"])) {
	if ($tiki_p_admin_banners != 'y') {
21
		$smarty->assign('errortype', 401);
22
		$smarty->assign('msg', tra("Permission denied you cannot remove banners"));
23
		$smarty->display("error.tpl");
24 25
		die;
	}
changi67's avatar
changi67 committed
26 27 28
	$area = 'delbanner';
	if ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
		key_check($area);
mose's avatar
mose committed
29
		$bannerlib->remove_banner($_REQUEST["remove"]);
changi67's avatar
changi67 committed
30 31 32
	} else {
		key_get($area);
	}
33
}
34 35 36 37
// This script can receive the thresold
// for the information as the number of
// days to get in the log 1,3,4,etc
// it will default to 1 recovering information for today
38 39
if (!isset($_REQUEST["sort_mode"])) {
	$sort_mode = 'created_desc';
40
} else {
41 42 43
	$sort_mode = $_REQUEST["sort_mode"];
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
44 45 46
// 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
47 48
if (!isset($_REQUEST["offset"])) {
	$offset = 0;
49
} else {
50
	$offset = $_REQUEST["offset"];
51
}
52 53 54
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
	$find = $_REQUEST["find"];
55
} else {
56
	$find = '';
57
}
58
$smarty->assign('find', $find);
59
// Get a list of last changes to the Wiki database
60
if ($tiki_p_admin_banners == 'y') {
61 62 63 64
	$who = 'admin';
} else {
	$who = $user;
}
65 66
$listpages = $bannerlib->list_banners($offset, $maxRecords, $sort_mode, $find, $who);
$smarty->assign_by_ref('cant_pages', $listpages["cant"]);
67
$smarty->assign_by_ref('listpages', $listpages["data"]);
68
ask_ticket('list-banners');
69
// Display the template
70
$smarty->assign('mid', 'tiki-list_banners.tpl');
71
$smarty->display("tiki.tpl");