nexus clients

This commit is contained in:
xiaomlove
2021-04-21 00:07:32 +08:00
parent be9b8634c4
commit c7a6616618
23 changed files with 897 additions and 31 deletions
+58
View File
@@ -0,0 +1,58 @@
<?php
require "../include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
if (get_user_class() < UC_SYSOP) {
permissiondenied();
}
$type = $_GET['type'] ?? 'allow';
$client = new \Nexus\Client\Client($type);
$action = $_GET['action'] ?? 'view';
if ($action == 'view') {
stdhead($lang_clients['client_management']." - ".$lang_clients['text_field']);
begin_main_frame();
$r = $client->buildClientTable();
echo $r;
stdfoot();
} elseif ($action == 'add') {
stdhead($lang_clients['field_management']." - ".$lang_clients['text_add']);
begin_main_frame();
echo $client->buildFieldForm();
} elseif ($action == 'submit') {
try {
$result = $client->save($_REQUEST);
nexus_redirect('clients.php?action=view');
} catch (\Exception $e) {
stderr($lang_clients['field_management'], $e->getMessage());
}
} elseif ($action == 'edit') {
$id = intval($_GET['id'] ?? 0);
if ($id == 0) {
stderr($lang_clients['field_management'], "Invalid id");
}
$sql = "select * from torrents_custom_fields where id = $id";
$res = sql_query($sql);
$row = mysql_fetch_assoc($res);
if (empty($row)) {
stderr('', 'Invalid id');
}
stdhead($lang_clients['field_management']." - ".$lang_clients['text_edit']);
begin_main_frame();
echo $client->buildFieldForm($row);
} elseif ($action == 'del') {
$id = intval($_GET['id'] ?? 0);
if ($id == 0) {
stderr($lang_clients['field_management'], "Invalid id");
}
$sql = "delete from torrents_custom_fields where id = $id";
$res = sql_query($sql);
nexus_redirect('clients.php?action=view');
}
+2 -2
View File
@@ -23,7 +23,7 @@ if ($action == 'view') {
} elseif ($action == 'submit') {
try {
$result = $field->save($_REQUEST);
redirect('fields.php?action=view');
nexus_redirect('fields.php?action=view');
} catch (\Exception $e) {
stderr($lang_fields['field_management'], $e->getMessage());
}
@@ -48,7 +48,7 @@ if ($action == 'view') {
}
$sql = "delete from torrents_custom_fields where id = $id";
$res = sql_query($sql);
redirect('fields.php?action=view');
nexus_redirect('fields.php?action=view');
}
+1 -1
View File
@@ -21,7 +21,7 @@ function safe_query ($query,$id,$where = '') {
$result = sql_query($query);
if (!$result)
return sqlerr(__FILE__,__LINE__);
redirect("maxlogin.php?update=".htmlspecialchars($where));
nexus_redirect("maxlogin.php?update=".htmlspecialchars($where));
}
function searchform () {
?>
+7 -7
View File
@@ -333,7 +333,7 @@ if ($action == "exchange") {
$up = $upload + $bonusarray['menge'];
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for upload bonus.\n " .$bonuscomment;
sql_query("UPDATE users SET uploaded = ".sqlesc($up).", seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=upload");
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=upload");
}
}
//=== trade for one month VIP status ***note "SET class = '10'" change "10" to whatever your VIP class number is
@@ -346,7 +346,7 @@ if ($action == "exchange") {
$vip_until = date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) + 28*86400));
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for 1 month VIP Status.\n " .htmlspecialchars($bonuscomment);
sql_query("UPDATE users SET class = '".UC_VIP."', vip_added = 'yes', vip_until = ".sqlesc($vip_until).", seedbonus = seedbonus - $points WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=vip");
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=vip");
}
//=== trade for invites
elseif($art == "invite") {
@@ -356,7 +356,7 @@ if ($action == "exchange") {
$inv = $invites+$bonusarray['menge'];
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for invites.\n " .htmlspecialchars($bonuscomment);
sql_query("UPDATE users SET invites = ".sqlesc($inv).", seedbonus = seedbonus - $points WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=invite");
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=invite");
}
//=== trade for special title
/**** the $words array are words that you DO NOT want the user to have... use to filter "bad words" & user class...
@@ -370,7 +370,7 @@ if ($action == "exchange") {
$title = str_replace($words, $lang_mybonus['text_wasted_karma'], $title);
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for custom title. Old title is ".htmlspecialchars(trim($CURUSER["title"]))." and new title is $title\n " .htmlspecialchars($bonuscomment);
sql_query("UPDATE users SET title = $title, seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=title");
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=title");
}
elseif($art == "noad" && $enablead_advertisement == 'yes' && $enablebonusnoad_advertisement == 'yes') {
if (($enablenoad_advertisement == 'yes' && get_user_class() >= $noad_advertisement) || strtotime($CURUSER['noaduntil']) >= TIMENOW || get_user_class() < $bonusnoad_advertisement)
@@ -379,7 +379,7 @@ if ($action == "exchange") {
$noaduntil = date("Y-m-d H:i:s",(TIMENOW + $bonusarray['menge']));
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for ".$bonusnoadtime_advertisement." days without ads.\n " .htmlspecialchars($bonuscomment);
sql_query("UPDATE users SET noad='yes', noaduntil='".$noaduntil."', seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id=".sqlesc($userid));
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=noad");
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=noad");
}
}
elseif($art == 'gift_2') // charity giving
@@ -404,7 +404,7 @@ if ($action == "exchange") {
sql_query("UPDATE users SET seedbonus = seedbonus - $points, charity = charity + $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$charityPerUser = $points/$charityReceiverCount;
sql_query("UPDATE users SET seedbonus = seedbonus + $charityPerUser WHERE enabled='yes' AND 10737418240 < downloaded AND $ratiocharity > uploaded/downloaded") or sqlerr(__FILE__, __LINE__);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=charity");
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=charity");
}
else
{
@@ -466,7 +466,7 @@ if ($action == "exchange") {
$msg = sqlesc($msg);
sql_query("INSERT INTO messages (sender, subject, receiver, msg, added) VALUES(0, $subject, $useridgift, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$usernamegift = unesc($_POST["username"]);
redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=transfer");
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=transfer");
}
else{
print("<table width=\"940\"><tr><td class=\"colhead\" align=\"left\" colspan=\"2\"><h1>".$lang_mybonus['text_oups']."</h1></td></tr>");