Esempio n. 1
0
function show_welcome($nick)
{
    $location = get_location($nick);
    if ($location === False) {
        return;
    }
    $time = get_time($location);
    if ($time == "") {
        return;
    }
    $arr = convert_google_location_time($time);
    $data = process_weather($location, $nick, True);
    if ($data === False) {
        return;
    }
    if ($data["tempC"] === False or $data["tempF"] === False) {
        return;
    }
    privmsg("welcome {$nick}: " . trim($arr["location"]) . ", " . $data["tempC"] . "/" . $data["tempF"] . ", " . date("g:i a", $arr["timestamp"]) . " " . $arr["timezone"] . ", " . date("l, j F Y", $arr["timestamp"]));
}
Esempio n. 2
0
     break;
 case "~weather-add":
     set_location_alias($alias, $trailing);
     break;
 case "~weather":
     if (strtolower($trailing) == "south pole") {
         require_once "wget_lib.php";
         $result = quick_wget("http://www.timeanddate.com/weather/antarctica/south-pole <div class=h1>Now</div> <> </div");
         if ($trailing == False or strlen($result) > 300) {
             privmsg("error");
             return;
         }
         privmsg("south pole temp: {$result}");
         return;
     }
     $data = process_weather($trailing, $nick);
     if ($data !== False) {
         privmsg($data);
     } else {
         privmsg("syntax: ~weather <location>");
     }
     break;
 case "~weather-old":
     $data = process_weather_old($trailing, $nick);
     if (is_array($data) == False) {
         switch ($data) {
             case 1:
                 privmsg("weather for \"{$trailing}\" not found. check spelling or try another nearby location.");
                 break;
             case 2:
                 privmsg("all stations matching \"{$trailing}\" are either inactive or have no data. check spelling or try another nearby location.");