File: /var/www/samok164/data/www2/culture-style.ru/rzgn/razgon2006vnutri.php
<?php #r4 v2.0rc4
if (!isset($r4_cfg_root)) $r4_cfg_root = dirname(__FILE__);
if (!empty($r4_cfg_root) && $r4_cfg_root != '/') $r4_cfg_root .= '/';
if (!empty($_GET['r4getVersion']))
{
exit (file_get_contents("{$r4_cfg_root}r4_version"));
}
include_once("{$r4_cfg_root}getHash.php");
include_once("{$r4_cfg_root}r4.cfg");
$r4_error_reporting = error_reporting($r4_cfg_error_reporting);
$r4_ua = empty ($_SERVER['HTTP_USER_AGENT']) ? '' : $_SERVER['HTTP_USER_AGENT'];
$r4_ruri = empty ($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'];
$r4_h = empty ($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST'];
if (!empty ($r4_cfg_strip_from_uri))
{
preg_replace($r4_cfg_strip_from_uri, '', $r4_ruri);
}
$r4_yandex_log_file = "{$r4_cfg_root}seenbyyandex.rzg";
$r4_prepared_uri = preg_replace(Array ('#[ \+,/\.]#', '#\?#'), Array ('_', '__'), $r4_ruri);
$r4_prepared_uri2 = getHash("http://{$r4_h}{$r4_ruri}", $r4_cfg_root);
$r4_links_file = "{$r4_cfg_root}$r4_prepared_uri.rzg";
$r4_links_file2 = "{$r4_cfg_root}$r4_prepared_uri2.rzg";
if (!empty($_GET['r4showhash']))
{
exit ($r4_prepared_uri2);
}
if (!isset ($r4_slot)) $r4_slot = (isset($_GET['startfrom']))?$_GET['startfrom']:0;
if (!isset ($r4_links)) $r4_links = null;
if (!isset ($r4_yandex_logged)) $r4_yandex_logged = false;
$link = '';
if (false !== strpos($r4_ruri, $r4_cfg_testpattern))
{
$link = "<a href=\"#\" class=\"[[R4_2_PLACEHOLDER]]\">{$r4_cfg_testtext}</a>{$r4_cfg_separator}";
if ($r4_cfg_link_encoding != 'CP1251') $link = iconv('CP1251', $r4_cfg_link_encoding, $link);
}
else
{
if (!$r4_links && (file_exists($r4_links_file) || file_exists($r4_links_file2)))
{
$r4_links = Array ();
if ( file_exists($r4_links_file) && !file_exists($r4_links_file2))
{
rename($r4_links_file, $r4_links_file2);
}
$r4_links_file_contents = file($r4_links_file2);
$r4_info_str = trim(array_shift($r4_links_file_contents));
$r4_info_fields = explode('|', $r4_info_str);
$r4_cell_config = Array ();
if (isset($r4_info_fields[1])) $r4_cell_config = unserialize($r4_info_fields[1]);
foreach ($r4_links_file_contents as $r4_line)
{
$r4_line = trim($r4_line);
if (!empty($r4_line))
{
$r4_links[] = $r4_line;
}
}
}
$r4_cell_config;
$r4_lindex = $r4_slot;
if (!empty($r4_cell_config)) $r4_lindex = array_search($r4_slot, $r4_cell_config);
if ($r4_lindex !== false && !empty($r4_links[$r4_lindex]))
{
$link = $r4_links[$r4_lindex] . $r4_cfg_separator;
if ($r4_cfg_link_encoding != 'CP1251') $link = iconv('CP1251', $r4_cfg_link_encoding, $link);
}
}
if (!file_exists($r4_yandex_log_file))
{
touch($r4_yandex_log_file);
}
$r4_is_yandex = preg_match('~Yandex(Bot|Direct)/3\.0;\s+\+http~isx', $r4_ua);
if ($r4_is_yandex && !$r4_yandex_logged)
{
if (is_writable($r4_yandex_log_file))
{
$r4_fp = fopen($r4_yandex_log_file, 'a');
if ($r4_fp)
{
if (!fwrite($r4_fp, date('Y-m-d H:i:s')."\t$r4_ruri\n"))
{
error_log(date("F j, Y, g:i a")." R4: File write failed!\n", 3, "{$r4_cfg_root}error.log");
}
fclose($r4_fp);
$r4_yandex_logged = true;
}
}
}
@include_once($r4_cfg_root . "addongoogle.php");
$r4_slot++;
echo $link;
error_reporting($r4_error_reporting);
?>