<?php 

$city = $tools->keyGlobals('city', 0);
$full = $tools->keyGlobals('full', 0);
$city = mysql_fetch_assoc(mysql_query("SELECT * FROM city WHERE city_id = " . (int) $city));

if (!$city) {
    if (isset($user)) {
        $city_search = $user['ank_city'];
        $city = mysql_fetch_assoc(mysql_query("SELECT * FROM city WHERE name = '$city_search'"));
    }
    
    if (!$city) {
        $city = mysql_fetch_assoc(mysql_query("SELECT * FROM city WHERE name = 'Москва'"));
    }
}

// Класс Yandex API
require 'classes/class.Yandex.php';

$set['title'] = $city['name'];
require H.'sys/inc/thead.php';
title();
aut();

?>
  <div class='foot'> <a href='/'><img src='img/in.png' alt='*' class='icon'/> Назад </a> / 
  <b><?= $city['name']?></b>
</div>
  <div class="gmenu"><center>
    <b><?= $city['name']?></b> <a href="/user/settings/?func=location&amp;r=city"><img src="img/gear.png" alt="*" class="icon"/> <?= __('Изменить')?></a>
  </center></div>
<?
$weather = new Yandex();

if ($city['yandex_id'] == 0) {
    $city = mysql_fetch_assoc(mysql_query("SELECT * FROM city 
                                           WHERE region_id = '$city[region_id]' AND yandex_id != '0' 
                                           LIMIT 1"));
}

$weather->city = $city['yandex_id'];
$weather->count = 2;

$data = $weather->get_weather_day();
?>
<div class="gmenu">
  <div class="nav1">
    Погода в городе <a style="float:right;" href="?func=weather&amp;city=<?= $city['city_id']?>">Прогноз &rsaquo;</a>
  </div>
  
  <div class="">
    <? 
    for($i = 0; count($data['day']) > $i; $i++) {
        unset($data['day'][1]['weather'][0], $data['day'][1]['weather'][2]);
        
        foreach($data['day'][$i]['weather'] AS $key => $post) { ?>
          <div class="nav1" style="padding-top: 4px; padding-bottom: 8px;">
            <?= $post['name_of_day']?> <?= ($post['time_of_day'] ? $post['time_of_day'] : vremja())?><br />
            <img src="http://yandex.st/weather/1.1.78/i/icons/48x48/<?= $post['image']?>.png" width="48" height="48" /> 
            <b><?= $post['temperature']?>&ordm;C</b>
          </div>
        <? 
        }          
    }
    ?>
  </div>
</div>
<?