Rendevous |
4th May 2010 12:11 |
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:
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 .= "\n";
if ($una["username"])
$s .= "$una[username] | \n";
else
$s .= "" . ($mod ? $e["ip"] : preg_replace('/\.\d+$/', ".xxx", $e["ip"])) . " | \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 .= "\n";
//$s .= " \n";
if ($una["username"]) {
if (get_user_class() >= UC_MODERATOR || $torrent['anonymous'] != 'yes' || $e['userid'] != $torrent['owner']) {
// $s .= "$una[username] | \n";
$s .= "$una[username]" . ($una["donor"] == "yes" ? "" : "") . ($una["enabled"] == "no" ? "" : ($una["warned"] == "yes" ? "" : ""));
}
elseif (get_user_class() >= UC_MODERATOR || $torrent['anonymous'] = 'yes') {
$s .= " | Anonymous | \n";
}
}
else
$s .= "(unknown) | \n";
Find the big query, and add anonymous,
inline, like:
Code:
torrents.anonymous, categories.name AS cat_name, users.username
Now find:
In bittorrent.php find:
And replace that with:
Code:
if ($variant == "index") {
if ($row["anonymous"] == "yes") {
print("Anonymous | \n");
}
else {
print("" . (isset($row["username"]) ? ("" . htmlspecialchars($row["username"]) . "") : "(unknown)") . " | \n");
}
}
Now, in edit.php, beneath:
Add this:
In takeedit.php, over:
Code:
$updateset[] = "name = " . sqlesc($name);
Add:
Code:
$updateset[] = "anonymous = '" . ($_POST["anonymous"] ? "yes" : "no") . "'";
Thanks to Wilba and Pirata from Tbdev:drink:
|