summaryrefslogtreecommitdiff
path: root/print.php
blob: e923d9330619bfbad0e4d961d18aee8f62846f9f (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
 * $Header: /cvsroot/bitweaver/_bit_wiki/print.php,v 1.7 2006/02/04 19:04:35 squareing Exp $
 *
 * 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 copyright.txt for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
 *
 * $Id: print.php,v 1.7 2006/02/04 19:04:35 squareing Exp $
 * @package wiki
 * @subpackage functions
 */

/**
 * required setup
 */
require_once( '../bit_setup_inc.php' );
include_once( WIKI_PKG_PATH.'BitPage.php');

$gBitSystem->verifyPackage( 'wiki' );

// If the page doesn't exist then display an error
$requirePage = TRUE;
include( WIKI_PKG_PATH.'lookup_page_inc.php' );

// Now check permissions to access this page
if (!$gContent->hasUserPermission( 'bit_p_view' )) {
	$gBitSmarty->assign('msg', tra("Permission denied you cannot view this page"));
	$gBitSystem->display( 'error.tpl' );
	die;
}

require_once ( WIKI_PKG_PATH.'page_setup_inc.php' );
// Check if we have to perform an action for this page
// for example lock/unlock
if (isset($_REQUEST["action"])) {
	
	if ($_REQUEST["action"] == 'lock') {
		$gContent->lock();
	} elseif ($_REQUEST["action"] == 'unlock') {
		$gContent->unlock_page();
	}
}

// Now increment page hits since we are visiting this page
if ($count_admin_pvs == 'y' || !$gBitUser->isAdmin()) {
  $gContent->addHit();
}
// Get page data
$info = $gContent->mInfo;
if ($gBitSystem->isFeatureActive( 'wiki_feature_copyrights' ) && $gBitSystem->isFeatureActive( 'wiki_feature_copyrights' ) && $gBitSystem->isFeatureActive( 'wikiLicensePage' )) {
	// insert license if wiki copyrights enabled
//	$license_info = $wikilib->get_page_info($wikiLicensePage);
//	$wikilib->add_hit($wikiLicensePage);
	$info["data"] = $info["data"] . "\n<HR>\n" . $license_info["data"];
	$_REQUEST['copyrightpage'] = $page;
}
// Verify lock status
if ($info["flag"] == 'L') {
	$gBitSmarty->assign('lock', true);
} else {
	$gBitSmarty->assign('lock', false);
}
$gBitSmarty->assign('cached_page','n');
if(isset($gContent->mInfo['wiki_cache']) && $gContent->mInfo['wiki_cache']>0) {$wiki_cache=$gContent->mInfo['wiki_cache'];}
if($wiki_cache>0) {
	$cache_info = $wikilib->get_cache_info($page);
	$now = $gBitSystem->getUTCTime();
	if($cache_info['cache_timestamp']+$wiki_cache > $now) {
		$pdata = $cache_info['cache'];
		$gBitSmarty->assign('cached_page','y');
	} else {
		$pdata = $gContent->parseData();
		$wikilib->update_cache($page,$pdata);
	}
} else {
	$pdata = $gContent->parseData();
}
$gBitSmarty->assign_by_ref('parsed', $pdata);
$gBitSmarty->assign_by_ref('last_modified', $info["last_modified"]);
if (empty($info["user"])) {
	$info["user"] = 'anonymous';
}
$gBitSmarty->assign_by_ref('lastUser', $info["user"]);
//Store the page URL to be displayed on print page
$http_domain = $wikilib->getPreference('http_domain', false);
$http_port = $wikilib->getPreference('http_port', 80);
$http_prefix = $wikilib->getPreference('http_prefix', '/');
if ($http_domain) {
	$prefix = 'http://' . $http_domain;
	if ($http_port != 80)
		$prefix .= ':' . $http_port;
	$prefix .= $https_prefix;
	$gBitSmarty->assign('urlprefix', $prefix);
}

// Display the Index Template
$gBitSmarty->assign('print_page','y');
$gBitSmarty->assign('show_page_bar', 'n');
$gBitSmarty->display("bitpackage:wiki/print.tpl");
?>