fix warning

This commit is contained in:
xiaomlove
2021-05-14 11:04:03 +08:00
parent 6d3068eb8c
commit 6c85176e2f
6 changed files with 14 additions and 15 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ class User extends Authenticatable
public function updateWithModComment(array $update, $modComment) public function updateWithModComment(array $update, $modComment)
{ {
if (!$this->exists) { if (!$this->exists) {
throw new \RuntimeException('User not exists!'); throw new \RuntimeException('This mehtod only works when user exists!');
} }
$update['modcomment'] = DB::raw("concat_ws('\n', $modComment, modcomment)"); $update['modcomment'] = DB::raw("concat_ws('\n', $modComment, modcomment)");
return $this->update($update); return $this->update($update);
+3 -3
View File
@@ -348,7 +348,7 @@ function docleanup($forceAll = 0, $printProgress = false) {
$res = sql_query("SELECT id, seeders, leechers, comments FROM torrents") or sqlerr(__FILE__, __LINE__); $res = sql_query("SELECT id, seeders, leechers, comments FROM torrents") or sqlerr(__FILE__, __LINE__);
while ($row = mysql_fetch_assoc($res)) { while ($row = mysql_fetch_assoc($res)) {
$id = $row["id"]; $id = $row["id"];
$torr = $torrents[$id]; $torr = $torrents[$id] ?? [];
foreach ($fields as $field) { foreach ($fields as $field) {
if (!isset($torr[$field])) if (!isset($torr[$field]))
$torr[$field] = 0; $torr[$field] = 0;
@@ -924,9 +924,9 @@ function docleanup($forceAll = 0, $printProgress = false) {
if (count($delids)) if (count($delids))
sql_query("DELETE FROM files WHERE torrent IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__); sql_query("DELETE FROM files WHERE torrent IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
} while (0); } while (0);
$log = "delete torrents that doesn't exist any more";
do_log($log);
if ($printProgress) { if ($printProgress) {
$log = "delete torrents that doesn't exist any more";
do_log($log);
printProgress($log); printProgress($log);
} }
+1 -1
View File
@@ -2802,7 +2802,7 @@ function deletetorrent($id) {
foreach(array("peers", "files", "comments") as $x) { foreach(array("peers", "files", "comments") as $x) {
sql_query("DELETE FROM $x WHERE torrent = ".mysql_real_escape_string($id)); sql_query("DELETE FROM $x WHERE torrent = ".mysql_real_escape_string($id));
} }
unlink("$torrent_dir/$id.torrent"); unlink(getFullDirectory("$torrent_dir/$id.torrent"));
} }
function pager($rpp, $count, $href, $opts = array(), $pagename = "page") { function pager($rpp, $count, $href, $opts = array(), $pagename = "page") {
+2 -3
View File
@@ -33,7 +33,6 @@ $rt = intval($_POST["reasontype"] ?? 0);
if (!is_int($rt) || $rt < 1 || $rt > 5) if (!is_int($rt) || $rt < 1 || $rt > 5)
bark($lang_delete['std_invalid_reason']."$rt."); bark($lang_delete['std_invalid_reason']."$rt.");
$r = $_POST["r"];
$reason = $_POST["reason"]; $reason = $_POST["reason"];
if ($rt == 1) if ($rt == 1)
@@ -58,9 +57,9 @@ else
deletetorrent($id); deletetorrent($id);
if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) { if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) {
write_log("Torrent $id ($row[name]) was deleted by its anonymous uploader ($reasonstr)",'normal'); write_log("Torrent $id ({$row['name']}) was deleted by its anonymous uploader ($reasonstr)",'normal');
} else { } else {
write_log("Torrent $id ($row[name]) was deleted by $CURUSER[username] ($reasonstr)",'normal'); write_log("Torrent $id ({$row['name']}) was deleted by {$CURUSER['username']} ($reasonstr)",'normal');
} }
//===remove karma //===remove karma
+1 -1
View File
@@ -282,7 +282,7 @@ else {
{ {
$dispname=substr($dispname, 0, $max_lenght_of_torrent_name) . ".."; $dispname=substr($dispname, 0, $max_lenght_of_torrent_name) . "..";
} }
$other_source_info = $other_medium_info = $other_codec_info = $other_standard_info = $other_processing_info = '';
if (isset($copy_row["source_name"])) if (isset($copy_row["source_name"]))
$other_source_info = $copy_row['source_name'].", "; $other_source_info = $copy_row['source_name'].", ";
if (isset($copy_row["medium_name"])) if (isset($copy_row["medium_name"]))
+1 -1
View File
@@ -666,7 +666,7 @@ $wherebase = $wherea;
$search_area = 0; $search_area = 0;
if (isset($searchstr)) if (isset($searchstr))
{ {
if (!$_GET['notnewword']){ if (!isset($_GET['notnewword']) || !$_GET['notnewword']){
insert_suggest($searchstr, $CURUSER['id']); insert_suggest($searchstr, $CURUSER['id']);
$notnewword=""; $notnewword="";
} }