mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-20 09:30:49 +08:00
ban/unban torrent send notification
This commit is contained in:
@@ -15,6 +15,7 @@ use App\Models\SearchBox;
|
||||
use App\Models\Snatch;
|
||||
use App\Models\Tag;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\TorrentOperationLog;
|
||||
use App\Models\User;
|
||||
use App\Repositories\AgentAllowRepository;
|
||||
use App\Repositories\AttendanceRepository;
|
||||
@@ -77,12 +78,12 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$a = [];
|
||||
if ($a) {
|
||||
echo 'Bad';
|
||||
} else {
|
||||
echo 'OK';
|
||||
}
|
||||
$arr = [
|
||||
'uid' => 1,
|
||||
'torrent_id' => 1,
|
||||
'action_type' => 'ban',
|
||||
];
|
||||
TorrentOperationLog::query()->create($arr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class StaffMessage extends NexusModel
|
||||
{
|
||||
protected $table = 'staffmessages';
|
||||
|
||||
protected $fillable = [
|
||||
'sender', 'added', 'subject', 'msg', 'answeredby', 'answered', 'answer'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'added' => 'datetime',
|
||||
];
|
||||
|
||||
public function send_user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'sender')->withDefault(['id' => 0, 'username' => 'System']);
|
||||
}
|
||||
|
||||
public function answer_user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'answeredby');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class TorrentOperationLog extends NexusModel
|
||||
{
|
||||
protected $table = 'torrent_operation_logs';
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = ['uid', 'torrent_id', 'action_type', 'comment'];
|
||||
|
||||
const ACTION_TYPE_BAN = 'ban';
|
||||
const ACTION_TYPE_CANCEL_BAN = 'cancel_ban';
|
||||
|
||||
public static array $actionTypes = [
|
||||
self::ACTION_TYPE_BAN => ['text' => 'Ban'],
|
||||
self::ACTION_TYPE_CANCEL_BAN => ['text' => 'Cancel ban'],
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'uid')->select(User::$commonFields);
|
||||
}
|
||||
|
||||
public function torrent()
|
||||
{
|
||||
return $this->belongsTo(Torrent::class, 'torrent_id')->select(Torrent::$commentFields);
|
||||
}
|
||||
|
||||
|
||||
public static function add(array $params)
|
||||
{
|
||||
$log = self::query()->create($params);
|
||||
if (!in_array($params['action_type'], [self::ACTION_TYPE_CANCEL_BAN, self::ACTION_TYPE_BAN])) {
|
||||
do_log("actionType: {$params['action_type']}, do not notify");
|
||||
return $log;
|
||||
}
|
||||
self::notifyUser($log);
|
||||
return $log;
|
||||
}
|
||||
|
||||
private static function notifyUser(self $torrentOperationLog)
|
||||
{
|
||||
$actionType = $torrentOperationLog->action_type;
|
||||
$receiver = $torrentOperationLog->torrent->user;
|
||||
$locale = $receiver->locale;
|
||||
$subject = nexus_trans("torrent.operation_log.$actionType.notify_subject", [], $locale);
|
||||
$msg = nexus_trans("torrent.operation_log.$actionType.notify_msg", [
|
||||
'torrent_name' => $torrentOperationLog->torrent->name,
|
||||
'detail_url' => sprintf('%s/details.php?id=%s', getSchemeAndHttpHost(), $torrentOperationLog->torrent_id),
|
||||
'operator' => $torrentOperationLog->user->username,
|
||||
'reason' => $torrentOperationLog->comment,
|
||||
], $locale);
|
||||
$message = [
|
||||
'sender' => 0,
|
||||
'receiver' => $receiver->id,
|
||||
'subject' => $subject,
|
||||
'msg' => $msg,
|
||||
'added' => now(),
|
||||
];
|
||||
Message::query()->insert($message);
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,7 @@ class ADVERTISEMENT{
|
||||
global $Cache;
|
||||
if (!$arr = $Cache->get_value('current_ad_array'))
|
||||
{
|
||||
$arr = [];
|
||||
$now = date("Y-m-d H:i:s");
|
||||
$validpos = $this->get_validpos();
|
||||
foreach ($validpos as $pos)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('torrent_operation_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('torrent_id')->index();
|
||||
$table->integer('uid')->index();
|
||||
$table->string('action_type');
|
||||
$table->string('comment')->default('');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('torrent_operation_logs');
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.15');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-06-12');
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.16');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-06-14');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
+19
-18
@@ -2629,23 +2629,23 @@ else {
|
||||
</td>
|
||||
<td class="bottom" align="right"><span class="medium"><?php echo $lang_functions['text_the_time_is_now'] ?><?php echo $datum['hours'].":".$datum['minutes']?><br />
|
||||
<?php
|
||||
if (get_user_class() >= $staffmem_class){
|
||||
$totalreports = $Cache->get_value('staff_report_count');
|
||||
if ($totalreports == ""){
|
||||
$totalreports = get_row_count("reports");
|
||||
$Cache->cache_value('staff_report_count', $totalreports, 900);
|
||||
}
|
||||
$totalsm = $Cache->get_value('staff_message_count');
|
||||
if ($totalsm == ""){
|
||||
$totalsm = get_row_count("staffmessages");
|
||||
$Cache->cache_value('staff_message_count', $totalsm, 900);
|
||||
}
|
||||
$totalcheaters = $Cache->get_value('staff_cheater_count');
|
||||
if ($totalcheaters == ""){
|
||||
$totalcheaters = get_row_count("cheaters");
|
||||
$Cache->cache_value('staff_cheater_count', $totalcheaters, 900);
|
||||
}
|
||||
print("<a href=\"cheaterbox.php\"><img class=\"cheaterbox\" alt=\"cheaterbox\" title=\"".$lang_functions['title_cheaterbox']."\" src=\"pic/trans.gif\" /> </a>".$totalcheaters." <a href=\"reports.php\"><img class=\"reportbox\" alt=\"reportbox\" title=\"".$lang_functions['title_reportbox']."\" src=\"pic/trans.gif\" /> </a>".$totalreports." <a href=\"staffbox.php\"><img class=\"staffbox\" alt=\"staffbox\" title=\"".$lang_functions['title_staffbox']."\" src=\"pic/trans.gif\" /> </a>".$totalsm." ");
|
||||
if (get_user_class() >= $staffmem_class) {
|
||||
$totalreports = $Cache->get_value('staff_report_count');
|
||||
if ($totalreports == ""){
|
||||
$totalreports = get_row_count("reports");
|
||||
$Cache->cache_value('staff_report_count', $totalreports, 900);
|
||||
}
|
||||
$totalsm = $Cache->get_value('staff_message_count');
|
||||
if ($totalsm == ""){
|
||||
$totalsm = get_row_count("staffmessages");
|
||||
$Cache->cache_value('staff_message_count', $totalsm, 900);
|
||||
}
|
||||
$totalcheaters = $Cache->get_value('staff_cheater_count');
|
||||
if ($totalcheaters == ""){
|
||||
$totalcheaters = get_row_count("cheaters");
|
||||
$Cache->cache_value('staff_cheater_count', $totalcheaters, 900);
|
||||
}
|
||||
print("<a href=\"cheaterbox.php\"><img class=\"cheaterbox\" alt=\"cheaterbox\" title=\"".$lang_functions['title_cheaterbox']."\" src=\"pic/trans.gif\" /> </a>".$totalcheaters." <a href=\"reports.php\"><img class=\"reportbox\" alt=\"reportbox\" title=\"".$lang_functions['title_reportbox']."\" src=\"pic/trans.gif\" /> </a>".$totalreports." <a href=\"staffbox.php\"><img class=\"staffbox\" alt=\"staffbox\" title=\"".$lang_functions['title_staffbox']."\" src=\"pic/trans.gif\" /> </a>".$totalsm." ");
|
||||
}
|
||||
|
||||
print("<a href=\"messages.php\">".$inboxpic."</a> ".($messages ? $messages." (".$unread.$lang_functions['text_message_new'].")" : "0"));
|
||||
@@ -4067,7 +4067,8 @@ function get_category_row($catid = NULL)
|
||||
{
|
||||
global $Cache;
|
||||
static $rows;
|
||||
if (!$rows && !$rows = (array)$Cache->get_value('category_content')){
|
||||
if (!$rows && !$rows = $Cache->get_value('category_content')){
|
||||
$rows = [];
|
||||
$res = sql_query("SELECT categories.*, searchbox.name AS catmodename FROM categories LEFT JOIN searchbox ON categories.mode=searchbox.id");
|
||||
while($row = mysql_fetch_array($res)) {
|
||||
$rows[$row['id']] = $row;
|
||||
|
||||
@@ -67,6 +67,7 @@ $lang_edit = array
|
||||
'text_team' => "制作组",
|
||||
'text_audio_codec' => "音频编码",
|
||||
'row_content' => "内容",
|
||||
'ban_reason_label' => '原因',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -66,7 +66,8 @@ $lang_edit = array
|
||||
'row_check' => "勾選",
|
||||
'text_team' => "製作組",
|
||||
'text_audio_codec' => "音頻編碼",
|
||||
'row_content' => "內容"
|
||||
'row_content' => "內容",
|
||||
'ban_reason_label' => '原因',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -67,6 +67,7 @@ $lang_edit = array
|
||||
'text_team' => "Group",
|
||||
'text_audio_codec' => "Audio Codec",
|
||||
'row_content' => "Content",
|
||||
'ban_reason_label' => 'Reason',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
+4
-4
@@ -28,12 +28,11 @@ $owned = 1;
|
||||
else $owned = 0;
|
||||
|
||||
$settingMain = get_setting('main');
|
||||
|
||||
if (!$row) {
|
||||
stderr($lang_details['std_error'], $lang_details['std_no_torrent_id']);
|
||||
} elseif (
|
||||
($row['banned'] == 'yes' && get_user_class() < $seebanned_class)
|
||||
|| !can_access_torrent($row)
|
||||
($row['banned'] == 'yes' && get_user_class() < $seebanned_class && $row['owner'] != $CURUSER['id'])
|
||||
|| (!can_access_torrent($row) && $row['owner'] != $CURUSER['id'])
|
||||
) {
|
||||
permissiondenied();
|
||||
} else {
|
||||
@@ -69,10 +68,11 @@ if (!$row) {
|
||||
if (isset($_GET["returnto"]))
|
||||
print("<p><b>".$lang_details['text_go_back'] . "<a href=\"".htmlspecialchars($_GET["returnto"])."\">" . $lang_details['text_whence_you_came']."</a></b></p>");
|
||||
}
|
||||
$banned_torrent = ($row["banned"] == 'yes' ? " <b>(<font class=\"striking\">".$lang_functions['text_banned']."</font>)</b>" : "");
|
||||
$sp_torrent = get_torrent_promotion_append($row['sp_state'],'word', false, '', 0, '', $row['__ignore_global_sp_state'] ?? false);
|
||||
$sp_torrent_sub = get_torrent_promotion_append_sub($row['sp_state'],"",true,$row['added'], $row['promotion_time_type'], $row['promotion_until'], $row['__ignore_global_sp_state'] ?? false);
|
||||
$hrImg = get_hr_img($row);
|
||||
$s=htmlspecialchars($row["name"]).($sp_torrent ? " ".$sp_torrent : "").($sp_torrent_sub) . $hrImg;
|
||||
$s=htmlspecialchars($row["name"]).$banned_torrent.($sp_torrent ? " ".$sp_torrent : "").($sp_torrent_sub) . $hrImg;
|
||||
print("<h1 align=\"center\" id=\"top\">".$s."</h1>\n");
|
||||
print("<table width=\"97%\" cellspacing=\"0\" cellpadding=\"5\">\n");
|
||||
|
||||
|
||||
+38
-2
@@ -147,9 +147,45 @@ else {
|
||||
|
||||
tr($lang_edit['row_content'],$team_select,1);
|
||||
}
|
||||
// tr($lang_functions['text_tags'], torrentTags($row['tags'], 'checkbox'), 1);
|
||||
tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox($tagIdArr), 1);
|
||||
tr($lang_edit['row_check'], "<input type=\"checkbox\" name=\"visible\"" . ($row["visible"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" /> ".$lang_edit['checkbox_visible']." ".(get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"anonymous\"" . ($row["anonymous"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_anonymous_note']." " : "").(get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"banned\"" . (($row["banned"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"yes\" /> ".$lang_edit['checkbox_banned'] : ""), 1);
|
||||
|
||||
$rowChecks = [];
|
||||
if (get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class) {
|
||||
$rowChecks[] = "<label><input type=\"checkbox\" name=\"anonymous\"" . ($row["anonymous"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_anonymous_note']."</label>";
|
||||
}
|
||||
if (get_user_class() >= $torrentmanage_class) {
|
||||
array_unshift($rowChecks, "<label><input type=\"checkbox\" name=\"visible\"" . ($row["visible"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_visible']."</label>");
|
||||
$rowChecks[] = "<label><input type=\"checkbox\" name=\"banned\"" . (($row["banned"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"yes\" />".$lang_edit['checkbox_banned']."</label>";
|
||||
$banLog = \App\Models\TorrentOperationLog::query()->where('torrent_id', $row['id'])->where('action_type', \App\Models\TorrentOperationLog::ACTION_TYPE_BAN)->orderBy('id', 'desc')->first();
|
||||
$banReasonDisplay = "none";
|
||||
$banReasonReadonly = "";
|
||||
if ($row['banned'] == 'yes') {
|
||||
$banReasonDisplay = 'inline-block';
|
||||
$banReasonReadonly = " readonly disabled";
|
||||
}
|
||||
$rowChecks[] = sprintf(
|
||||
'<span id="ban-reason-box" style="display: %s">%s:<input type="text" name="ban_reason" value="%s" style="width: 300px"%s/></span>',
|
||||
$banReasonDisplay, $lang_edit['ban_reason_label'], $row['banned'] == 'yes' && $banLog ? $banLog->comment : '', $banReasonReadonly
|
||||
);
|
||||
$js = <<<JS
|
||||
let banReasonBox = jQuery('#ban-reason-box')
|
||||
jQuery('input[name=banned]').on("change", function () {
|
||||
let _this = jQuery(this)
|
||||
let checked = _this.prop('checked')
|
||||
if (checked) {
|
||||
banReasonBox.show()
|
||||
} else {
|
||||
banReasonBox.hide()
|
||||
}
|
||||
})
|
||||
JS;
|
||||
\Nexus\Nexus::js($js, 'footer', false);
|
||||
|
||||
}
|
||||
if (!empty($rowChecks)) {
|
||||
tr($lang_edit['row_check'], implode(' ', $rowChecks), 1);
|
||||
}
|
||||
|
||||
if (get_user_class()>= $torrentsticky_class || (get_user_class() >= $torrentmanage_class && $CURUSER["picker"] == 'yes')){
|
||||
$pickcontent = $pickcontentPrefix = "";
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ header("Pragma: no-cache" );
|
||||
//header("Content-Type: text/xml; charset=utf-8");
|
||||
function maketable($res, $mode = 'seeding')
|
||||
{
|
||||
global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main;
|
||||
global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main, $lang_functions;
|
||||
switch ($mode)
|
||||
{
|
||||
case 'uploaded': {
|
||||
@@ -99,6 +99,7 @@ function maketable($res, $mode = 'seeding')
|
||||
$catname = htmlspecialchars($arr["catname"]);
|
||||
|
||||
$sphighlight = get_torrent_bg_color($arr['sp_state']);
|
||||
$banned_torrent = ($arr["banned"] == 'yes' ? " <b>(<font class=\"striking\">".$lang_functions['text_banned']."</font>)</b>" : "");
|
||||
$sp_torrent = get_torrent_promotion_append($arr['sp_state'], '', false, '', 0, '', $arr['__ignore_global_sp_state'] ?? false);
|
||||
//Total size
|
||||
if ($showtotalsize){
|
||||
@@ -124,7 +125,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 . $hrImg .($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>". $banned_torrent . $sp_torrent . $hrImg .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
|
||||
//size
|
||||
if ($showsize)
|
||||
$ret .= "<td class=\"rowfollow\" align=\"center\">". mksize_compact($arr['size'])."</td>";
|
||||
@@ -183,7 +184,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, torrents.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__);
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, categories.name AS catname, categories.image, category, sp_state, size, torrents.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)
|
||||
{
|
||||
@@ -195,7 +196,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,torrents.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();
|
||||
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, categories.name as catname,size,torrents.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){
|
||||
list($torrentlist, $total_size) = maketable ( $res, 'seeding' );
|
||||
@@ -206,7 +207,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,torrents.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();
|
||||
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, categories.name as catname,size,torrents.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){
|
||||
list($torrentlist, $total_size) = maketable ( $res, 'leeching' );
|
||||
@@ -217,7 +218,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, torrents.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();
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, categories.image, category, sp_state, size, torrents.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)
|
||||
{
|
||||
@@ -229,7 +230,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, torrents.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();
|
||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, categories.name AS catname, categories.image, category, sp_state, size, torrents.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)
|
||||
{
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ if ($action == "answermessage") {
|
||||
?>
|
||||
<form method="post" id="compose" name="message" action="?action=takeanswer">
|
||||
<?php if ($_GET["returnto"] || $_SERVER["HTTP_REFERER"]) { ?>
|
||||
<input type=hidden name=returnto value="<?php echo htmlspecialchars($_GET["returnto"]) ? htmlspecialchars($_GET["returnto"]) : htmlspecialchars($_SERVER["HTTP_REFERER"])?>">
|
||||
<input type=hidden name=returnto value="<?php echo htmlspecialchars($_GET["returnto"] ?? '') ? htmlspecialchars($_GET["returnto"]) : htmlspecialchars($_SERVER["HTTP_REFERER"])?>">
|
||||
<?php } ?>
|
||||
<input type=hidden name=receiver value=<?php echo $receiver?>>
|
||||
<input type=hidden name=answeringto value=<?php echo $answeringto?>>
|
||||
|
||||
+31
-8
@@ -19,7 +19,7 @@ if (!$id)
|
||||
die();
|
||||
|
||||
|
||||
$res = sql_query("SELECT category, owner, filename, save_as, anonymous, picktype, picktime, added, pt_gen FROM torrents WHERE id = ".mysql_real_escape_string($id));
|
||||
$res = sql_query("SELECT id, category, owner, filename, save_as, anonymous, picktype, picktime, added, pt_gen, banned FROM torrents WHERE id = ".mysql_real_escape_string($id));
|
||||
$row = mysql_fetch_array($res);
|
||||
$torrentAddedTimeString = $row['added'];
|
||||
if (!$row)
|
||||
@@ -52,7 +52,7 @@ if (!empty($_POST['pt_gen'])) {
|
||||
}
|
||||
|
||||
$updateset[] = "technical_info = " . sqlesc($_POST['technical_info'] ?? '');
|
||||
|
||||
$torrentOperationLog = [];
|
||||
/**
|
||||
* hr
|
||||
* @since 1.6.0-beta12
|
||||
@@ -106,16 +106,23 @@ $updateset[] = "standard = " . sqlesc(intval($_POST["standard_sel"] ?? 0));
|
||||
$updateset[] = "processing = " . sqlesc(intval($_POST["processing_sel"] ?? 0));
|
||||
$updateset[] = "team = " . sqlesc(intval($_POST["team_sel"] ?? 0));
|
||||
$updateset[] = "audiocodec = " . sqlesc(intval($_POST["audiocodec_sel"] ?? 0));
|
||||
|
||||
if (get_user_class() >= $torrentmanage_class) {
|
||||
if (!empty($_POST["banned"])) {
|
||||
//Ban
|
||||
$updateset[] = "banned = 'yes'";
|
||||
$_POST["visible"] = 0;
|
||||
}
|
||||
else
|
||||
$updateset[] = "banned = 'no'";
|
||||
$_POST['visible'] = 0;
|
||||
if ($row['banned'] == 'no') {
|
||||
$torrentOperationLog['action_type'] = \App\Models\TorrentOperationLog::ACTION_TYPE_BAN;
|
||||
}
|
||||
} else {
|
||||
//Cancel ban
|
||||
$updateset[] = "banned = 'no'";
|
||||
if ($row['banned'] == 'yes') {
|
||||
$torrentOperationLog['action_type'] = \App\Models\TorrentOperationLog::ACTION_TYPE_CANCEL_BAN;
|
||||
}
|
||||
}
|
||||
}
|
||||
$updateset[] = "visible = '" . (!empty($_POST["visible"]) ? "yes" : "no") . "'";
|
||||
$updateset[] = "visible = '" . (isset($_POST["visible"]) && $_POST["visible"] ? "yes" : "no") . "'";
|
||||
if(get_user_class()>=$torrentonpromotion_class)
|
||||
{
|
||||
if(!isset($_POST["sel_spstate"]) || $_POST["sel_spstate"] == 1)
|
||||
@@ -260,6 +267,22 @@ else
|
||||
$searchRep = new \App\Repositories\SearchRepository();
|
||||
$searchRep->updateTorrent($id);
|
||||
|
||||
if (!empty($torrentOperationLog['action_type'])) {
|
||||
$torrentOperationLog['uid'] = $CURUSER['id'];
|
||||
$torrentOperationLog['torrent_id'] = $row['id'];
|
||||
$torrentOperationLog['comment'] = $_POST['ban_reason'] ?? '';
|
||||
\App\Models\TorrentOperationLog::add($torrentOperationLog);
|
||||
}
|
||||
if ($row['banned'] == 'yes' && $row['owner'] == $CURUSER['id']) {
|
||||
$torrentUrl = sprintf('%s/details.php?id=%s', getSchemeAndHttpHost(), $row['id']);
|
||||
\App\Models\StaffMessage::query()->insert([
|
||||
'sender' => $CURUSER['id'],
|
||||
'subject' => nexus_trans('torrent.owner_update_torrent_subject', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]),
|
||||
'msg' => nexus_trans('torrent.owner_update_torrent_msg', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]),
|
||||
'added' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
$returl = "details.php?id=$id&edited=1";
|
||||
if (isset($_POST["returnto"]))
|
||||
$returl = $_POST["returnto"];
|
||||
|
||||
@@ -44,4 +44,18 @@ return [
|
||||
'claim_number_reach_user_maximum' => 'The maximum number of user is reached',
|
||||
'claim_number_reach_torrent_maximum' => 'The maximum number of torrent is reached',
|
||||
'claim_disabled' => 'Claim is disabled',
|
||||
'operation_log' => [
|
||||
\App\Models\TorrentOperationLog::ACTION_TYPE_BAN => [
|
||||
'type_text' => 'Banned',
|
||||
'notify_subject' => 'Torrent was banned',
|
||||
'notify_msg' => 'Your torrent:[url=:detail_url]:torrent_name[/url] was banned by :operator, Reason: :reason',
|
||||
],
|
||||
\App\Models\TorrentOperationLog::ACTION_TYPE_CANCEL_BAN => [
|
||||
'type_text' => 'Cancel banned',
|
||||
'notify_subject' => 'Torrent was unbanned',
|
||||
'notify_msg' => 'Your torrent: [url=:detail_url]:torrent_name[/url] unbanned by :operator',
|
||||
]
|
||||
],
|
||||
'owner_update_torrent_subject' => 'Banned torrent have been updated',
|
||||
'owner_update_torrent_msg' => 'Torrent:[url=:detail_url]:torrent_name[/url] has been updated by the owner, you can check if it meets the requirements and cancel the ban',
|
||||
];
|
||||
|
||||
@@ -44,4 +44,18 @@ return [
|
||||
'claim_number_reach_user_maximum' => '认领达到人数上限',
|
||||
'claim_number_reach_torrent_maximum' => '认领达到种子数上限',
|
||||
'claim_disabled' => '认领未启用',
|
||||
'operation_log' => [
|
||||
\App\Models\TorrentOperationLog::ACTION_TYPE_BAN => [
|
||||
'type_text' => '禁止',
|
||||
'notify_subject' => '种子被禁止',
|
||||
'notify_msg' => '你的种子:[url=:detail_url]:torrent_name[/url] 被 :operator 禁止,原因::reason',
|
||||
],
|
||||
\App\Models\TorrentOperationLog::ACTION_TYPE_CANCEL_BAN => [
|
||||
'type_text' => '取消禁止',
|
||||
'notify_subject' => '种子取消禁止',
|
||||
'notify_msg' => '你的种子:[url=:detail_url]:torrent_name[/url] 被 :operator 取消禁止',
|
||||
]
|
||||
],
|
||||
'owner_update_torrent_subject' => '被禁种子已更新',
|
||||
'owner_update_torrent_msg' => '种子:[url=:detail_url]:torrent_name[/url] 已被作者更新,可以检查是否符合要求并取消禁止',
|
||||
];
|
||||
|
||||
@@ -44,4 +44,18 @@ return [
|
||||
'claim_number_reach_user_maximum' => '認領達到人數上限',
|
||||
'claim_number_reach_torrent_maximum' => '認領達到種子數上限',
|
||||
'claim_disabled' => '認領未啟用',
|
||||
'operation_log' => [
|
||||
\App\Models\TorrentOperationLog::ACTION_TYPE_BAN => [
|
||||
'type_text' => '禁止',
|
||||
'notify_subject' => '種子被禁止',
|
||||
'notify_msg' => '你的種子:[url=:detail_url]:torrent_name[/url] 被 :operator 禁止,原因::reason',
|
||||
],
|
||||
\App\Models\TorrentOperationLog::ACTION_TYPE_CANCEL_BAN => [
|
||||
'type_text' => '取消禁止',
|
||||
'notify_subject' => '種子取消禁止',
|
||||
'notify_msg' => '你的種子:[url=:detail_url]:torrent_name[/url] 被 :operator 取消禁止',
|
||||
]
|
||||
],
|
||||
'owner_update_torrent_subject' => '被禁種子已更新',
|
||||
'owner_update_torrent_msg' => '種子:[url=:detail_url]:torrent_name[/url] 已被作者更新,可以檢查是否符合要求並取消禁止',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user