summaryrefslogtreecommitdiff
path: root/view_cache.php
blob: 3ef91ec9ae8e0e8e53ceff8a1f1f4401464eb128 (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
<?php
/**
 * @version $Header$
 * @package kernel
 * @subpackage functions
 */

// 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.

/**
 * required setup
 */
require_once '../kernel/includes/setup_inc.php';
use Bitweaver\KernelTools;
use Bitweaver\Wiki\BitPage;

/*
if($gBitSystem->getConfig('wiki_list_pages') != 'y') {
  $gBitSmarty->assign('msg', KernelTools::tra("This feature is disabled"));
  $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'display' ));
  die;  
}
*/
if (isset($_REQUEST['url'])) {
	$id = $wikilib->isUrlCached($_REQUEST['url']);

	if (!$id) {
		$gBitSmarty->assign('msg', KernelTools::tra("No cache information available"));

		$gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'display' ));
		die;
	}

	$_REQUEST["cache_id"] = $id;
}

if (!isset($_REQUEST["cache_id"])) {
	$gBitSmarty->assign('msg', KernelTools::tra("No page indicated"));

	$gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'display' ));
	die;
}

// Get a list of last changes to the Wiki database
$info = $gBitSystem->get_cache($_REQUEST["cache_id"]);
$ggcacheurl = 'http://google.com/search?q=cache:'.urlencode(strstr($info['url'],'http://'));

// test if url ends with .txt : formatting for text
if (substr($info["url"], -4, 4) == ".txt") {
	$info["data"] = "<pre>" . $info["data"] . "</pre>";
}

$gBitSmarty->assign('ggcacheurl', $ggcacheurl);
$gBitSmarty->assign('info', $info);
$gBitSystem->display( 'bitpackage:kernel/view_cache.tpl', null, array( 'display_mode' => 'display' ));