# ZIP code OK? if ($itemCount != 0) { # Prepare static file $handle = @fopen($file_name, 'w'); if ($handle) { for ($y = 0; $y < $itemCount; $y++) { # Format data fputs($handle, '[' . $y . "]\n"); $allItems[$y]['title'] = filter_format($allItems[$y]['title']); $allItems[$y]['title'] = trim_title($allItems[$y]['title'], '', ' :: '); if ($y == 0) { $main = $allItems[$y]['title']; $allItems[$y]['title'] = 'Currently'; } fputs($handle, 'title=' . $allItems[$y]['title'] . "\n"); $description = filter_format($allItems[$y]['description']); if (trim($description, ' ') == '') { $description = Aastra_get_label('No data provided', $language); } $allItems[$y]['description'] = $description . ' ' . Aastra_get_label('RSS feed provided by rssweather.com and brought to you by Aastra Telecom.', $language); fputs($handle, 'description=' . $allItems[$y]['description'] . "\n"); fputs($handle, 'uri=' . $XML_SERVER . '&zip=' . $zip . '&index=' . ($y + 1) . "\n"); } fputs($handle, "[99]\n"); fputs($handle, 'title=' . $main . "\n"); fclose($handle); } else { Aastra_debug('Can not open ' . $file_name . ' in write mode'); $object = new AastraIPPhoneTextScreen(); $object->setTitle(Aastra_get_label('Information not available', $language)); $object->setText(Aastra_get_label('The information you are looking for is not available at this time. Try again later.', $language));
$found = 1; $nb_answers = preg_split('/var /', $line); $nb_answers[1] = '$' . $nb_answers[1]; eval($nb_answers[1]); } } fclose($fp); # Prepare result screen $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Ask Google', $language)); if ($resultSize == 0) { $object->setText(Aastra_get_label('Information not available at this time. Please try again later.', $language)); } else { $message = $message1 . $message2 . $message3 . $message4 . $message5 . $message6 . $message7 . $message8; $message = filter_format($message, $resultSize); $object->setText($message); } } else { # Prepare result screen $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Ask Google', $language)); $object->setText(Aastra_get_label('Information not available at this time. Please try again later.', $language)); } # Display TextScreen if ($nb_softkeys > 0) { if ($nb_softkeys < 7) { $object->addSoftkey('4', Aastra_get_label('Back', $language), $XML_SERVER); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else {
$http = 'http://timeanddate.com/worldclock/city.html?n=' . $city; $handle = @fopen($http, 'r'); $found = 0; $title = $array[$key]['name']; if ($handle) { while ($line = fgets($handle, 1000) and $found != 2) { switch ($found) { case '0': $value = trim($previous_line, '\\n') . trim($line, '\\n'); if (stristr($value, 'Current Time')) { $found = 1; } break; case '1': $value .= $line; $current = filter_format($value); $found = 2; break; } $previous_line = $line; } fclose($handle); if ($found == 2) { if (Aastra_is_formattedtextscreen_supported()) { sscanf($current, '%s %s %d, %d at %s %[^$]s', $day, $month, $day2, $year, $time, $AMPM); require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); $size = Aastra_size_formattedtextscreen(); if ($size > 5) { $font = 'double';
$object->addSoftkey($nb, Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } $output = $object->output(); exit; } # At least one item if ($itemCount > 0) { # Prepare static file $handle = @fopen($file_name, 'w'); if ($handle) { for ($y = 0; $y < $itemCount; $y++) { # Format data fputs($handle, '[' . $y . ']' . "\n"); $allItems[$y]['title'] = filter_format($allItems[$y]['title'], $pattern, $before_s, $before_r, $after_s, $after_r); $allItems[$y]['title'] = trim_title($allItems[$y]['title'], $trim_title_before, $trim_title_after); $description = filter_format($allItems[$y]['description'], $pattern, $before_s, $before_r, $after_s, $after_r); if (trim($description, ' ') == '') { $description = $nodescription; } $allItems[$y]['description'] = $description . $copyright; switch ($encoding) { case 'utf8': fputs($handle, 'title=' . utf8_decode(ereg_replace("’", "'", $allItems[$y]['title'])) . "\n"); fputs($handle, 'description=' . utf8_decode(ereg_replace("’", "'", $allItems[$y]['description'])) . "\n"); break; default: fputs($handle, 'title=' . $allItems[$y]['title'] . "\n"); fputs($handle, 'description=' . $allItems[$y]['description'] . "\n"); break; } fputs($handle, 'uri=' . $XML_SERVER . '&index=' . ($index + 1) . '&rank=' . ($y + 1) . "\n");