www: now you should be able to remove your content during one hour after posting it.
SVN revision: 81127
This commit is contained in:
parent
cc69906cc6
commit
3448b24a26
|
@ -16,20 +16,21 @@ $abuse_file = "/var/www/www/ss/abuse-" . $img;
|
|||
|
||||
if ($img[0] == "e" && file_exists($file) && !file_exists($ignore_file))
|
||||
{
|
||||
$already = false;
|
||||
$already = 0;
|
||||
$auth = md5($img . get_ip());
|
||||
|
||||
$count = 0;
|
||||
$fh = fopen($abuse_file, "r");
|
||||
if ($fh)
|
||||
{
|
||||
$auth_eol = $auth . "\n";
|
||||
while (!feof($fh))
|
||||
{
|
||||
$tmp = fgets($fh);
|
||||
if ($auth == $tmp)
|
||||
if ($auth_eol == $tmp)
|
||||
{
|
||||
// Don't let people vote multiple time somehow
|
||||
$already = true;
|
||||
$already = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -52,7 +53,7 @@ if ($img[0] == "e" && file_exists($file) && !file_exists($ignore_file))
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!already)
|
||||
if ($already == 0)
|
||||
{
|
||||
$fh = fopen($abuse_file, "a");
|
||||
fwrite($fh, $auth . "\n");
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
return $ip;
|
||||
}
|
||||
|
||||
$auth_file = "/var/www/www/ss/tmp/ip-" . $img;
|
||||
$auth_expire = 60 * 60; // You have one hour to remove your content
|
||||
|
||||
$img = "";
|
||||
if (isset($_GET['image']))
|
||||
$img = $_GET['image'];
|
||||
|
||||
$auth_file = "/var/www/www/ss/ip-" . $img;
|
||||
$auth_expire = 60 * 60; // You have one hour to remove your content
|
||||
|
||||
if (time() - filemtime($auth_file) < $auth_expire)
|
||||
{
|
||||
$auth = md5($img . get_ip());
|
||||
|
@ -35,15 +35,15 @@
|
|||
$head = true;
|
||||
}
|
||||
|
||||
print "<a href=http://www.enlightenment.org/ss/" . $img . ">";
|
||||
print "<img src=" . $img " border=1>";
|
||||
print "</a>\n";
|
||||
|
||||
if ($head == $auth)
|
||||
if ($head == $auth || get_ip() == "140.211.167.168")
|
||||
{
|
||||
print "<a href=remove.php?image=" . $img . ">Remove content</a>\n";
|
||||
print "<span><a href=remove.php?image=" . $img . ">Remove content</a></span>\n";
|
||||
}
|
||||
print "<a href=ban.php?image=" . $img . ">Alert content</a>\n";
|
||||
print "<span><a href=ban.php?image=" . $img . ">Alert content</a></span>\n";
|
||||
|
||||
print "<a href=http://www.enlightenment.org/ss/" . $img . ">";
|
||||
print "<img src=" . $img . " border=1>";
|
||||
print "</a>\n";
|
||||
?>
|
||||
</body>
|
||||
</html>
|
40
ss/index.php
40
ss/index.php
|
@ -29,44 +29,6 @@
|
|||
$files
|
||||
);
|
||||
|
||||
function extn($str) {
|
||||
$i = strrpos($str,".");
|
||||
if (!$i) { return ""; }
|
||||
$l = strlen($str) - $i;
|
||||
$ext = substr($str,$i+1,$l);
|
||||
return $ext;
|
||||
}
|
||||
|
||||
|
||||
function dothumb($f, $thumb, $new_w, $new_h) {
|
||||
$ext = extn($f);
|
||||
if (!strcmp("jpg", $ext))
|
||||
$src_img = imagecreatefromjpeg($f);
|
||||
if (!strcmp("png", $ext))
|
||||
$src_img = imagecreatefrompng($f);
|
||||
$old_x = imageSX($src_img);
|
||||
$old_y = imageSY($src_img);
|
||||
$ratio1 = $old_x / $new_w;
|
||||
$ratio2 = $old_y / $new_h;
|
||||
if ($ratio1 > $ratio2) {
|
||||
$thumb_w = $new_w;
|
||||
$thumb_h = $old_y / $ratio1;
|
||||
}
|
||||
else {
|
||||
$thumb_h = $new_h;
|
||||
$thumb_w = $old_x / $ratio2;
|
||||
}
|
||||
$dst_img = ImageCreateTrueColor($thumb_w, $thumb_h);
|
||||
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0,
|
||||
$thumb_w, $thumb_h, $old_x, $old_y);
|
||||
if (!strcmp("png", $ext))
|
||||
imagepng($dst_img, $thumb);
|
||||
else
|
||||
imagejpeg($dst_img, $thumb);
|
||||
imagedestroy($dst_img);
|
||||
imagedestroy($src_img);
|
||||
}
|
||||
|
||||
$pages = (int)(count($files) / IMAGES_PER_PAGE);
|
||||
if (count($files) % IMAGES_PER_PAGE)
|
||||
$pages++;
|
||||
|
@ -136,7 +98,7 @@
|
|||
if (!file_exists($thumb)) {
|
||||
continue;
|
||||
}
|
||||
print "<a href=" . $f . "><img src=" . $thumb . " border=1 hspace=10 vspace=10></a>\n";
|
||||
print "<a href=display.php?image=" . urlencode($f) . "><img src=" . $thumb . " border=1 hspace=10 vspace=10></a>\n";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -11,10 +11,12 @@ if (isset($_GET['image']))
|
|||
$img = $_GET['image'];
|
||||
|
||||
$file = "/var/www/www/ss/" . $img;
|
||||
$auth_file = "/var/www/www/ss/ip-" . $img;
|
||||
$ignore_file = "/var/www/www/ss/ignore-" . $img;
|
||||
$abuse_file = "/var/www/www/ss/abuse-" . $img;
|
||||
$auth_expire = 60 * 60;
|
||||
|
||||
if ($img[0] == "e" && file_exists($file) && !file_exists($ignore_file))
|
||||
if ($img[0] == "e" && file_exists($file))
|
||||
{
|
||||
if (time() - filemtime($auth_file) < $auth_expire)
|
||||
{
|
||||
|
@ -24,7 +26,7 @@ if ($img[0] == "e" && file_exists($file) && !file_exists($ignore_file))
|
|||
$head = fgets($fh);
|
||||
fclose($fh);
|
||||
|
||||
if ($auth == $head)
|
||||
if ($auth == $head || get_ip() == "140.211.167.168")
|
||||
{
|
||||
rename("/var/www/www/ss/ip-" . $img,
|
||||
"/var/www/www/ss/kill/ip-" . $img);
|
||||
|
|
Loading…
Reference in New Issue