<?php

//By FlySelf

defined('_IN_JOHNCMS') or die('Error: restricted access');
$array = array('su', 'ru', 'oth');
if(!in_array($mod, $array))
	$mod = 'oth';
$mod_two = '';
$letter = isset($_GET['letter']) ? trim($_GET['letter']) : '';
if($letter)
	$mod_two = '&letter=' . $letter;
$worldregion = isset($_GET['worldregion']) ? intval($_GET['worldregion']) : '';
$country = isset($_GET['country']) ? intval($_GET['country']) : 0;
if($worldregion && $country)
	$mod_two .= '&worldregion=' . $worldregion . '&country=' . $country;
$contents = contents('http://wap.weather.mail.ru/citylist.xhtml?' . $mod . '=' . $id . $mod_two);
$contents = preg_replace('/<\!DOCTYPE(.*?)<\!-- City \/ Country List BEGIN -->/si', '<div class="phdr"><b>Выбор города</b></div>', $contents);
$contents = preg_replace('/<\!-- City \/ Country List END -->(.*?)<\/html>/si', '<div class="phdr"><a href="index.html">Главная</a></div>', $contents);
$contents = preg_replace('/\/index\.xhtml\?city=([0-9]+)/si', 'index_\1.html', $contents);
$contents = preg_replace('/\/citylist\.xhtml\?(oth|su|ru)=([0-9]+)&amp;/si', 'citylist_\1_\2.html?', $contents);
$contents = strtr($contents, array('<br>' => '<br />', '<h2>' => '<div class="phdr"><b>', '</h2>' => '</b></div>', '<div>' => '<div class="menu">'));
echo $contents;

?>