/[pkg-tikiwiki]/trunk/tiki-list_banners.php
ViewVC logotype

Contents of /trunk/tiki-list_banners.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download)
Tue Jul 11 06:27:24 2006 UTC (6 years, 10 months ago) by marcusb-guest
File size: 3045 byte(s)
Imported into trunk (integration branch).
1 <?php
2
3 // $Header: /cvsroot/tikiwiki/tiki/tiki-list_banners.php,v 1.11.2.2 2005/01/01 00:11:25 damosoft Exp $
4
5 // Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
6 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
7 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
8
9 // Initialization
10 require_once ('tiki-setup.php');
11
12 include_once ('lib/banners/bannerlib.php');
13
14 if (!isset($bannerlib)) {
15 $bannerlib = new BannerLib($dbTiki);
16 }
17
18 // CHECK FEATURE BANNERS HERE
19 if ($feature_banners != 'y') {
20 $smarty->assign('msg', tra("This feature is disabled").": feature_banners");
21
22 $smarty->display("error.tpl");
23 die;
24 }
25
26 // IF NOT LOGGED aND NOT ADMIN BAIL OUT
27 if (!$user) {
28 $smarty->assign('msg', tra("You are not logged in"));
29
30 $smarty->display("error.tpl");
31 die;
32 }
33
34 if (isset($_REQUEST["remove"])) {
35 if ($tiki_p_admin_banners != 'y') {
36 $smarty->assign('msg', tra("Permission denied you cannot remove banners"));
37 $smarty->display("error.tpl");
38 die;
39 }
40 $area = 'delbanner';
41 if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
42 key_check($area);
43 $bannerlib->remove_banner($_REQUEST["remove"]);
44 } else {
45 key_get($area);
46 }
47 }
48
49 // This script can receive the thresold
50 // for the information as the number of
51 // days to get in the log 1,3,4,etc
52 // it will default to 1 recovering information for today
53 if (!isset($_REQUEST["sort_mode"])) {
54 $sort_mode = 'created_desc';
55 } else {
56 $sort_mode = $_REQUEST["sort_mode"];
57 }
58
59 $smarty->assign_by_ref('sort_mode', $sort_mode);
60
61 // If offset is set use it if not then use offset =0
62 // use the maxRecords php variable to set the limit
63 // if sortMode is not set then use lastModif_desc
64 if (!isset($_REQUEST["offset"])) {
65 $offset = 0;
66 } else {
67 $offset = $_REQUEST["offset"];
68 }
69
70 $smarty->assign_by_ref('offset', $offset);
71
72 if (isset($_REQUEST["find"])) {
73 $find = $_REQUEST["find"];
74 } else {
75 $find = '';
76 }
77
78 $smarty->assign('find', $find);
79
80 // Get a list of last changes to the Wiki database
81 $who = 'admin';
82 /*
83 if($tiki_p_admin_banners == 'y') {
84 $who = 'admin';
85 } else {
86 $who = $user;
87 }
88 */
89 $listpages = $bannerlib->list_banners($offset, $maxRecords, $sort_mode, $find, $who);
90 // If there're more records then assign next_offset
91 $cant_pages = ceil($listpages["cant"] / $maxRecords);
92 $smarty->assign_by_ref('cant_pages', $cant_pages);
93 $smarty->assign('actual_page', 1 + ($offset / $maxRecords));
94
95 if ($listpages["cant"] > ($offset + $maxRecords)) {
96 $smarty->assign('next_offset', $offset + $maxRecords);
97 } else {
98 $smarty->assign('next_offset', -1);
99 }
100
101 // If offset is > 0 then prev_offset
102 if ($offset > 0) {
103 $smarty->assign('prev_offset', $offset - $maxRecords);
104 } else {
105 $smarty->assign('prev_offset', -1);
106 }
107
108 $smarty->assign_by_ref('listpages', $listpages["data"]);
109 //print_r($listpages["data"]);
110 ask_ticket('list-banners');
111
112 // Display the template
113 $smarty->assign('mid', 'tiki-list_banners.tpl');
114 $smarty->display("tiki.tpl");
115
116 ?>

  ViewVC Help
Powered by ViewVC 1.1.5