1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11require_once('tiki-setup.php');
12
13$access->check_feature('cachepages', '', 'textarea');
14
15if (isset($_REQUEST['url'])) {
16	$id = $tikilib->get_cache_id($_REQUEST['url']);
17	if (! $id) {
18		$smarty->assign('msg', tra("No cache information available"));
19		$smarty->display("error.tpl");
20		die;
21	}
22	$_REQUEST["cacheId"] = $id;
23}
24if (! isset($_REQUEST["cacheId"])) {
25	$smarty->assign('msg', tra("No page indicated"));
26	$smarty->display("error.tpl");
27	die;
28}
29// Get a list of last changes to the Wiki database
30$info = $tikilib->get_cache($_REQUEST["cacheId"]);
31$ggcacheurl = 'http://google.com/search?q=cache:' . urlencode(strstr($info['url'], 'http://'));
32// test if url ends with .txt : formatting for text
33if (substr($info["url"], -4, 4) == ".txt") {
34	$info["data"] = "<pre>" . $info["data"] . "</pre>";
35}
36// disallow robots to index page:
37$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
38$smarty->assign('ggcacheurl', $ggcacheurl);
39$smarty->assign_by_ref('info', $info);
40$smarty->assign('mid', 'tiki-view_cache.tpl');
41$smarty->display('tiki-view_cache.tpl');
42