<?php

//By FlySelf

defined('_IN_JOHNCMS') or die('Error: restricted access');

$contents = contents('http://wap.weather.mail.ru/citychange.xhtml?city=' . $id);
$contents = preg_replace('/<\!DOCTYPE(.*?)<div class=\"inner\">/si', '<div>', $contents);
$contents = preg_replace('/\/([a-z0-9]+)\.xhtml\?city=([0-9]+)/si', '\1_\2.html', $contents);
$contents = preg_replace('/<a href=\"near_([0-9]+)\.html\">Ближайшие к выбранному<\/a>(.*?)<\/div>(.*?)<\/html>/si', '</div></div><div class="list2"><a href="near_\1.html">Ближайшие к выбранному</a>\2</div><div class="phdr"><a href="index.html">Главная</a></div>', $contents);
$contents = preg_replace('/\/citylist\.xhtml\?(oth|su|ru)=([0-9]+)\">/si', 'citylist_\1_\2.html">', $contents);
$contents = strtr($contents, array('<h1>' => '<div class="phdr"><b>', '</h1>' => '</b></div><div class="list1">', '<h2>' => '</div><div class="phdr"><b>', '</h2>' => '</b></div><div class="list1">', '/search.xhtml' => 'search.html', '<img src="http://img.mail.ru/0.gif" width="5" height="1" alt="" />' => '', '<input type="hidden" name="cp" value="utf-8" />' => '', '<div class="inner"><br />' => ''));
echo $contents;

?>