|
|
@ -1,54 +1,92 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
$today = floor(date('U') / 24 / 60 / 60) * 24 * 60 * 60;
|
|
|
|
function motd($wordsPath, $utf8) {
|
|
|
|
srand($today);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function motd($wordsPath) {
|
|
|
|
|
|
|
|
$out = [];
|
|
|
|
$out = [];
|
|
|
|
$words = explode("\n", file_get_contents($wordsPath));
|
|
|
|
$file = file_get_contents($wordsPath);
|
|
|
|
|
|
|
|
if(!$utf8)
|
|
|
|
|
|
|
|
$file = utf8_encode($file);
|
|
|
|
|
|
|
|
$words = explode("\n", $file);
|
|
|
|
$count = rand(1, 10);
|
|
|
|
$count = rand(1, 10);
|
|
|
|
for($i = 0; $i < $count; $i++) {
|
|
|
|
for($i = 0; $i < $count; $i++) {
|
|
|
|
$word = $words[array_rand($words)];
|
|
|
|
$word = $words[array_rand($words)];
|
|
|
|
|
|
|
|
|
|
|
|
if(rand(0, 4) == 0) { // 1 in 5 chance
|
|
|
|
if(rand(0, 4) == 0) { // 1 in 5 chance
|
|
|
|
$puctuation = [",", ".", ":", ";", "...", "!", "?"];
|
|
|
|
$puctuation = [',', '.', ':', ';', '...', '!', '?'];
|
|
|
|
$word .= $puctuation[array_rand($puctuation)];
|
|
|
|
$word .= $puctuation[array_rand($puctuation)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$out[] = $word;
|
|
|
|
$out[] = $word;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return implode(" ", $out);
|
|
|
|
return implode(' ', $out);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function islist($lang) {
|
|
|
|
|
|
|
|
global $list;
|
|
|
|
|
|
|
|
return $lang == $list ? 'selected' : '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Return source code
|
|
|
|
// Return source code
|
|
|
|
if(isset($_GET['source'])) {
|
|
|
|
if(isset($_GET['source'])) {
|
|
|
|
header("Content-Type: text/plain");
|
|
|
|
header('Content-Type: text/plain');
|
|
|
|
die(file_get_contents(basename($_SERVER['PHP_SELF'])));
|
|
|
|
die(file_get_contents(basename($_SERVER['PHP_SELF'])));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dicts = [
|
|
|
|
|
|
|
|
'bg' => '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
|
|
|
|
// Plaintext
|
|
|
|
if(isset($_GET['raw'])) {
|
|
|
|
if(isset($_GET['raw'])) {
|
|
|
|
header("Content-Type: text/plain");
|
|
|
|
header('Content-Type: text/plain');
|
|
|
|
die(motd("../words.txt"));
|
|
|
|
die($motd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$motd = motd("../words.txt");
|
|
|
|
$motd = htmlspecialchars($motd);
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_GET['rss'])) {
|
|
|
|
if(isset($_GET['rss'])) {
|
|
|
|
header("Content-Type: application/rss+xml");
|
|
|
|
header('Content-Type: application/rss+xml');
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
|
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
|
|
<channel>
|
|
|
|
<channel>
|
|
|
|
<title>MOTD | ピケ.コム</title>
|
|
|
|
<title>MOTD | ピケ.コム</title>
|
|
|
|
<link>http://xn--rck9c.xn--tckwe/motd.php</link>
|
|
|
|
<link>http://xn--rck9c.xn--tckwe/motd.php?list=<?php echo $list; ?></link>
|
|
|
|
<atom:link href="http://bbs.xn--rck9c.xn--tckwe/rss.php" rel="self" type="application/rss+xml" />
|
|
|
|
<atom:link href="http://bbs.xn--rck9c.xn--tckwe/rss.php" rel="self" type="application/rss+xml" />
|
|
|
|
<description>A random message each day</description>
|
|
|
|
<description>A random message each day</description>
|
|
|
|
<lastBuildDate><?php echo date('r', $today); ?></lastBuildDate>
|
|
|
|
<lastBuildDate><?php echo date('r', $today); ?></lastBuildDate>
|
|
|
|
<language>en-US</language>
|
|
|
|
<language><?php echo $list ? : 'en'; ?></language>
|
|
|
|
<item>
|
|
|
|
<item>
|
|
|
|
<title><?php echo $motd; ?></title>
|
|
|
|
<title><?php echo $motd; ?></title>
|
|
|
|
<link>http://xn--rck9c.xn--tckwe/motd.php</link>
|
|
|
|
<link>http://xn--rck9c.xn--tckwe/motd.php?list=<?php echo $list; ?></link>
|
|
|
|
<description><?php echo $motd; ?></description>
|
|
|
|
<description><?php echo $motd; ?></description>
|
|
|
|
<author>Pk11</author>
|
|
|
|
<author>Pk11</author>
|
|
|
|
<pubDate><?php echo $post['pubDate']; ?></pubDate>
|
|
|
|
<pubDate><?php echo $post['pubDate']; ?></pubDate>
|
|
|
@ -58,22 +96,53 @@
|
|
|
|
</rss>
|
|
|
|
</rss>
|
|
|
|
<?php } else { ?>
|
|
|
|
<?php } else { ?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<html lang="<?php echo $list ? : 'en'; ?>">
|
|
|
|
<head>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title><?php echo htmlspecialchars($motd); ?></title>
|
|
|
|
<title><?php echo $motd; ?></title>
|
|
|
|
<meta name="description" content="<?php echo $motd; ?>">
|
|
|
|
<meta name="description" content="<?php echo $motd; ?>">
|
|
|
|
<link rel="alternate" type="application/rss+xml" title="RSS feed" href="?rss" />
|
|
|
|
<link rel="alternate" type="application/rss+xml" title="RSS feed" href="?list=<?php echo $list; ?>&rss" />
|
|
|
|
</head>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<body>
|
|
|
|
<h1 title="<?php echo date("Y-m-d (T)"); ?>"><?php echo htmlspecialchars($motd); ?></h1>
|
|
|
|
<h1 title="<?php echo date("Y-m-d (T)"); ?>"><?php echo $motd; ?></h1>
|
|
|
|
<p>
|
|
|
|
|
|
|
|
|
|
|
|
<nav lang="en">
|
|
|
|
[<a href="//xn--rck9c.xn--tckwe/">back</a>]
|
|
|
|
[<a href="//xn--rck9c.xn--tckwe/">back</a>]
|
|
|
|
[<a href="?raw">raw</a>]
|
|
|
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" style="display:inline">
|
|
|
|
[<a href="?rss">rss</a>]
|
|
|
|
[<select name="list" aria-label="Word list" onchange="if(this.value != '<?php echo $list; ?>') this.form.submit();">
|
|
|
|
|
|
|
|
<option value="">Unicode</option>
|
|
|
|
|
|
|
|
<option lang="ca" value="ca" <?php echo islist('ca'); ?>>Català</option>
|
|
|
|
|
|
|
|
<option lang="da" value="da" <?php echo islist('da'); ?>>Dansk</option>
|
|
|
|
|
|
|
|
<option lang="de" value="de" <?php echo islist('de'); ?>>Deutsch</option>
|
|
|
|
|
|
|
|
<option lang="en-ca" value="en-ca" <?php echo islist('en-ca'); ?>>English (CA)</option>
|
|
|
|
|
|
|
|
<option lang="en-gb" value="en-gb" <?php echo islist('en-gb'); ?>>English (UK)</option>
|
|
|
|
|
|
|
|
<option lang="en-us" value="en-us" <?php echo islist('en-us'); ?>>English (US)</option>
|
|
|
|
|
|
|
|
<option lang="es" value="es" <?php echo islist('es'); ?>>Español</option>
|
|
|
|
|
|
|
|
<option lang="eo" value="eo" <?php echo islist('eo'); ?>>Esperanto</option>
|
|
|
|
|
|
|
|
<option lang="fr" value="fr" <?php echo islist('fr'); ?>>Français</option>
|
|
|
|
|
|
|
|
<option lang="fo" value="fo" <?php echo islist('fo'); ?>>Føroyskt</option>
|
|
|
|
|
|
|
|
<option lang="gl" value="gl" <?php echo islist('gl'); ?>>Galego</option>
|
|
|
|
|
|
|
|
<option lang="it" value="it" <?php echo islist('it'); ?>>Italiano</option>
|
|
|
|
|
|
|
|
<option lang="pt-br" value="pt-br" <?php echo islist('pt-br'); ?>>Português (Brasil)</option>
|
|
|
|
|
|
|
|
<option lang="pt-pt" value="pt-pt" <?php echo islist('pt-pt'); ?>>Português (Portugal)</option>
|
|
|
|
|
|
|
|
<option lang="nl" value="nl" <?php echo islist('nl'); ?>>Nederlands</option>
|
|
|
|
|
|
|
|
<option lang="nb" value="nb" <?php echo islist('nb'); ?>>Norsk (Bokmål)</option>
|
|
|
|
|
|
|
|
<option lang="nn" value="nn" <?php echo islist('nn'); ?>>Norsk (Nynorsk)</option>
|
|
|
|
|
|
|
|
<option lang="pl" value="pl" <?php echo islist('pl'); ?>>Polski</option>
|
|
|
|
|
|
|
|
<option lang="fi" value="fi" <?php echo islist('fi'); ?>>Suomi</option>
|
|
|
|
|
|
|
|
<option lang="sv" value="sv" <?php echo islist('sv'); ?>>Svenska</option>
|
|
|
|
|
|
|
|
<option lang="bg" value="bg" <?php echo islist('bg'); ?>>Български</option>
|
|
|
|
|
|
|
|
<option lang="uk" value="uk" <?php echo islist('uk'); ?>>Українська</option>
|
|
|
|
|
|
|
|
</select>]
|
|
|
|
|
|
|
|
<noscript>
|
|
|
|
|
|
|
|
[<input type="submit">]
|
|
|
|
|
|
|
|
</noscript>
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
[<a href="?list=<?php echo $list; ?>&raw">raw</a>]
|
|
|
|
|
|
|
|
[<a href="?list=<?php echo $list; ?>&rss">rss</a>]
|
|
|
|
[<a href="?source">source</a>]
|
|
|
|
[<a href="?source">source</a>]
|
|
|
|
</p>
|
|
|
|
<nav>
|
|
|
|
</body>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
</html>
|
|
|
|
<?php } ?>
|
|
|
|
<?php } ?>
|
|
|
|