summaryrefslogtreecommitdiff
path: root/page_history.php
blob: 86f18fe12be3cf89b7f252dbc2115ad0c7f08496 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
 * Copyright (c) 2004 bitweaver.org
 * Copyright (c) 2003 tikwiki.org
 * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * @package wiki
 * @subpackage functions
 */

/**
 * required setup
 */
require_once( '../kernel/includes/setup_inc.php' );
require_once( WIKI_PKG_CLASS_PATH.'BitPage.php');

$gBitSystem->verifyPackage( 'wiki' );
$gBitSystem->verifyFeature( 'wiki_history' );

// Get the page from the request var or default it to HomePage
include( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );

//vd($gContent->mPageId);vd($gContent->mInfo);
if( !$gContent->isValid() || empty( $gContent->mInfo ) ) {
	$gBitSystem->fatalError( tra( "Unknown page" ));
}

$gContent->verifyViewPermission();
$gContent->verifyUserPermission( 'p_wiki_view_history' );

$gBitSmarty->assignByRef( 'pageInfo', $gContent->mInfo );

if (!empty( $_REQUEST['rollback_preview'] )) {
	$gBitSmarty->assign( 'rollback_preview', $_REQUEST['rollback_preview']);
}

// set up stuff to get history working
$smartyContentRef = 'pageInfo';
$rollbackPerm     = 'p_wiki_rollback';
include_once( LIBERTY_PKG_INCLUDE_PATH.'content_history_inc.php' );

// pagination stuff
$gBitSmarty->assign( 'page', $page = !empty( $_REQUEST['page'] ) ? $_REQUEST['page'] : 1 );
if( !empty( $_REQUEST['list_page'] )) {
	$gBitSmarty->assign( 'page', $page = !empty( $_REQUEST['list_page'] ) ? $_REQUEST['list_page'] : 1 );
}

$offset = ( $page - 1 ) * $gBitSystem->getConfig( 'max_records' );
$history = $gContent->getHistory( NULL, NULL, $offset, $gBitSystem->getConfig( 'max_records' ) );
$gBitSmarty->assignByRef( 'data', $history['data'] );
$gBitSmarty->assignByRef( 'listInfo', $history['listInfo'] );

// Display the template
$gBitSmarty->assignByRef( 'gContent', $gContent );
$gBitSystem->display( 'bitpackage:wiki/page_history.tpl' , NULL, array( 'display_mode' => 'display' ));
?>