finish elastic

This commit is contained in:
xiaomlove
2022-03-26 16:09:39 +08:00
parent 0bc1e2f9d3
commit d15a837188
8 changed files with 118 additions and 38 deletions
+8 -5
View File
@@ -3,24 +3,27 @@ require "../include/bittorrent.php";
dbconn();
//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");
$torrentid = intval($_GET['torrentid'] ?? 0);
if(isset($CURUSER))
{
$searchRep = new \App\Repositories\SearchRepository();
$res_bookmark = sql_query("SELECT * FROM bookmarks WHERE torrentid=" . sqlesc($torrentid) . " AND userid=" . sqlesc($CURUSER['id']));
if (mysql_num_rows($res_bookmark) == 1){
$bookmarkResult = mysql_fetch_assoc($res_bookmark);
$searchRep->deleteBookmark($bookmarkResult['id']);
sql_query("DELETE FROM bookmarks WHERE torrentid=" . sqlesc($torrentid) . " AND userid=" . sqlesc($CURUSER['id'])) or sqlerr(__FILE__,__LINE__);
$Cache->delete_value('user_'.$CURUSER['id'].'_bookmark_array');
echo "deleted";
}
else{
} else {
sql_query("INSERT INTO bookmarks (torrentid, userid) VALUES (" . sqlesc($torrentid) . "," . sqlesc($CURUSER['id']) . ")") or sqlerr(__FILE__,__LINE__);
$Cache->delete_value('user_'.$CURUSER['id'].'_bookmark_array');
$searchRep->addBookmark(mysql_insert_id());
echo "added";
}
}
+5 -1
View File
@@ -53,7 +53,11 @@ else
bark($lang_delete['std_enter_reason']);
$reasonstr = trim($reason[3]);
}
$searchRep = new \App\Repositories\SearchRepository();
$deleteEsResult = $searchRep->deleteTorrent($id);
if ($deleteEsResult === false) {
bark('Delete es fail.');
}
deletetorrent($id);
if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) {
+5
View File
@@ -32,6 +32,11 @@ if (!$sure)
stderr($lang_fastdelete['std_delete_torrent'], $lang_fastdelete['std_delete_torrent_note']."<a class=altlink href=fastdelete.php?id=$id&sure=1>".$lang_fastdelete['std_here_if_sure'],false);
}
$searchRep = new \App\Repositories\SearchRepository();
$deleteEsResult = $searchRep->deleteTorrent($id);
if ($deleteEsResult === false) {
bark('Delete es fail.');
}
deletetorrent($id);
KPS("-",$uploadtorrent_bonus,$row["owner"]);
if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) {
+4 -1
View File
@@ -243,7 +243,10 @@ else
{
write_log("Torrent $id ($name) was edited by {$CURUSER['username']}, Mod Edit" . $pick_info . $place_info);
}
\App\Events\TorrentUpdated::dispatch($id);
$searchRep = new \App\Repositories\SearchRepository();
$searchRep->updateTorrent($id);
$returl = "details.php?id=$id&edited=1";
if (isset($_POST["returnto"]))
$returl = $_POST["returnto"];
+2 -1
View File
@@ -372,7 +372,8 @@ KPS("+",$uploadtorrent_bonus,$CURUSER["id"]);
write_log("Torrent $id ($torrent) was uploaded by $anon");
\App\Events\TorrentUpdated::dispatch($id);
$searchRep = new \App\Repositories\SearchRepository();
$searchRep->addTorrent($id);
//===notify people who voted on offer thanks CoLdFuSiOn :)
if ($is_offer)