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
\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");
?>