<?php

//By FlySelf

defined('_IN_JOHNCMS') or die('Error: restricted access');
$name = isset($_GET['name']) ? urlencode(trim($_GET['name'])) : '';
$contents = contents('http://wap.weather.mail.ru/search.xhtml?name=' . $name . '&cp=utf-8');
$contents = preg_replace('/<\!DOCTYPE(.*?)<h1>/si', '<h1>', $contents);
$contents = preg_replace('/<h2>Выбор города<\/h2>(.*?)<\/html>/si', '</div><div class="phdr"><a href="index.html">Главная</a></div>', $contents);
$contents = preg_replace('/\/([a-z0-9]+)\.xhtml\?city=([0-9]+)/si', '\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" />' => '', '<table>' => '</div><div class="list2">', '</table>' => ''));
echo $contents;

?>