improve delete subtitles

This commit is contained in:
xiaomlove
2022-05-14 16:01:28 +08:00
parent d1d672e246
commit eae3d202ce
+6 -5
View File
@@ -210,14 +210,15 @@ if (get_user_class() >= $delownsub_class)
if ($sure == 1) if ($sure == 1)
{ {
$reason = $_POST["reason"]; $reason = $_POST["reason"];
sql_query("DELETE FROM subs WHERE id=$delete") or sqlerr(__FILE__, __LINE__); $filename = getFullDirectory("$SUBSPATH/$a[torrent_id]/$a[id].$a[ext]");
if (!@unlink("$SUBSPATH/$a[torrent_id]/$a[id].$a[ext]")) do_log("Going to delete subtitle: $filename ...");
{ if (!@unlink($filename)) {
do_log("Delete subtitle: $filename fail.", 'error');
stdmsg($lang_subtitles['std_error'], $lang_subtitles['std_this_file']."$a[filename]".$lang_subtitles['std_is_invalid']); stdmsg($lang_subtitles['std_error'], $lang_subtitles['std_this_file']."$a[filename]".$lang_subtitles['std_is_invalid']);
stdfoot(); stdfoot();
die; die;
} } else {
else { sql_query("DELETE FROM subs WHERE id=$delete") or sqlerr(__FILE__, __LINE__);
KPS("-",$uploadsubtitle_bonus,$a["uppedby"]); //subtitle uploader loses bonus for deleted subtitle KPS("-",$uploadsubtitle_bonus,$a["uppedby"]); //subtitle uploader loses bonus for deleted subtitle
} }
if ($CURUSER['id'] != $a['uppedby']){ if ($CURUSER['id'] != $a['uppedby']){