Skip to content

Instantly share code, notes, and snippets.

@flashwave
Created May 6, 2016 18:11
Show Gist options
  • Save flashwave/fa0563d860deef4d13449482e837723a to your computer and use it in GitHub Desktop.
Save flashwave/fa0563d860deef4d13449482e837723a to your computer and use it in GitHub Desktop.
<?php
$modes = [
'swf' => 'swf/*.swf',
'catgirls' => 'catgirls/*.*',
'coffington' => 'coffington/*.*',
'flashwave' => 'flashwave/*.*',
];
$mode = (isset($_GET['mode']) && array_key_exists($_GET['mode'], $modes) ? $_GET['mode'] : array_keys($modes)[0]);
$all = glob($modes[$mode]);
if (isset($_GET['random']) && $_GET['random']) {
header('Location: /' . $mode .'/' . rawurlencode(substr(strstr($all[array_rand($all)], '/'), 1)));
exit;
}
if ((isset($_GET['list']) && $_GET['list']) || (isset($_GET['json']) && $_GET['json'])) {
header('Content-Type: text/plain');
$out = str_replace('%0D%0A', PHP_EOL, str_replace('%2F', '/', rawurlencode(implode($all, "\r\n"))));
if(isset($_GET['json']) && $_GET['json']) {
$out = json_encode(explode(PHP_EOL, $out), (isset($_GET['pretty']) && $_GET['pretty'] ? JSON_PRETTY_PRINT : null) | JSON_UNESCAPED_SLASHES);
}
echo $out;
exit;
}
$files = array_chunk($all, (isset($_GET['l']) ? $_GET['l'] : 35), true);
$page = array_key_exists(@$_GET['p'], $files) ? $_GET['p'] : 0;
?>
<!DOCTYPE html>
<html>
<head>
<title>Oniichan.me</title>
<link rel="stylesheet" type="text/css" href="oneesama.css" />
</head>
<body>
<h1>Oniichan~</h1>
<i>Your global repository of stupid shit&trade;</i>
<hr />
<b>Update 2015-10-06</b>: newstuff.flp.
<hr />
<a href="/">SWF</a> / <a href="/?mode=catgirls">Catgirls</a> / <a href="/?mode=coffington">Coffington</a> / <a href="/?random=true<?=($mode != array_keys($modes)[0] ? '&mode='. $mode : null);?>">Random File</a>
<hr />
<?php
if (count($files) > 1) {
print '[<a href="?l=' . count($all) . '">ALL</a>]';
foreach ($files as $key => $val) {
print ' [<a href="?p=' . $key . ($mode != array_keys($modes)[0] ? '&mode='. $mode : null) . '">' . ($key + 1) . '</a>]';
}
print '<hr />';
}
?>
<ul>
<?php
foreach ($files[$page] as $file) {
print '<li><a href="';
print $mode .'/' . rawurlencode(substr(strstr($file, '/'), 1));
print '" target="_blank">';
print strrev(substr(strstr(strrev(substr(strstr($file, '/'), 1)), '.'), 1));
print '</a></li>';
}
?>
</ul>
<hr />
<?php
if (count($files) > 1) {
print '[<a href="?l=' . count($all) . '">ALL</a>]';
foreach ($files as $key => $val) {
print ' [<a href="?p=' . $key . ($mode != array_keys($modes)[0] ? '&mode='. $mode : null) . '">' . ($key + 1) . '</a>]';
}
print '<hr />';
}
?>
<span style="font-style: italic;">Managed by <a href="http://flash.moe/" target="_blank">Flashwave</a></span>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment