mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
[H&R] basically
This commit is contained in:
+25
-5
@@ -105,7 +105,7 @@ elseif ($az['showclienterror'] == 'yes'){
|
||||
}
|
||||
|
||||
// check torrent based on info_hash
|
||||
$checkTorrentSql = "SELECT id, owner, sp_state, seeders, leechers, UNIX_TIMESTAMP(added) AS ts, banned FROM torrents WHERE " . hash_where("info_hash", $info_hash);
|
||||
$checkTorrentSql = "SELECT id, owner, sp_state, seeders, leechers, UNIX_TIMESTAMP(added) AS ts, banned, hr FROM torrents WHERE " . hash_where("info_hash", $info_hash);
|
||||
if (!$torrent = $Cache->get_value('torrent_hash_'.$info_hash.'_content')){
|
||||
$res = sql_query($checkTorrentSql);
|
||||
$torrent = mysql_fetch_array($res);
|
||||
@@ -141,7 +141,12 @@ else $limit = "";
|
||||
$announce_wait = 30;
|
||||
|
||||
$fields = "seeder, peer_id, ip, port, uploaded, downloaded, (".TIMENOW." - UNIX_TIMESTAMP(last_action)) AS announcetime, UNIX_TIMESTAMP(prev_action) AS prevts";
|
||||
$peerlistsql = "SELECT ".$fields." FROM peers WHERE torrent = ".$torrentid." AND connectable = 'yes' ".$only_leech_query.$limit;
|
||||
//$peerlistsql = "SELECT ".$fields." FROM peers WHERE torrent = ".$torrentid." AND connectable = 'yes' ".$only_leech_query.$limit;
|
||||
/**
|
||||
* return all peers,include connectable no
|
||||
* @since 1.6.0-beta12
|
||||
*/
|
||||
$peerlistsql = "SELECT ".$fields." FROM peers WHERE torrent = " . $torrentid . $only_leech_query . $limit;
|
||||
$res = sql_query($peerlistsql);
|
||||
|
||||
$real_annnounce_interval = $announce_interval;
|
||||
@@ -399,15 +404,30 @@ elseif(isset($self))
|
||||
{
|
||||
if ($seeder <> $self["seeder"])
|
||||
$updateset[] = ($seeder == "yes" ? "seeders = seeders + 1, leechers = leechers - 1" : "seeders = seeders - 1, leechers = leechers + 1");
|
||||
sql_query("UPDATE snatched SET uploaded = uploaded + $trueupthis, downloaded = downloaded + $truedownthis, to_go = $left, $announcetime, last_action = ".$dt." $finished_snatched WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 2");
|
||||
$snatchInfo = \App\Models\Snatch::query()
|
||||
->where('torrentid', $torrentid)
|
||||
->where('userid', $userid)
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
if ($snatchInfo) {
|
||||
sql_query("UPDATE snatched SET uploaded = uploaded + $trueupthis, downloaded = downloaded + $truedownthis, to_go = $left, $announcetime, last_action = ".$dt." $finished_snatched WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 2");
|
||||
if ($event == "completed") {
|
||||
$hrMode = get_setting('hr.mode');
|
||||
if ($hrMode == \App\Models\HitAndRun::MODE_GLOBAL || ($hrMode == \App\Models\HitAndRun::MODE_MANUAL && $torrent['hr'] == \App\Models\Torrent::HR_YES)) {
|
||||
$sql = "insert into hit_and_runs (uid, torrent_id, snatched_id) values ($userid, $torrentid, {$snatchInfo->id}) on duplicate key update updated_at = " . sqlesc(date('Y-m-d H:i:s'));
|
||||
$affectedRows = sql_query($sql);
|
||||
do_log("[INSERT_H&R], $sql, affectedRows: $affectedRows");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($ip) > 15) {
|
||||
$sockres = @pfsockopen("tcp://[".$ip."]",$port,$errno,$errstr,5);
|
||||
$sockres = @pfsockopen("tcp://[".$ip."]",$port,$errno,$errstr,1);
|
||||
} else {
|
||||
$sockres = @pfsockopen($ip, $port, $errno, $errstr, 5);
|
||||
$sockres = @pfsockopen($ip, $port, $errno, $errstr, 1);
|
||||
}
|
||||
if (!$sockres)
|
||||
{
|
||||
|
||||
+6
-5
@@ -11,7 +11,7 @@ int_check($id);
|
||||
if (!isset($id) || !$id)
|
||||
die();
|
||||
|
||||
$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, torrents.technical_info,
|
||||
$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, torrents.technical_info, torrents.hr,
|
||||
categories.name AS cat_name, categories.mode as search_box_id, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name
|
||||
FROM torrents LEFT JOIN categories ON torrents.category = categories.id
|
||||
LEFT JOIN sources ON torrents.source = sources.id
|
||||
@@ -66,8 +66,8 @@ if (!$row) {
|
||||
print("<p><b>".$lang_details['text_go_back'] . "<a href=\"".htmlspecialchars($_GET["returnto"])."\">" . $lang_details['text_whence_you_came']."</a></b></p>");
|
||||
}
|
||||
$sp_torrent = get_torrent_promotion_append($row['sp_state'],'word');
|
||||
|
||||
$s=htmlspecialchars($row["name"]).($sp_torrent ? " ".$sp_torrent : "");
|
||||
$hrImg = get_hr_img($row);
|
||||
$s=htmlspecialchars($row["name"]).($sp_torrent ? " ".$sp_torrent : "") . $hrImg;
|
||||
print("<h1 align=\"center\" id=\"top\">".$s."</h1>\n");
|
||||
print("<table width=\"97%\" cellspacing=\"0\" cellpadding=\"5\">\n");
|
||||
|
||||
@@ -281,7 +281,7 @@ if (!$row) {
|
||||
if ($imdb_id)
|
||||
{
|
||||
$where_area = " url = " . sqlesc((int)$imdb_id) ." AND torrents.id != ".sqlesc($id);
|
||||
$copies_res = sql_query("SELECT torrents.id, torrents.name, torrents.sp_state, torrents.size, torrents.added, torrents.seeders, torrents.leechers, categories.id AS catid, categories.name AS catname, categories.image AS catimage, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name FROM torrents LEFT JOIN categories ON torrents.category=categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id WHERE " . $where_area . " ORDER BY torrents.id DESC") or sqlerr(__FILE__, __LINE__);
|
||||
$copies_res = sql_query("SELECT torrents.id, torrents.name, torrents.sp_state, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.hr,categories.id AS catid, categories.name AS catname, categories.image AS catimage, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name FROM torrents LEFT JOIN categories ON torrents.category=categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id WHERE " . $where_area . " ORDER BY torrents.id DESC") or sqlerr(__FILE__, __LINE__);
|
||||
|
||||
$copies_count = mysql_num_rows($copies_res);
|
||||
if($copies_count > 0)
|
||||
@@ -311,8 +311,9 @@ if (!$row) {
|
||||
|
||||
$sphighlight = get_torrent_bg_color($copy_row['sp_state']);
|
||||
$sp_info = get_torrent_promotion_append($copy_row['sp_state']);
|
||||
$hrImg = get_hr_img($copy_row);
|
||||
|
||||
$s .= "<tr". $sphighlight."><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($copy_row["catid"], "torrents.php?allsec=1&")."</td><td class=\"rowfollow\" align=\"left\"><a href=\"" . htmlspecialchars(get_protocol_prefix() . $BASEURL . "/details.php?id=" . $copy_row["id"]. "&hit=1")."\">" . $dispname ."</a>". $sp_info."</td>" .
|
||||
$s .= "<tr". $sphighlight."><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($copy_row["catid"], "torrents.php?allsec=1&")."</td><td class=\"rowfollow\" align=\"left\"><a href=\"" . htmlspecialchars(get_protocol_prefix() . $BASEURL . "/details.php?id=" . $copy_row["id"]. "&hit=1")."\">" . $dispname ."</a>". $sp_info. $hrImg ."</td>" .
|
||||
"<td class=\"rowfollow\" align=\"left\">" . rtrim(trim($other_source_info . $other_medium_info . $other_codec_info . $other_standard_info . $other_processing_info), ","). "</td>" .
|
||||
"<td class=\"rowfollow\" align=\"center\">" . mksize($copy_row["size"]) . "</td>" .
|
||||
"<td class=\"rowfollow nowrap\" align=\"center\">" . str_replace(" ", "<br />", gettime($copy_row["added"],false)). "</td>" .
|
||||
|
||||
@@ -183,6 +183,11 @@ else {
|
||||
}
|
||||
tr($lang_edit['row_pick'], $pickcontent, 1);
|
||||
}
|
||||
if (get_setting('hr.mode') == \App\Models\HitAndRun::MODE_MANUAL && get_user_class() >= get_setting('authority.torrent_hr')) {
|
||||
$hrRadio = sprintf('<label><input type="radio" name="hr" value="0"%s />NO</label>', (string)$row['hr'] === '0' ? ' checked' : '');
|
||||
$hrRadio .= sprintf('<label><input type="radio" name="hr" value="1"%s />YES</label>', (string)$row['hr'] === '1' ? ' checked' : '');
|
||||
tr('H&R', $hrRadio, 1);
|
||||
}
|
||||
|
||||
print("<tr><td class=\"toolbox\" colspan=\"2\" align=\"center\"><input id=\"qr\" type=\"submit\" value=\"".$lang_edit['submit_edit_it']."\" /> <input type=\"reset\" value=\"".$lang_edit['submit_revert_changes']."\" /></td></tr>\n");
|
||||
print("</table>\n");
|
||||
|
||||
@@ -3,9 +3,9 @@ require "../include/bittorrent.php";
|
||||
dbconn();
|
||||
require_once(get_langfile_path());
|
||||
//Send some headers to keep the user's browser from caching the response.
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
|
||||
header("Cache-Control: no-cache, must-revalidate" );
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
|
||||
header("Cache-Control: no-cache, must-revalidate" );
|
||||
header("Pragma: no-cache" );
|
||||
header("Content-Type: text/xml; charset=utf-8");
|
||||
function maketable($res, $mode = 'seeding')
|
||||
@@ -94,6 +94,7 @@ function maketable($res, $mode = 'seeding')
|
||||
|
||||
$sphighlight = get_torrent_bg_color($arr['sp_state']);
|
||||
$sp_torrent = get_torrent_promotion_append($arr['sp_state']);
|
||||
$hrImg = get_hr_img($arr);
|
||||
|
||||
//torrent name
|
||||
$dispname = $nametitle = htmlspecialchars($arr["torrentname"]);
|
||||
@@ -113,7 +114,7 @@ function maketable($res, $mode = 'seeding')
|
||||
}
|
||||
else $dissmall_descr == "";
|
||||
$ret .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($arr['category'], "torrents.php?allsec=1&")."</td>\n" .
|
||||
"<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"".htmlspecialchars("details.php?id=".$arr['torrent']."&hit=1")."\" title=\"".$nametitle."\"><b>" . $dispname . "</b></a>". $sp_torrent .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
|
||||
"<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"".htmlspecialchars("details.php?id=".$arr['torrent']."&hit=1")."\" title=\"".$nametitle."\"><b>" . $dispname . "</b></a>". $sp_torrent . $hrImg .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
|
||||
//size
|
||||
if ($showsize)
|
||||
$ret .= "<td class=\"rowfollow\" align=\"center\">". mksize_compact($arr['size'])."</td>";
|
||||
@@ -155,7 +156,7 @@ function maketable($res, $mode = 'seeding')
|
||||
if ($showanonymous)
|
||||
$ret .= "<td class=\"rowfollow\" align=\"center\">".$arr['anonymous']."</td>";
|
||||
$ret .="</tr>\n";
|
||||
|
||||
|
||||
}
|
||||
$ret .= "</table>\n";
|
||||
return $ret;
|
||||
@@ -172,7 +173,7 @@ switch ($type)
|
||||
{
|
||||
case 'uploaded':
|
||||
{
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, categories.name AS catname, categories.image, category, sp_state, size, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, categories.name AS catname, categories.image, category, sp_state, size, hr, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
|
||||
$count = mysql_num_rows($res);
|
||||
if ($count > 0)
|
||||
{
|
||||
@@ -184,7 +185,7 @@ switch ($type)
|
||||
// Current Seeding
|
||||
case 'seeding':
|
||||
{
|
||||
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr();
|
||||
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr();
|
||||
$count = mysql_num_rows($res);
|
||||
if ($count > 0){
|
||||
$torrentlist = maketable($res, 'seeding');
|
||||
@@ -195,7 +196,7 @@ switch ($type)
|
||||
// Current Leeching
|
||||
case 'leeching':
|
||||
{
|
||||
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr();
|
||||
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr();
|
||||
$count = mysql_num_rows($res);
|
||||
if ($count > 0){
|
||||
$torrentlist = maketable($res, 'leeching');
|
||||
@@ -206,7 +207,7 @@ switch ($type)
|
||||
// Completed torrents
|
||||
case 'completed':
|
||||
{
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr();
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, hr,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr();
|
||||
$count = mysql_num_rows($res);
|
||||
if ($count > 0)
|
||||
{
|
||||
@@ -218,7 +219,7 @@ switch ($type)
|
||||
// Incomplete torrents
|
||||
case 'incomplete':
|
||||
{
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr();
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, hr,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr();
|
||||
$count = mysql_num_rows($res);
|
||||
if ($count > 0)
|
||||
{
|
||||
@@ -226,7 +227,7 @@ switch ($type)
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
default:
|
||||
{
|
||||
$count = 0;
|
||||
$torrentlist = "";
|
||||
|
||||
+38
-7
@@ -88,6 +88,17 @@ function bonusarray($option){
|
||||
$bonus['description'] = $lang_mybonus['text_charity_giving_note'];
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
$bonus['points'] = \App\Models\BonusLogs::getBonusForCancelHitAndRun();
|
||||
$bonus['art'] = 'cancel_hr';
|
||||
$bonus['menge'] = 0;
|
||||
$bonus['name'] = $lang_mybonus['text_cancel_hr_title'];
|
||||
$bonus['description'] = '<p>
|
||||
<span style="">' . $lang_mybonus['text_cancel_hr_label'] . '</span>
|
||||
<input type="number" name="hr_id" />
|
||||
</p>';
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return $bonus;
|
||||
@@ -116,6 +127,8 @@ if (isset($do)) {
|
||||
$msg = $lang_mybonus['text_success_no_ad'];
|
||||
elseif ($do == "charity")
|
||||
$msg = $lang_mybonus['text_success_charity'];
|
||||
elseif ($do == "cancel_hr")
|
||||
$msg = $lang_mybonus['text_success_cancel_hr'];
|
||||
else
|
||||
$msg = '';
|
||||
}
|
||||
@@ -137,11 +150,17 @@ print("<tr><td class=\"colhead\" align=\"center\">".$lang_mybonus['col_option'].
|
||||
"<td class=\"colhead\" align=\"center\">".$lang_mybonus['col_points']."</td>".
|
||||
"<td class=\"colhead\" align=\"center\">".$lang_mybonus['col_trade']."</td>".
|
||||
"</tr>");
|
||||
for ($i=1; $i <=9; $i++)
|
||||
for ($i=1; $i <=10; $i++)
|
||||
{
|
||||
$bonusarray = bonusarray($i);
|
||||
if (($i == 7 && $bonusgift_bonus == 'no') || ($i == 8 && ($enablead_advertisement == 'no' || $bonusnoad_advertisement == 'no')))
|
||||
continue;
|
||||
if (
|
||||
($i == 7 && $bonusgift_bonus == 'no')
|
||||
|| ($i == 8 && ($enablead_advertisement == 'no' || $bonusnoad_advertisement == 'no'))
|
||||
|| ($i == 10 && !\App\Models\HitAndRun::getIsEnabled())
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
print("<tr>");
|
||||
print("<form action=\"?action=exchange\" method=\"post\">");
|
||||
print("<td class=\"rowhead_center\"><input type=\"hidden\" name=\"option\" value=\"".$i."\" /><b>".$i."</b></td>");
|
||||
@@ -217,6 +236,7 @@ for ($i=1; $i <=9; $i++)
|
||||
print("</tr>");
|
||||
|
||||
}
|
||||
|
||||
print("</table><br />");
|
||||
?>
|
||||
|
||||
@@ -306,13 +326,12 @@ print($lang_mybonus['text_howto_get_karma_five'].$uploadtorrent_bonus.$lang_mybo
|
||||
|
||||
// Bonus exchange
|
||||
if ($action == "exchange") {
|
||||
if ($_POST["userid"] || $_POST["points"] || $_POST["bonus"] || $_POST["art"]){
|
||||
if (isset($_POST["userid"]) || isset($_POST["points"]) || isset($_POST["bonus"]) || isset($_POST["art"])){
|
||||
write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is trying to cheat at bonus system",'mod');
|
||||
die($lang_mybonus['text_cheat_alert']);
|
||||
}
|
||||
$option = (int)$_POST["option"];
|
||||
$option = intval($_POST["option"] ?? 0);
|
||||
$bonusarray = bonusarray($option);
|
||||
|
||||
$points = $bonusarray['points'];
|
||||
$userid = $CURUSER['id'];
|
||||
$art = $bonusarray['art'];
|
||||
@@ -472,7 +491,19 @@ if ($action == "exchange") {
|
||||
print("<table width=\"97%\"><tr><td class=\"colhead\" align=\"left\" colspan=\"2\"><h1>".$lang_mybonus['text_oups']."</h1></td></tr>");
|
||||
print("<tr><td align=\"left\"></td><td align=\"left\">".$lang_mybonus['text_not_enough_karma']."<br /><br /></td></tr></table>");
|
||||
}
|
||||
}
|
||||
} elseif ($art == 'cancel_hr') {
|
||||
if (empty($_POST['hr_id'])) {
|
||||
stderr("Error","Invalid H&R ID: " . ($_POST['hr_id'] ?? ''), false, false);
|
||||
}
|
||||
try {
|
||||
$bonusRep = new \App\Repositories\BonusRepository();
|
||||
$bonusRep->consumeToCancelHitAndRun($userid, $_POST['hr_id']);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=cancel_hr");
|
||||
} catch (\Exception $exception) {
|
||||
do_log($exception->getMessage(), 'error');
|
||||
stderr('Error', "Something wrong...", false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stdfoot();
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
require "../include/bittorrent.php";
|
||||
dbconn();
|
||||
loggedinorreturn();
|
||||
require_once(get_langfile_path());
|
||||
$userid = $CURUSER['id'];
|
||||
if (get_user_class() >= UC_ADMINISTRATOR && !empty($_GET['userid'])) {
|
||||
$userid = $_GET['userid'];
|
||||
}
|
||||
$userInfo = \App\Models\User::query()->find($userid);
|
||||
if (empty($userInfo)) {
|
||||
stderr('Error', "User not exists.");
|
||||
}
|
||||
|
||||
$pageTitle = $userInfo->username . ' - H&R';
|
||||
stdhead($pageTitle);
|
||||
print("<h1>$pageTitle</h1>");
|
||||
|
||||
$status = $_GET['status'] ?? \App\Models\HitAndRun::STATUS_INSPECTING;
|
||||
$allStatus = \App\Models\HitAndRun::listStatus();
|
||||
$headerFilters = [];
|
||||
foreach ($allStatus as $key => $value) {
|
||||
$headerFilters[] = sprintf('<a href="?status=%s" class="%s"><b>%s</b></a>', $key, $key == $status ? 'faqlink' : '', $value['text']);
|
||||
}
|
||||
|
||||
print("<p>" . implode(' | ', $headerFilters) . "</p>");
|
||||
$q = $_GET['q'] ?? '';
|
||||
$filterForm = <<<FORM
|
||||
<form id="filterForm" action="{$_SERVER['REQUEST_URI']}" method="get">
|
||||
<input id="q" type="text" name="q" value="{$q}" placeholder="{$lang_myhr['th_hr_id']}">
|
||||
<input type="submit">
|
||||
<input type="reset" onclick="document.getElementById('q').value='';document.getElementById('filterForm').submit();">
|
||||
</form>
|
||||
FORM;
|
||||
|
||||
begin_main_frame("", true);
|
||||
|
||||
print $filterForm;
|
||||
|
||||
$rescount = \App\Models\HitAndRun::query()->where('status', $status)->count();
|
||||
list($pagertop, $pagerbottom, $limit, $offset, $pageSize) = pager(50, $rescount, "?status=$status");
|
||||
print("<table width='100%'>");
|
||||
print("<tr>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_hr_id']}</td>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_torrent_name']}</td>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_uploaded']}</td>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_downloaded']}</td>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_share_ratio']}</td>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_seed_time_required']}</td>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_completed_at']}</td>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_ttl']}</td>
|
||||
<td class='colhead' align='center'>{$lang_myhr['th_comment']}</td>
|
||||
</tr>");
|
||||
if ($rescount) {
|
||||
|
||||
$query = \App\Models\HitAndRun::query()
|
||||
->where('uid', $userid)
|
||||
->where('status', $status)
|
||||
->with([
|
||||
'torrent' => function ($query) {$query->select(['id', 'size', 'name']);},
|
||||
'snatch',
|
||||
'user' => function ($query) {$query->select(['id', 'lang']);},
|
||||
'user.language',
|
||||
])
|
||||
->offset($offset)
|
||||
->limit($pageSize)
|
||||
->orderBy('id', 'desc');
|
||||
if (!empty($q)) {
|
||||
$query->where('id', $q);
|
||||
}
|
||||
$list = $query->get();
|
||||
|
||||
foreach($list as $row) {
|
||||
print("<tr>
|
||||
<td class='rowfollow nowrap' align='center'>" . $row->id . "</td>
|
||||
<td class='rowfollow' align='left'><a href='details.php?id=" . $row->torrent_id . "'>" . $row->torrent->name . "</a></td>
|
||||
<td class='rowfollow nowrap' align='center'>" . mksize($row->snatch->uploaded) . "</td>
|
||||
<td class='rowfollow nowrap' align='center'>" . mksize($row->snatch->downloaded) . "</td>
|
||||
<td class='rowfollow nowrap' align='center'>" . get_hr_ratio($row->snatch->uploaded, $row->snatch->downloaded) . "</td>
|
||||
<td class='rowfollow nowrap' align='center'>" . ($row->status == \App\Models\HitAndRun::STATUS_INSPECTING ? mkprettytime(3600 * get_setting('hr.seed_time_minimum') - $row->snatch->seedtime) : '---') . "</td>
|
||||
<td class='rowfollow nowrap' align='center'>" . $row->snatch->completedat->toDateTimeString() . "</td>
|
||||
<td class='rowfollow nowrap' align='center' >" . ($row->status == \App\Models\HitAndRun::STATUS_INSPECTING ? mkprettytime(\Carbon\Carbon::now()->diffInSeconds($row->snatch->completedat->addHours(get_setting('hr.inspect_time')))) : '---') . "</td>
|
||||
<td class='rowfollow nowrap' align='left' style='padding-left: 10px'>" . nl2br($row->comment) . "</td>
|
||||
</tr>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
print("</table>");
|
||||
print($pagerbottom);
|
||||
end_main_frame();
|
||||
stdfoot();
|
||||
|
||||
+4
-2
@@ -91,7 +91,7 @@ elseif ($action == 'savesettings_code') // save database
|
||||
elseif ($action == 'savesettings_bonus') // save bonus
|
||||
{
|
||||
stdhead($lang_settings['head_save_bonus_settings']);
|
||||
$validConfig = array('donortimes','perseeding','maxseeding','tzero','nzero','bzero','l', 'uploadtorrent','uploadsubtitle','starttopic','makepost','addcomment','pollvote','offervote', 'funboxvote','saythanks','receivethanks','funboxreward','onegbupload','fivegbupload','tengbupload', 'ratiolimit','dlamountlimit','oneinvite','customtitle','vipstatus','bonusgift', 'basictax', 'taxpercentage', 'prolinkpoint', 'prolinktime', 'attendance_initial', 'attendance_step', 'attendance_max');
|
||||
$validConfig = array('donortimes','perseeding','maxseeding','tzero','nzero','bzero','l', 'uploadtorrent','uploadsubtitle','starttopic','makepost','addcomment','pollvote','offervote', 'funboxvote','saythanks','receivethanks','funboxreward','onegbupload','fivegbupload','tengbupload', 'ratiolimit','dlamountlimit','oneinvite','customtitle','vipstatus','bonusgift', 'basictax', 'taxpercentage', 'prolinkpoint', 'prolinktime', 'attendance_initial', 'attendance_step', 'attendance_max', 'cancel_hr');
|
||||
GetVar($validConfig);
|
||||
$BONUS = [];
|
||||
foreach($validConfig as $config) {
|
||||
@@ -193,7 +193,7 @@ elseif ($action == 'savesettings_security') // save security
|
||||
elseif ($action == 'savesettings_authority') // save user authority
|
||||
{
|
||||
stdhead($lang_settings['head_save_authority_settings']);
|
||||
$validConfig = array('defaultclass','staffmem','newsmanage','newfunitem','funmanage','sbmanage','pollmanage','applylink', 'linkmanage', 'postmanage','commanage','forummanage','viewuserlist','torrentmanage','torrentsticky', 'torrentonpromotion', 'askreseed', 'viewnfo', 'torrentstructure','sendinvite','viewhistory','topten','log','confilog','userprofile', 'torrenthistory','prfmanage', 'cruprfmanage','uploadsub','delownsub','submanage','updateextinfo', 'viewanonymous','beanonymous','addoffer','offermanage', 'upload','uploadspecial','view_special_torrent','movetorrent','chrmanage','viewinvite', 'buyinvite','seebanned','againstoffer','userbar');
|
||||
$validConfig = array('defaultclass','staffmem','newsmanage','newfunitem','funmanage','sbmanage','pollmanage','applylink', 'linkmanage', 'postmanage','commanage','forummanage','viewuserlist','torrentmanage','torrentsticky', 'torrentonpromotion', 'torrent_hr', 'askreseed', 'viewnfo', 'torrentstructure','sendinvite','viewhistory','topten','log','confilog','userprofile', 'torrenthistory','prfmanage', 'cruprfmanage','uploadsub','delownsub','submanage','updateextinfo', 'viewanonymous','beanonymous','addoffer','offermanage', 'upload','uploadspecial','view_special_torrent','movetorrent','chrmanage','viewinvite', 'buyinvite','seebanned','againstoffer','userbar');
|
||||
GetVar($validConfig);
|
||||
$AUTHORITY = [];
|
||||
foreach($validConfig as $config) {
|
||||
@@ -389,6 +389,7 @@ elseif ($action == 'authoritysettings') //Authority settings
|
||||
tr($lang_settings['row_torrent_management'], $lang_settings['text_minimum_class'].classlist('torrentmanage',$maxclass,$AUTHORITY['torrentmanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_torrent_management_note'], 1);
|
||||
tr($lang_settings['row_torrent_sticky'], $lang_settings['text_minimum_class'].classlist('torrentsticky',$maxclass,$AUTHORITY['torrentsticky']).$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_torrent_sticky_note'],1);
|
||||
tr($lang_settings['row_torrent_on_promotion'], $lang_settings['text_minimum_class'].classlist('torrentonpromotion',$maxclass,$AUTHORITY['torrentonpromotion'] ?? '').$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_torrent_promotion_note'],1);
|
||||
tr($lang_settings['row_torrent_hr'], $lang_settings['text_minimum_class'].classlist('torrent_hr',$maxclass,$AUTHORITY['torrent_hr'] ?? '').$lang_settings['text_default'].get_user_class_name(UC_ADMINISTRATOR,false,true,true).$lang_settings['text_torrent_hr_note'],1);
|
||||
tr($lang_settings['row_ask_for_reseed'], $lang_settings['text_minimum_class'].classlist('askreseed',$maxclass,$AUTHORITY['askreseed']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_ask_for_reseed_note'],1);
|
||||
tr($lang_settings['row_view_nfo'], $lang_settings['text_minimum_class'].classlist('viewnfo',$maxclass,$AUTHORITY['viewnfo']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_view_nfo_note'],1);
|
||||
tr($lang_settings['row_view_torrent_structure'], $lang_settings['text_minimum_class'].classlist('torrentstructure',$maxclass,$AUTHORITY['torrentstructure']).$lang_settings['text_default'].get_user_class_name(UC_ULTIMATE_USER,false,true,true).$lang_settings['text_view_torrent_structure_note'],1);
|
||||
@@ -523,6 +524,7 @@ elseif ($action == 'bonussettings'){
|
||||
tr($lang_settings['row_vip_status'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=vipstatus value='".(isset($BONUS["vipstatus"]) ? $BONUS["vipstatus"] : 8000 )."'>".$lang_settings['text_vip_status_note'], 1);
|
||||
yesorno($lang_settings['row_allow_giving_bonus_gift'], 'bonusgift', $BONUS["bonusgift"], $lang_settings['text_giving_bonus_gift_note']);
|
||||
tr($lang_settings['row_bonus_gift_tax'], $lang_settings['text_system_charges']."<input type='text' style=\"width: 50px\" name='basictax' value='".(isset($BONUS["basictax"]) ? $BONUS["basictax"] : 5 )."'>".$lang_settings['text_bonus_points_plus']."<input type='text' style=\"width: 50px\" name='taxpercentage' value='".(isset($BONUS["taxpercentage"]) ? $BONUS["taxpercentage"] : 10 )."'>".$lang_settings['text_bonus_gift_tax_note'], 1);
|
||||
tr($lang_settings['row_cancel_hr'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=cancel_hr value='".(isset($BONUS["cancel_hr"]) ? $BONUS["cancel_hr"] : \App\Models\BonusLogs::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN )."'>".$lang_settings['text_cancel_hr_note'], 1);
|
||||
echo '<tr><td colspan="2" align="center"><b>签到奖励</b></td></tr>';
|
||||
tr('初始奖励',sprintf('首次签到获得 <input type="number" style="width: 30px" name="attendance_initial" value="%u" min="0" /> 个魔力值。', $attendance_initial_bonus),true);
|
||||
tr('奖励增量',sprintf('每次签到增加 <input type="number" style="width: 30px" name="attendance_step" value="%u" min="0" /> 个魔力值。', $attendance_step_bonus),true);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Vendored
+6
@@ -474,3 +474,9 @@ img.sltbar
|
||||
height:10px;
|
||||
background:url(bar.gif) repeat-x 0 -116px;
|
||||
}
|
||||
img.hitandrun {
|
||||
width: 35px;
|
||||
height: 12px;
|
||||
background: url(icons.gif) no-repeat -100px -171px;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,14 @@ if (!empty($_POST['pt_gen'])) {
|
||||
$updateset[] = "tags = " . array_sum($_POST['tags'] ?? []);
|
||||
$updateset[] = "technical_info = " . sqlesc($_POST['technical_info'] ?? '');
|
||||
|
||||
/**
|
||||
* hr
|
||||
* @since 1.6.0-beta12
|
||||
*/
|
||||
if (isset($_POST['hr']) && isset(\App\Models\Torrent::$hrStatus[$_POST['hr']])) {
|
||||
$updateset[] = "hr = " . sqlesc($_POST['hr']);
|
||||
}
|
||||
|
||||
|
||||
if ($enablenfo_main=='yes'){
|
||||
$nfoaction = $_POST['nfoaction'];
|
||||
|
||||
+2
-2
@@ -872,10 +872,10 @@ if ($count)
|
||||
|
||||
list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "?" . $addparam);
|
||||
if ($allsec == 1 || $enablespecial != 'yes'){
|
||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,tags FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $where $orderby $limit";
|
||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.tags,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $where $orderby $limit";
|
||||
}
|
||||
else{
|
||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,tags FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit";
|
||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.tags,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit";
|
||||
}
|
||||
|
||||
$res = sql_query($query);
|
||||
|
||||
Reference in New Issue
Block a user