services-posters/admin.php
2007-07-25 14:12:17 +00:00

50 lines
No EOL
1.2 KiB
PHP
Executable file

<?
include('php/library.php');
echo '<tt>';
$poster = $_GET['poster'];
$kill = $_GET['kill'];
if ($poster) {
echo '<img src="' . $poster . '" /><br />' . $poster . ' <a href="admin.php?kill=' . $poster . '">kill</a>';
exit;
}
if ($kill) {
rename($kill, substr($kill, 0, 27) . '_' . substr($kill, 27));
echo $kill . ' killed.';
exit;
}
$path = 'posters/wikipedia.org';
$list = crawlPath($path);
foreach ($list as $value) {
if (strstr($value, '/_'))
$signature[$value] = md5(file_get_contents($value));
else if (strstr($value, '_'))
unlink($value);
}
echo (count($list) - count($signature)) . ' posters<br /><br />';
sort($list);
foreach ($list as $value) {
if (!$signature[$value]) {
if (in_array(md5(file_get_contents($value)), $signature)) {
rename($value, substr($value, 0, 27) . '_' . substr($value, 27));
// echo '<img src="' . substr($value, 0, 27) . '_' . substr($value, 27) . '" /><br />';
}
else {
$pathinfo = pathinfo($value);
$extension = $pathinfo['extension'];
$imagesize = getimagesize($value);
if ($extension == 'png' || $imagesize[0] >= $imagesize[1])
echo '<img src="' . $value . '" /><br />' . $value . ' <a href="admin.php?poster=' . $value . '">kill</a><br /><br />';
}
}
}
?>