/search/viewcache.php
PHP | 147 lines | 96 code | 35 blank | 16 comment | 11 complexity | 9fb3e5ad1a24cfc905093a5911fcc86d MD5 | raw file
Possible License(s): BSD-3-Clause
- <?php
-
- /******************************************************************************
- * iSearch2 - website search engine *
- * *
- * Visit the iSearch homepage at http://www.iSearchTheNet.com/isearch *
- * *
- * Copyright (C) 2002-2007 Z-Host. All rights reserved. *
- * *
- ******************************************************************************/
-
- // PHPLOCKITOPT NOENCODE
-
- $isearch_path = dirname(__FILE__);
- define('IN_ISEARCH', true);
-
- require_once "$isearch_path/inc/core.inc.php";
-
- /* Open the search component (read only) */
- isearch_open(True);
-
- $isearch_pageTitle = $isearch_lang['viewcache_title'];
-
- /* Display the frame set */
-
- echo <<<EOF
-
- EOF;
-
- $frame = isset($_REQUEST['frame']) ? $_REQUEST['frame'] : '';
- $url = isset($_REQUEST['url']) ? $_REQUEST['url'] : '';
-
- if ($frame == '')
- {
- /* Display the frame set */
-
- echo '
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-
- <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $isearch_languageCode . '">
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset='.$isearch_config['char_set'].'" />
- <title>' . $isearch_pageTitle . '</title>
- <meta name="author" content="Ian Willis" />
- <meta name="copyright" content="Copyright Z-Host. All rights reserved." />
- <meta name="robots" content="noindex,nofollow" />
- <link rel="stylesheet" href="'.$isearch_config['base_url'].'/style/'.$isearch_config['style_name'].'.css" type="text/css" />
- </head>
-
- <frameset cols="100%" rows="100,*" >
- <frame frameborder="0" src="viewcache.php?frame=top&url=' . $url . '" />
- <frame frameborder="0" src="viewcache.php?frame=bottom&url=' . $url . '" />
- </frameset>
-
- <noframes>
- <body>
- ';
-
- include "$isearch_path/inc/header.inc.php";
-
- echo <<<EOF
-
- <h3>Sorry, you are unable to view cache contents - your browser does not support frames.</h3>
-
- EOF;
-
- include "$isearch_path/inc/footer.inc.php";
-
- echo <<<EOF
-
- </body>
- </noframes>
-
- </html>
-
- EOF;
- }
- else if ($frame == 'top')
- {
- /* Display the top frame (message saying that this page is cached) */
- echo '
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
- <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $isearch_languageCode . '">
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset='.$isearch_config['char_set'].'" />
- <title>' . $isearch_pageTitle . '</title>
- <meta name="author" content="Ian Willis" />
- <meta name="copyright" content="Copyright Z-Host. All rights reserved." />
- <meta name="robots" content="noindex,nofollow" />
- <link rel="stylesheet" href="'.$isearch_config['base_url'].'/style/'.$isearch_config['style_name'].'.css" type="text/css" />
- </head>
-
- <body>
-
- ';
-
- include "$isearch_path/inc/header.inc.php";
-
- echo <<<EOF
-
- <h1 class="isearch">$isearch_pageTitle</h1>
-
- EOF;
-
- $isearch_cachedpage = preg_replace("/(%u)/", "<a href=\"$url\">$url</a>", $isearch_lang['cachedpage']);
-
- echo '
- <h2 class="isearch-cachedpage">' . $isearch_cachedpage . '</h2>
- ';
- include "$isearch_path/inc/footer.inc.php";
-
- echo <<<EOF
-
- </body>
-
- </html>
-
- EOF;
- }
- else if ($frame == 'bottom')
- {
- /* Display the cached page */
-
- $result = mysql_query ("SELECT cache, base FROM $isearch_table_urls WHERE url='$url'", $isearch_db);
- if (($result) && ($resultItem = mysql_fetch_object($result)))
- {
- $cache = $resultItem->cache;
- if (!eregi("<head>.*<base .*></head>", $cache))
- {
- /* Insert a base tag into the head of this cached page */
- $base = $resultItem->base;
- $cache = eregi_replace("</head>", "<base href=\"$base\" />\n</head>", $cache);
- }
- echo $cache;
- }
- }
-
- /* Close the search component */
- isearch_close();
-
-
- ?>