<?php

/**
 * Copyright (C) 2010-2013 Visman (mio.visman@yandex.ru)
 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 */

define('PUN_QUIET_VISIT', 1);

define('PUN_ROOT', dirname(__FILE__).'/');
require PUN_ROOT.'include/common.php';

if ($pun_user['g_read_board'] == '0')
	message($lang_common['No view'], false, '403 Forbidden');

$url = $container->get('Request')->getStr('u');

if (empty($url) || $pun_user['is_bot'])
	message($lang_common['Bad request'], false, '404 Not Found');

if (file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/re.php'))
	require PUN_ROOT.'lang/'.$pun_user['language'].'/re.php';
else
	require PUN_ROOT.'lang/English/re.php';

$url = str_replace('&amp;', '&', preg_replace(array('%(https?|ftp)___%i', '%([\r\n])|(\%0[ad])|(;\s*data\s*:)%i'), array('$1://', ''), $url));

$page_js['c']['re'] = 'function fluxrdr() {if(history.length<2){window.close()}else{history.go(-1)}return false}';

$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_re['Redirect']);
define('PUN_ACTIVE_PAGE', 'redirect');
require PUN_ROOT.'header.php';

$tpl_main = str_replace('<div id="punre"', '<div id="punmisc"', $tpl_main);
$tpl_main = str_replace('NOINDEX, FOLLOW', 'NOINDEX, NOFOLLOW', $tpl_main);

?>
<div id="rules" class="block">
	<div class="hd"><h2><span><?php echo $lang_re['Redirect'] ?></span></h2></div>
	<div class="box">
		<div id="rules-block" class="inbox">
			<div class="usercontent"><?php echo $lang_re['Text1'].'<strong><a href="'.pun_htmlspecialchars($url).'" rel="nofollow">'.pun_htmlspecialchars($url).'</a></strong><br />'.$lang_re['Text2'] ?></div>
		</div>
	</div>
</div>
<?php

require PUN_ROOT.'footer.php';
