diff --git a/motd.php b/motd.php index d966927..749d6c1 100644 --- a/motd.php +++ b/motd.php @@ -1,54 +1,92 @@ 'bulgarian', + 'ca' => 'catalan', + 'da' => 'danish', + 'de' => 'ngerman', + 'en-ca' => 'canadian-english-insane', + 'en-gb' => 'british-english-insane', + 'en-us' => 'american-english-insane', + 'eo' => 'esperanto', + 'es' => 'spanish', + 'fi' => 'finnish', + 'fo' => 'faroese', + 'fr' => 'french', + 'gl' => 'galician-minimos', + 'it' => 'italian', + 'nb' => 'bokmaal', + 'nl' => 'dutch', + 'nn' => 'nynorsk', + 'pt-br' => 'brazilian', + 'pt-pt' => 'portuguese', + // 'pl' => 'polish', // too big, crashes PHP + 'sv' => 'swedish', + 'uk' => 'ukrainian', + ]; + + $list = strtolower($_GET['list']); + $list_file = $dicts[$list]; + + $today = floor(date('U') / 24 / 60 / 60) * 24 * 60 * 60; + srand($today + crc32($list_file)); + + $motd = motd(!empty($list_file) ? "/usr/share/dict/$list_file" : '../words.txt', !in_array($list, ['fi', 'nb', 'nn', 'sv'])); + // Plaintext if(isset($_GET['raw'])) { - header("Content-Type: text/plain"); - die(motd("../words.txt")); + header('Content-Type: text/plain'); + die($motd); } - $motd = motd("../words.txt"); + $motd = htmlspecialchars($motd); if(isset($_GET['rss'])) { - header("Content-Type: application/rss+xml"); + header('Content-Type: application/rss+xml'); ?> MOTD | ピケ.コム - http://xn--rck9c.xn--tckwe/motd.php + http://xn--rck9c.xn--tckwe/motd.php?list= A random message each day - en-US + <?php echo $motd; ?> - http://xn--rck9c.xn--tckwe/motd.php + http://xn--rck9c.xn--tckwe/motd.php?list= Pk11 @@ -58,22 +96,53 @@ - + - <?php echo htmlspecialchars($motd); ?> + <?php echo $motd; ?> - + -

">

-

+

">

+ +