static function cmd_rej($name, $args) { if (empty($args)) { GGapi::putText('Nie podano numeru rejestracyjnego!' . "\n\n"); GGapi::putRichText('Przykłady', FALSE, FALSE, TRUE); GGapi::putRichText("\n" . 'rej KRA' . "\n" . 'rej WW 1111X'); return FALSE; } include './data/rejestracje/rej.php'; $dane = rejestracje_data::find($args); GGapi::putRichText(array_shift($dane), TRUE); GGapi::putRichText("\n" . 'Typ: ' . implode("\n", $dane)); }
static function cmd_kurs($nazwa, $argument) { $argument = funcs::utfToAscii(trim($argument)); if (isset(self::$name2iso[$argument])) { $argument = self::$name2iso[$argument]; } else { $argument = strtoupper($argument); } $waluty_A = unserialize(file_get_contents('./data/kurs/A_kursy.txt')); if (empty($argument)) { $waluty_C = unserialize(file_get_contents('./data/kurs/C_kursy.txt')); $txt = 'Kursy średnie walut obcych z dnia ' . $waluty_A['i_n_f_o']['data'] . ' (tabela NBP nr ' . $waluty_A['i_n_f_o']['tabela'] . ') oraz kursy kupna i sprzedaży z dnia ' . $waluty_C['i_n_f_o']['data'] . ' (tabela NBP nr ' . $waluty_C['i_n_f_o']['tabela'] . ')' . "\n"; foreach ($waluty_C as $kod => $dane) { if ($kod == 'i_n_f_o') { continue; } $txt .= "\n" . $dane['ilosc'] . ' ' . $kod . ' => ' . $waluty_A[$kod]['kurs'] . ' PLN'; $txt .= ' (kupno: ' . $dane['kupno'] . ' PLN, sprzedaż: ' . $dane['sprzedaz'] . ' PLN)'; } GGapi::putText($txt); return TRUE; } if (isset($waluty_A[$argument])) { $txt = 'Kursy średnie walut obcych z dnia ' . $waluty_A['i_n_f_o']['data'] . ' (tabela NBP nr ' . $waluty_A['i_n_f_o']['tabela'] . ')'; $waluty_C = unserialize(file_get_contents('./data/kurs/C_kursy.txt')); if (isset($waluty_C[$argument])) { $txt .= ' oraz kursy kupna i sprzedaży z dnia ' . $waluty_C['i_n_f_o']['data'] . ' (tabela NBP nr ' . $waluty_C['i_n_f_o']['tabela'] . ')'; } $txt .= "\n\n" . $waluty_A[$argument]['ilosc'] . ' ' . $argument . ' => ' . $waluty_A[$argument]['kurs'] . ' PLN'; if (isset($waluty_C[$argument])) { $txt .= ' (kupno: ' . $waluty_C[$argument]['kupno'] . ' PLN, sprzedaż: ' . $waluty_C[$argument]['sprzedaz'] . ' PLN)'; } GGapi::putText($txt); return TRUE; } else { $waluty_B = unserialize(file_get_contents('./data/kurs/B_kursy.txt')); if (!isset($waluty_B[$argument])) { GGapi::putText('Nie znaleziono żądanej waluty. Sprawdź, czy kod waluty jest zgodny z ISO 4217.' . "\n\n"); GGapi::putRichText('Przykłady', FALSE, FALSE, TRUE); GGapi::putRichText("\n" . 'kurs USD' . "\n" . 'kurs EUR'); return FALSE; } GGapi::putText('Kursy średnie walut obcych z dnia ' . $waluty_B['i_n_f_o']['data'] . ' (tabela NBP nr ' . $waluty_B['i_n_f_o']['tabela'] . ')' . "\n\n" . $waluty_B[$argument]['ilosc'] . ' ' . $argument . ' => ' . $waluty_B[$argument]['kurs'] . ' PLN'); return TRUE; } }
static function cmd_humor($name, $args) { if (file_exists('./data/humor/humor.txt')) { GGapi::putText(file_get_contents('./data/humor/humor.txt')); } elseif (file_exists('./data/humor/humor.jpg')) { GGapi::putImage('./data/humor/humor.jpg'); } else { $last = './data/humor/archiwum/' . date('d.m.Y', strtotime('-1 day')); if (file_exists($last . '.txt')) { GGapi::putText(file_get_contents($last . '.txt')); } elseif (file_exists($last . '.jpg')) { GGapi::putImage($last . '.jpg'); } else { GGapi::putText('Dziś nie udało się pobrać danych - przepraszamy.'); } } }
static function cmd_tv($name, $args) { self::$file = './data/tv/xmltv-utf.xml'; self::$aliases = './data/tv/aliases'; $time = self::parse_date($args); if (empty($args)) { $args = $name; } $tv = self::aliases($args); if (!$tv) { GGapi::putText('Nieznana stacja telewizyjna. Spróbuj:' . "\n" . 'tv TVP 1' . "\n" . 'tv Discovery' . "\n\n" . 'lub wpisz '); GGapi::putRichText('lista', TRUE); GGapi::putRichText(' by uzyskać listę dostępnych stacji telewizyjnych'); return; } GGapi::putRichText('Program stacji ' . $tv . "\n", TRUE, FALSE, TRUE); self::schedule($tv, $time); }
static function cmd_bash($name, $arg) { $data = unserialize(file_get_contents('./data/bash/index.txt')); $arg = (int) trim($arg); if (!$arg || !isset($data[$arg])) { $arg = array_rand($data); } $data = $data[$arg]; $fp = fopen('./data/bash/text.txt', 'r'); fseek($fp, $data); $data = ''; $line = ''; while (!feof($fp) && trim($line) != '%') { $data .= $line; $line = fgets($fp); } fclose($fp); GGapi::putRichText('Cytat #' . $arg, TRUE); GGapi::putText("\n" . trim($data)); }
static function cmd_setex($name, $arg) { if (!$arg) { GGapi::putText('Podaj pełny adres kanału (z http://)!' . "\n\n"); GGapi::putRichText('Przykład:', FALSE, FALSE, TRUE); GGapi::putRichText("\n" . 'kanal2 http://wiadomosci.onet.pl/2,kategoria.rss'); } else { $ret = self::testurl($arg); if (is_object($ret)) { database::add($_GET['from'], 'rssex', 'kanal', $arg[1]); GGapi::putText('Kanał ' . $arg . ' został ustawiony jako domyślny. Teraz zamiast:' . "\n" . 'rss ' . $arg . "\n" . 'możesz wpisać samo' . "\n" . 'rss'); } elseif (is_array($ret)) { GGapi::putText('Nie udało się pobrać wybranego kanału RSS. Błąd: ' . $ret[1]); } else { GGapi::putText('Wystąpił nieznany błąd przy pobieraniu danych. Przepraszamy.'); } } }