View Single Post
  #1  
Old 4th May 2010, 12:11
Rendevous Rendevous is offline
Senior Member
 
Join Date: Nov 2009
Romania
Posts: 43
Default Anonymous Uploader
This is the complete anonymous uploading mod.
In upload.php uploader can choose to hide their name.

Code:
ALTER TABLE `torrents` ADD `anonymous` ENUM( 'yes', 'no' ) DEFAULT 'no' NOT NULL;
In upload.php add:

Code:
tr("Show uploader", "<input type=checkbox name=uplver value=yes>Don't show my username in 'Uploaded By' field in browse.", 1);
In takeupload.php find:

Code:
$f = $_FILES["file"];
$fname = unesc($f["name"]);
if (empty($fname))
 bark("Empty filename!");
Change to:

Code:
$f = $_FILES["file"];
$fname = unesc($f["name"]);
if (empty($fname))
 bark("Empty filename!");
if ($_POST['uplver'] == 'yes') {
$anonymous = "yes";
$anon = "Anonymous";
}
else {
$anonymous = "no";
$anon = $CURUSER["username"];
}
Find:

Code:
$ret = mysql_query("INSERT INTO torrents (search_text, filename, owner, visible,
And add anonymous inline, like:

Code:
$ret = mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, anonymous, info_hash, name,
Do the same for:

Code:
implode(",", array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname, $CURUSER["id"], "no",
So it looks like this:

Code:
implode(",", array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname, $CURUSER["id"], "no", $anonymous, $infohash,
browse.php

Find:

Code:
torrents.filename,torrents.owner,IF(torrents.nfo <> '', 1, 0) as nfoav," .
Replace that with:

Code:
torrents.filename,torrents.anonymous,torrents.owner,IF(torrents.nfo <> '', 1, 0) as nfoav," .
In details.php find:

Code:
// user/ip/port
 // check if anyone has this ip
 ($unr = mysql_query("SELECT username, privacy FROM users WHERE id=$e[userid] ORDER BY last_access DESC LIMIT 1")) or die;
 $una = mysql_fetch_array($unr);
 if ($una["privacy"] == "strong") continue;
 $s .= "<tr>\n";
 if ($una["username"])
 $s .= "<td><a href=userdetails.php?id=$e[userid]><b>$una[username]</b></a></td>\n";
 else
 $s .= "<td>" . ($mod ? $e["ip"] : preg_replace('/\.\d+$/', ".xxx", $e["ip"])) . "</td>\n";
Replace with:

Code:
// user/ip/port
// check if anyone has this ip
($unr = mysql_query("SELECT id, username, privacy, warned, donor FROM users WHERE id=$e[userid] ORDER BY last_access DESC LIMIT 1")) or die;
$una = mysql_fetch_array($unr);
if ($una["privacy"] == "strong") continue;
++$num;

$highlight = $CURUSER["id"] == $una["id"] ? " bgcolor=#BBAF9B" : "";
$s .= "<tr$highlight>\n";
//$s .= "<tr>\n";
if ($una["username"]) {

if (get_user_class() >= UC_MODERATOR || $torrent['anonymous'] != 'yes' || $e['userid'] != $torrent['owner']) {
// $s .= "<td><a href=userdetails.php?id=$e[userid]><b>$una[username]</b></a></td>\n";
$s .= "<td><a href=userdetails.php?id=$e[userid]><b>$una[username]</b></a>" . ($una["donor"] == "yes" ? "<img src=".
"/pic/star.gif alt='Donor'>" : "") . ($una["enabled"] == "no" ? "<img src=".
"/pic/disabled.gif alt=\"This account is disabled\" style='margin-left: 2px'>" : ($una["warned"] == "yes" ? "<a href=rules.php#warning class=altlink><img src=/pic/warned.gif alt=\"Warned\" border=0></a>" : ""));
}
elseif (get_user_class() >= UC_MODERATOR || $torrent['anonymous'] = 'yes') {
$s .= "<td><i>Anonymous</i></a></td>\n";
}
}
else
$s .= "<td>(unknown)</td>\n";
Find the big query, and add anonymous,
inline, like:

Code:
torrents.anonymous, categories.name AS cat_name, users.username
Now find:

Code:
$keepget = "";
if($row['anonymous'] == 'yes') {

if (get_user_class() < UC_UPLOADER)
$uprow = "<i>Anonymous</i>";
else
$uprow = "<i>Anonymous</i> (<a href=userdetails.php?id=$row[owner]><b>$row[username]</b></a>)";
}
else {
$uprow = (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . htmlspecialchars($row["username"]) . "</b></a>") : "<i>(unknown)</i>");
}
if ($owned)
In bittorrent.php find:

Code:
if ($variant == "index")
 print("<td align=center>" . (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . htmlspecialchars($row["username"]) . "</b></a>") : "<i>(unknown)</i>") . "</td>\n");
And replace that with:

Code:
if ($variant == "index") {
if ($row["anonymous"] == "yes") {
 print("<td align=center><i>Anonymous</i></td>\n");
 }
else {
 print("<td align=center>" . (isset($row["username"]) ? ("<a href=userdetails.php?id=" . $row["owner"] . "><b>" . htmlspecialchars($row["username"]) . "</b></a>") : "<i>(unknown)</i>") . "</td>\n");
 }
}
Now, in edit.php, beneath:

Code:
tr("Visible", "<input type=\"checkbox\" name=\"visible\"" . (($row["visible"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"1\" /> Visible on main page<br /><table border=0 cellspacing=0 cellpadding=0 width=420><tr><td class=embedded>Note that the torrent will automatically become visible when there's a seeder, and will become automatically invisible (dead) when there has been no seeder for a while. Use this switch to speed the process up manually. Also note that invisible (dead) torrents can still be viewed or searched for, it's just not the default.</td></tr></table>", 1);
Add this:

Code:
tr("Anonymous uploader", "<input type=\"checkbox\" name=\"anonymous\"" . (($row["anonymous"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"1\" /> Check this box to hide the uploader of the torrent", 1);
In takeedit.php, over:

Code:
$updateset[] = "name = " . sqlesc($name);
Add:

Code:
$updateset[] = "anonymous = '" . ($_POST["anonymous"] ? "yes" : "no") . "'";
Thanks to Wilba and Pirata from Tbdev
Reply With Quote
The Following 3 Users Say Thank You to Rendevous For This Useful Post:
ajax (8th June 2010), ratza (4th August 2013), TOMEK (24th October 2015)