tiki-lastchanges.php 2.25 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 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

mose's avatar
mose committed
11
$section = 'wiki page';
12
$section_class = "tiki_wiki_page manage";	// This will be body class instead of $section
rjsmelo's avatar
rjsmelo committed
13
require_once('tiki-setup.php');
14
$histlib = TikiLib::lib('hist');
rjsmelo's avatar
rjsmelo committed
15
$auto_query_args = ['sort_mode', 'offset', 'find', 'days'];
16 17 18
$access->check_feature('feature_wiki');
$access->check_feature('feature_lastChanges');
$access->check_permission('tiki_p_view');
rjsmelo's avatar
rjsmelo committed
19
if (! isset($_REQUEST["find"])) {
20
	$findwhat = '';
lrargerich's avatar
lrargerich committed
21
} else {
22
	$findwhat = $_REQUEST["find"];
lrargerich's avatar
lrargerich committed
23
}
24
$smarty->assign('find', $findwhat);
rjsmelo's avatar
rjsmelo committed
25
if (! isset($_REQUEST["days"])) {
26
	$days = 1;
27
} else {
28
	$days = $_REQUEST["days"];
29
}
rjsmelo's avatar
rjsmelo committed
30
if (! isset($_REQUEST["sort_mode"])) {
31
	$sort_mode = 'lastModif_desc';
32
} else {
33 34 35 36 37
	$sort_mode = $_REQUEST["sort_mode"];
}
$smarty->assign_by_ref('days', $days);
$smarty->assign_by_ref('findwhat', $findwhat);
$smarty->assign_by_ref('sort_mode', $sort_mode);
rjsmelo's avatar
rjsmelo committed
38
if (! isset($_REQUEST["offset"])) {
39
	$offset = 0;
40
} else {
41
	$offset = $_REQUEST["offset"];
42
}
43
$smarty->assign_by_ref('offset', $offset);
44
// Get a list of last changes to the Wiki database
45 46 47
$more = 0;
$lastchanges = $histlib->get_last_changes($days, $offset, $maxRecords, $sort_mode, $findwhat);
$smarty->assign_by_ref('cant_records', $lastchanges["cant"]);
48 49
// If there're more records then assign next_offset
$cant_pages = ceil($lastchanges["cant"] / $maxRecords);
50 51 52 53
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
if ($lastchanges["cant"] > ($offset + $maxRecords)) {
	$smarty->assign('next_offset', $offset + $maxRecords);
54
} else {
55
	$smarty->assign('next_offset', -1);
56
}
57 58
if ($offset > 0) {
	$smarty->assign('prev_offset', $offset - $maxRecords);
59
} else {
60
	$smarty->assign('prev_offset', -1);
61
}
62
$smarty->assign_by_ref('lastchanges', $lastchanges["data"]);
63
ask_ticket('lastchanges');
rjsmelo's avatar
rjsmelo committed
64
include_once('tiki-section_options.php');
65 66
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
67
// Display the template
68
$smarty->assign('mid', 'tiki-lastchanges.tpl');
69
$smarty->display("tiki.tpl");