diff --git a/include/cleanup.php b/include/cleanup.php index 769481d6..e18205d1 100644 --- a/include/cleanup.php +++ b/include/cleanup.php @@ -967,6 +967,9 @@ function docleanup($forceAll = 0, $printProgress = false) { } $log = 'Full cleanup is done'; do_log($log); + if ($printProgress) { + printProgress($log); + } return $log; } ?> diff --git a/include/functions.php b/include/functions.php index c946751e..344cfdc4 100644 --- a/include/functions.php +++ b/include/functions.php @@ -35,20 +35,20 @@ function get_langfile_path($script_name ="", $target = false, $lang_folder = "") function get_row_count($table, $suffix = "") { $r = sql_query("SELECT COUNT(*) FROM $table $suffix") or sqlerr(__FILE__, __LINE__); - $a = mysql_fetch_row($r) or die(mysql_error()); + $a = mysql_fetch_row($r); return $a[0]; } function get_row_sum($table, $field, $suffix = "") { $r = sql_query("SELECT SUM($field) FROM $table $suffix") or sqlerr(__FILE__, __LINE__); - $a = mysql_fetch_row($r) or die(mysql_error()); + $a = mysql_fetch_row($r); return $a[0]; } function get_single_value($table, $field, $suffix = ""){ $r = sql_query("SELECT $field FROM $table $suffix LIMIT 1") or sqlerr(__FILE__, __LINE__); - $a = mysql_fetch_row($r) or die(mysql_error()); + $a = mysql_fetch_row($r); if ($a) { return $a[0]; } else { @@ -1578,7 +1578,7 @@ function image_code () { $imagehash = md5($randomstr); $dateline = time(); $sql = 'INSERT INTO `regimages` (`imagehash`, `imagestring`, `dateline`) VALUES (\''.$imagehash.'\', \''.$randomstr.'\', \''.$dateline.'\');'; - sql_query($sql) or die(mysql_error()); + sql_query($sql); return $imagehash; } @@ -1877,7 +1877,7 @@ function userlogin() { } if (!$row["passkey"]){ $passkey = md5($row['username'].date("Y-m-d H:i:s").$row['passhash']); - sql_query("UPDATE users SET passkey = ".sqlesc($passkey)." WHERE id=" . sqlesc($row["id"]));// or die(mysql_error()); + sql_query("UPDATE users SET passkey = ".sqlesc($passkey)." WHERE id=" . sqlesc($row["id"])); } $oldip = $row['ip']; @@ -2260,8 +2260,8 @@ function get_style_highlight() } if (!$hltr) { - $r = sql_query("SELECT hltr FROM stylesheets WHERE id=5") or die(mysql_error()); - $a = mysql_fetch_array($r) or die(mysql_error()); + $r = sql_query("SELECT hltr FROM stylesheets WHERE id=5"); + $a = mysql_fetch_array($r); $hltr = $a["hltr"]; } return $hltr; diff --git a/public/bitbucketlog.php b/public/bitbucketlog.php index 10df79ba..f590a52a 100644 --- a/public/bitbucketlog.php +++ b/public/bitbucketlog.php @@ -1,7 +1,7 @@ -= UC_MODERATOR) { $delete = intval($_GET["delete"] ?? 0); if (is_valid_id($delete)) { - $r = sql_query("SELECT name,owner FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__); - if (mysql_num_rows($r) == 1) { - $a = mysql_fetch_assoc($r); - if (get_user_class() >= UC_MODERATOR || $a["owner"] == $CURUSER["id"]) { - sql_query("DELETE FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__); + $r = sql_query("SELECT name,owner FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($r) == 1) { + $a = mysql_fetch_assoc($r); + if (get_user_class() >= UC_MODERATOR || $a["owner"] == $CURUSER["id"]) { + sql_query("DELETE FROM bitbucket WHERE id=".mysql_real_escape_string($delete)) or sqlerr(__FILE__, __LINE__); if (!unlink("$bucketpath/{$a['name']}")) stderr("Warning", "Unable to unlink file: {$a['name']}. You should contact an administrator about this error.",false); - } } } } - stdhead("BitBucket Log"); - $res = sql_query("SELECT count(*) FROM bitbucket") or die(mysql_error()); $row = mysql_fetch_array($res); $count = $row[0]; - $perpage = 10; + } } } } + stdhead("BitBucket Log"); + $res = sql_query("SELECT count(*) FROM bitbucket"); $row = mysql_fetch_array($res); $count = $row[0]; + $perpage = 10; list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] . "?out=" . ($_GET["out"] ?? '') . "&" ); - print("

BitBucket Log

\n"); - print("Total Images Stored: $count"); - echo $pagertop; - $res = sql_query("SELECT * FROM bitbucket ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__); - if (mysql_num_rows($res) == 0) - print("BitBucket Log is empty\n"); - else { - print("\n"); + print("

BitBucket Log

\n"); + print("Total Images Stored: $count"); + echo $pagertop; + $res = sql_query("SELECT * FROM bitbucket ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) + print("BitBucket Log is empty\n"); + else { + print("
\n"); while ($arr = mysql_fetch_assoc($res)) { - $date = substr($arr['added'], 0, strpos($arr['added'], " ")); - $time = substr($arr['added'], strpos($arr['added'], " ") + 1); + $date = substr($arr['added'], 0, strpos($arr['added'], " ")); + $time = substr($arr['added'], strpos($arr['added'], " ") + 1); $name = $arr["name"]; - list($width, $height, $type, $attr) = getimagesize("" . get_protocol_prefix() . "$BASEURL/$bitbucket/$name"); + list($width, $height, $type, $attr) = getimagesize("" . get_protocol_prefix() . "$BASEURL/$bitbucket/$name"); $url = str_replace(" ", "%20", htmlspecialchars("$bitbucket/$name")); print(""); - print(""); - } - print("
"); + print("
"); print("Uploaded by: " . get_username($arr['owner']). "
"); print("(#{$arr['id']}) Filename: $name ($width x $height)"); - if (get_user_class() >= UC_MODERATOR) + if (get_user_class() >= UC_MODERATOR) print(" [Delete]
"); - print("Added: $date $time"); - print("
"); - } - echo - $pagerbottom; + print("Added: $date $time"); + print(""); + } + print(""); + } + echo + $pagerbottom; stdfoot(); ?> diff --git a/public/sendmessage.php b/public/sendmessage.php index 15b34c77..81aba44f 100644 --- a/public/sendmessage.php +++ b/public/sendmessage.php @@ -12,7 +12,7 @@ parked(); if ($replyto && !is_valid_id($replyto)) stderr($lang_sendmessage['std_error'],$lang_sendmessage['std_permission_denied']); - $res = sql_query("SELECT * FROM users WHERE id=$receiver") or die(mysql_error()); + $res = sql_query("SELECT * FROM users WHERE id=$receiver"); $user = mysql_fetch_assoc($res); if (!$user) stderr($lang_sendmessage['std_error'],$lang_sendmessage['std_no_user_id']); diff --git a/public/staffbox.php b/public/staffbox.php index d912bca9..0b325a74 100644 --- a/public/staffbox.php +++ b/public/staffbox.php @@ -23,7 +23,7 @@ if (!$action) { { stdmsg($lang_staffbox['std_sorry'], $lang_staffbox['std_no_messages_yet']); } - else + else { begin_main_frame(); print("
"); @@ -130,13 +130,13 @@ if ($action == "answermessage") { int_check($receiver,true); - $res = sql_query("SELECT * FROM users WHERE id=" . sqlesc($receiver)) or die(mysql_error()); + $res = sql_query("SELECT * FROM users WHERE id=" . sqlesc($receiver)); $user = mysql_fetch_assoc($res); if (!$user) stderr($lang_staffbox['std_error'], $lang_staffbox['std_no_user_id']); - $res2 = sql_query("SELECT * FROM staffmessages WHERE id=" . sqlesc($answeringto)) or die(mysql_error()); + $res2 = sql_query("SELECT * FROM staffmessages WHERE id=" . sqlesc($answeringto)); $staffmsg = mysql_fetch_assoc($res2); stdhead($lang_staffbox['head_answer_to_staff_pm']); begin_main_frame(); diff --git a/public/takeinvite.php b/public/takeinvite.php index 68f1eb8c..24410c63 100644 --- a/public/takeinvite.php +++ b/public/takeinvite.php @@ -33,15 +33,15 @@ if(!$body) // check if email addy is already in use -$a = (@mysql_fetch_row(@sql_query("select count(*) from users where email=".sqlesc($email)))) or die(mysql_error()); +$a = (@mysql_fetch_row(@sql_query("select count(*) from users where email=".sqlesc($email)))); if ($a[0] != 0) bark($lang_takeinvite['std_email_address'].htmlspecialchars($email).$lang_takeinvite['std_is_in_use']); -$b = (@mysql_fetch_row(@sql_query("select count(*) from invites where invitee=".sqlesc($email)))) or die(mysql_error()); +$b = (@mysql_fetch_row(@sql_query("select count(*) from invites where invitee=".sqlesc($email)))); if ($b[0] != 0) bark($lang_takeinvite['std_invitation_already_sent_to'].htmlspecialchars($email).$lang_takeinvite['std_await_user_registeration']); $ret = sql_query("SELECT username FROM users WHERE id = ".sqlesc($id)) or sqlerr(); -$arr = mysql_fetch_assoc($ret); +$arr = mysql_fetch_assoc($ret); $hash = md5(mt_rand(1,10000).$CURUSER['username'].TIMENOW.$CURUSER['passhash']); @@ -63,7 +63,7 @@ sent_mail($email,$SITENAME,$SITEEMAIL,$title,$message,"invitesignup",false,false //this email is sent only when someone give out an invitation header("Refresh: 0; url=invite.php?id=".htmlspecialchars($id)."&sent=1"); -?> - - +?> + + diff --git a/public/torrentrss.php b/public/torrentrss.php index 28999f2a..957f89f9 100644 --- a/public/torrentrss.php +++ b/public/torrentrss.php @@ -105,7 +105,7 @@ get_where("audiocodecs", "audiocodec", "aud"); if ($where) $where = "WHERE ".$where; $query = "SELECT torrents.id, torrents.category, torrents.name, torrents.small_descr, torrents.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, users.username AS username, categories.id AS cat_id, categories.name AS cat_name FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where ORDER BY torrents.added DESC LIMIT $limit"; -$res = sql_query($query) or die(mysql_error()); +$res = sql_query($query); $torrentRep = new \App\Repositories\TorrentRepository(); $url = get_protocol_prefix().$BASEURL; $year = substr($datefounded, 0, 4); diff --git a/public/torrents.php b/public/torrents.php index 207a1237..24ead100 100644 --- a/public/torrents.php +++ b/public/torrents.php @@ -834,7 +834,7 @@ else $sql = "SELECT COUNT(*), categories.mode FROM torrents LEFT JOIN categories ON category = categories.id " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $where." GROUP BY categories.mode"; } -$res = sql_query($sql) or die(mysql_error()); +$res = sql_query($sql); $count = 0; while($row = mysql_fetch_array($res)) $count += $row[0]; @@ -877,7 +877,7 @@ 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"; } - $res = sql_query($query) or die(mysql_error()); + $res = sql_query($query); } else unset($res);