<?php

//By FlySelf

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

$mod = isset($_GET['mod']) ? intval($_GET['mod']) : 3;
if($mod != 3 && $mod != 10)
	$mod = 3;
$contents = contents('http://wap.weather.mail.ru/forecast' . $mod . '.xhtml?city=' . $id . '&page=' . $start);
$contents = preg_replace('/<\!DOCTYPE(.*?)<div class=\"inner\">/si', '<div>', $contents);
if($mod == 3)
	$contents = preg_replace('/<p>&#032;<\/p>(.*?)<\/html>/si', '', $contents);
else {
	$contents = preg_replace('/<div id=\"footer\" class=\"white_a\">(.*?)<\/html>/si', '', $contents);
	$contents = strtr($contents, array('<p>&#032;</p>' => '', '&page' => '?start'));
}
$contents = preg_replace('/\/([a-z0-9]+)\.xhtml\?city=([0-9]+)/si', '\1_\2.html', $contents);
$contents = preg_replace('/<h1>(.*?)<\/h1>/si', '<div class="phdr"><b>\1</b></div>', $contents);
$contents = preg_replace('/<h3>(.*?)<\/h3>/si', '<div class="bmenu"><b>\1</b></div>', $contents);
$contents = strtr($contents, array('<div class="forecast">' => '<div class="list1">', 'forecasttext' => 'list2', 'inner' => 'phdr', '/img/' => 'http://wap.weather.mail.ru/img/', 'spec' => 'green', '<span>' => '<span class="red">'));

echo $contents;

?>