Diese Kategorie in anderen Sprachen:" if ROOT_CAT is World/Deutsch/
define('OTHER_LANG_STR', '
This category in other languages:');
// Replace "Open Directory Categories" in search results to (all search
// results have the English "Open Directory Categories" phrase, even in other
// languages):
define('SEARCH_CATS_REPLACEMENT', 'Web Directory Categories');
// Replace "Open Directory Sites" in search results to:
define('SEARCH_SITES_REPLACEMENT', 'Web Directory Sites');
// don't have to change anything below
define('TOP_CAT_NAME', 'Top/');
define('STAR_IMAGE', 'images/star.png');
define('ODP_HOST', 'dmoz.org');
define('ODP_DOMAIN', 'http://dmoz.org/');
define('SEARCH_HOST', 'search.dmoz.org');
define('SEARCH_PATH', 'cgi-bin/search?search=');
define('BROWSE_START', '');
define('BROWSE_END','
Search: ');
define('SEARCH_END', '
' . TOP_BREADCRUMB_NAME . ' » ';
for ($i = 0; $i < $cnt - 1; $i++)
{
$t .= urlencode($cats[$i]) . '/';
// replace underscores with spaces in link text
$breadcrumb .= '' . str_replace('_', ' ', $cats[$i]) . ' » ';
}
// the current category can't be clickable
$breadcrumb .= str_replace('_', ' ', $cats[$i]) . '';
}
// change cat to dmoz url
if (substr($cat, 0, strlen(TOP_CAT_NAME)) === TOP_CAT_NAME)
{
$cat = substr($cat, strlen(TOP_CAT_NAME));
}
else
{
$cat = ROOT_CAT . $cat;
}
// limit characters so it doesn't overload the server
$search = (isset($_GET['search'])) ? substr($_GET['search'], 0, 64) : '';
if (get_magic_quotes_gpc())
{
$cat = htmlspecialchars(stripslashes($cat));
$search = htmlspecialchars(stripslashes($search));
}
else
{
$cat = htmlspecialchars($cat);
$search = htmlspecialchars($search);
}
// read a page from dmoz
function readURL($host, $url, &$str)
{
$fp = fsockopen($host, 80, $errno, $errstr, 10);
if ($fp === false)
{
//echo "$errstr ($errno) \n";
return '';
}
else
{
// no space after "/"
$out = 'GET /' . $url . ' HTTP/1.1' . "\r\n";
$out .= 'Host: ' . $host . "\r\n";
$out .= 'Connection: Close' . "\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp))
{
$str .= fgets($fp, 8192);
}
fclose($fp);
$section = explode("\r\n\r\n", $str, 2);
$str = $section[1];
}
}
function readTpl($tpl)
{
$fp = fopen('templates/' . $tpl . '.tpl', 'r');
$content = fread($fp, filesize('templates/' . $tpl . '.tpl'));
fclose($fp);
return $content;
}
?>
';
$cachePath = CACHE_DIR . strtolower(str_replace('/', '!', substr($cat, 0, -1))) . '.txt';
// if cache file exists, read the cache file and display it
if (file_exists($cachePath) && ENABLE_CACHE)
{
$fp = fopen($cachePath, 'r');
echo fread($fp, filesize($cachePath));
fclose($fp);
}
else // otherwise, read category from dmoz and replace dmoz data
{
readURL(ODP_HOST, $cat, $data);
// block inappropriate categories
if (strtolower(substr($cat, 0, 5)) === 'adult')
{
$data = '';
}
// if successfully read category
if ($data !== '' && substr($data, 0, 33) !== 'Page Has Moved')
{
// don't skip A-Z links if there are any
$isAToZ = strpos($data, '[