" .
"| ");
}
function end_main_frame()
{
print(" |
\n");
}
function begin_frame($caption = "", $center = false, $padding = 10, $width="100%", $caption_center="left")
{
$tdextra = "";
if ($center)
$tdextra .= " align=\"center\"";
print(($caption ? "\n");
end_frame();
print("
/
get_value('user_'.$CURUSER["id"].'_inbox_count');
if ($messages == ""){
$messages = get_row_count("messages", "WHERE receiver=" . sqlesc($CURUSER["id"]) . " AND location<>0");
$Cache->cache_value('user_'.$CURUSER["id"].'_inbox_count', $messages, 900);
}
$outmessages = $Cache->get_value('user_'.$CURUSER["id"].'_outbox_count');
if ($outmessages == ""){
$outmessages = get_row_count("messages","WHERE sender=" . sqlesc($CURUSER["id"]) . " AND saved='yes'");
$Cache->cache_value('user_'.$CURUSER["id"].'_outbox_count', $outmessages, 900);
}
if (!$connect = $Cache->get_value('user_'.$CURUSER["id"].'_connect')){
$res3 = sql_query("SELECT connectable FROM peers WHERE userid=" . sqlesc($CURUSER["id"]) . " LIMIT 1");
if($row = mysql_fetch_row($res3))
$connect = $row[0];
else $connect = 'unknown';
$Cache->cache_value('user_'.$CURUSER["id"].'_connect', $connect, 900);
}
if($connect == "yes")
$connectable = "".$lang_functions['text_yes']."";
elseif ($connect == 'no')
$connectable = "".$lang_functions['text_no']."";
else
$connectable = $lang_functions['text_unknown'];
//// check every 60 seconds //////////////////
$activeseed = $Cache->get_value('user_'.$CURUSER["id"].'_active_seed_count');
if ($activeseed == ""){
$activeseed = get_row_count("peers","WHERE userid=" . sqlesc($CURUSER["id"]) . " AND seeder='yes'");
$Cache->cache_value('user_'.$CURUSER["id"].'_active_seed_count', $activeseed, 60);
}
$activeleech = $Cache->get_value('user_'.$CURUSER["id"].'_active_leech_count');
if ($activeleech == ""){
$activeleech = get_row_count("peers","WHERE userid=" . sqlesc($CURUSER["id"]) . " AND seeder='no'");
$Cache->cache_value('user_'.$CURUSER["id"].'_active_leech_count', $activeleech, 60);
}
$unread = $Cache->get_value('user_'.$CURUSER["id"].'_unread_message_count');
if ($unread == ""){
$unread = get_row_count("messages","WHERE receiver=" . sqlesc($CURUSER["id"]) . " AND unread='yes'");
$Cache->cache_value('user_'.$CURUSER["id"].'_unread_message_count', $unread, 60);
}
$inboxpic = " ";
?>
, []= UC_MODERATOR) { ?> [] = UC_SYSOP) { ?> [] [] []: []:
|
= $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(" ".$totalcheaters." ".$totalreports." ".$totalsm." ");
}
print("".$inboxpic." ".($messages ? $messages." (".$unread.$lang_functions['text_message_new'].")" : "0"));
print(" ".($outmessages ? $outmessages : "0"));
print(" ");
print(" ");
?>
|
|
|
|
enable_ad()){
$belownavad=$Advertisement->get_ad('belownav');
if ($belownavad)
echo " ".$belownavad[0]." ";
}
if ($msgalert)
{
function msgalert($url, $text, $bgcolor = "red")
{
print(" ");
}
if($CURUSER['leechwarn'] == 'yes')
{
$kicktimeout = gettime($CURUSER['leechwarnuntil'], false, false, true);
$text = $lang_functions['text_please_improve_ratio_within'].$kicktimeout.$lang_functions['text_or_you_will_be_banned'];
msgalert("faq.php#id17", $text, "orange");
}
if($deletenotransfertwo_account) //inactive account deletion notice
{
if ($CURUSER['downloaded'] == 0 && ($CURUSER['uploaded'] == 0 || $CURUSER['uploaded'] == $iniupload_main))
{
$neverdelete_account = ($neverdelete_account <= UC_VIP ? $neverdelete_account : UC_VIP);
if (get_user_class() < $neverdelete_account)
{
$secs = $deletenotransfertwo_account*24*60*60;
$addedtime = strtotime($CURUSER['added']);
if (TIMENOW > $addedtime+($secs/3)) // start notification if one third of the time has passed
{
$kicktimeout = gettime(date("Y-m-d H:i:s", $addedtime+$secs), false, false, true);
$text = $lang_functions['text_please_download_something_within'].$kicktimeout.$lang_functions['text_inactive_account_be_deleted'];
msgalert("rules.php", $text, "gray");
}
}
}
}
if($CURUSER['showclienterror'] == 'yes')
{
$text = $lang_functions['text_banned_client_warning'];
msgalert("faq.php#id29", $text, "black");
}
if ($unread)
{
$text = $lang_functions['text_you_have'].$unread.$lang_functions['text_new_message'] . add_s($unread) . $lang_functions['text_click_here_to_read'];
msgalert("messages.php",$text, "red");
}
/*
$pending_invitee = $Cache->get_value('user_'.$CURUSER["id"].'_pending_invitee_count');
if ($pending_invitee == ""){
$pending_invitee = get_row_count("users","WHERE status = 'pending' AND invited_by = ".sqlesc($CURUSER['id']));
$Cache->cache_value('user_'.$CURUSER["id"].'_pending_invitee_count', $pending_invitee, 900);
}
if ($pending_invitee > 0)
{
$text = $lang_functions['text_your_friends'].add_s($pending_invitee).is_or_are($pending_invitee).$lang_functions['text_awaiting_confirmation'];
msgalert("invite.php?id=".$CURUSER['id'],$text, "red");
}*/
$settings_script_name = $_SERVER["SCRIPT_FILENAME"];
if (!preg_match("/index/i", $settings_script_name))
{
$new_news = $Cache->get_value('user_'.$CURUSER["id"].'_unread_news_count');
if ($new_news == ""){
$new_news = get_row_count("news","WHERE notify = 'yes' AND added > ".sqlesc($CURUSER['last_home']));
$Cache->cache_value('user_'.$CURUSER["id"].'_unread_news_count', $new_news, 300);
}
if ($new_news > 0)
{
$text = $lang_functions['text_there_is'].is_or_are($new_news).$new_news.$lang_functions['text_new_news'];
msgalert("index.php",$text, "green");
}
}
if (get_user_class() >= $staffmem_class)
{
$numreports = $Cache->get_value('staff_new_report_count');
if ($numreports == ""){
$numreports = get_row_count("reports","WHERE dealtwith=0");
$Cache->cache_value('staff_new_report_count', $numreports, 900);
}
if ($numreports){
$text = $lang_functions['text_there_is'].is_or_are($numreports).$numreports.$lang_functions['text_new_report'] .add_s($numreports);
msgalert("reports.php",$text, "blue");
}
$nummessages = $Cache->get_value('staff_new_message_count');
if ($nummessages == ""){
$nummessages = get_row_count("staffmessages","WHERE answered='no'");
$Cache->cache_value('staff_new_message_count', $nummessages, 900);
}
if ($nummessages > 0) {
$text = $lang_functions['text_there_is'].is_or_are($nummessages).$nummessages.$lang_functions['text_new_staff_message'] . add_s($nummessages);
msgalert("staffbox.php",$text, "blue");
}
$numcheaters = $Cache->get_value('staff_new_cheater_count');
if ($numcheaters == ""){
$numcheaters = get_row_count("cheaters","WHERE dealtwith=0");
$Cache->cache_value('staff_new_cheater_count', $numcheaters, 900);
}
if ($numcheaters){
$text = $lang_functions['text_there_is'].is_or_are($numcheaters).$numcheaters.$lang_functions['text_new_suspected_cheater'] .add_s($numcheaters);
msgalert("cheaterbox.php",$text, "blue");
}
}
}
if ($offlinemsg)
{
print("| \n");
print("".$lang_functions['text_website_offline_warning']."");
print(" |
\n");
}
}
}
function stdfoot() {
global $SITENAME,$BASEURL,$Cache,$datefounded,$tstart,$icplicense_main,$add_key_shortcut,$query_name, $USERUPDATESET, $CURUSER, $enablesqldebug_tweak, $sqldebug_tweak, $Advertisement, $analyticscode_tweak;
print(" |
");
print("");
if ($analyticscode_tweak)
print("\n".$analyticscode_tweak."\n");
print("");
//echo replacePngTags(ob_get_clean());
// unset($_SESSION['queries']);
}
function genbark($x,$y) {
stdhead($y);
print("" . htmlspecialchars($x) . "
\n");
stdfoot();
exit();
}
function mksecret($len = 20) {
$ret = "";
for ($i = 0; $i < $len; $i++)
$ret .= chr(mt_rand(100, 120));
return $ret;
}
function httperr($code = 404) {
header("HTTP/1.0 404 Not found");
print("\n");
$secs = 900;
$dt = sqlesc(date("Y-m-d H:i:s",(TIMENOW - $secs))); // calculate date.
print("\n");
print("| ".return_avatar_image($avatar)." | \n");
print(" ".$text.$text_editby." | \n");
print("
\n");
$actionbar = "
".
"
".(get_user_class() >= $commanage_class ? "
" : "").($row["user"] == $CURUSER["id"] || get_user_class() >= $commanage_class ? "
"."" : "");
print(" ".("'".$userRow['last_access']."'"> $dt ? " ":" " )."![\"".$lang_functions['title_send_message_to'].htmlspecialchars($userRow["username"])."\" \"PM\"](\"pic/trans.gif\") ![\"".$lang_functions['title_report_this_comment']."\" \"Report\"](\"pic/trans.gif\") | ".$actionbar." | ");
print("
\n");
$count++;
}
end_frame();
end_main_frame();
}
function searchfield($s) {
return preg_replace(array('/[^a-z0-9]/si', '/^\s*/s', '/\s*$/s', '/\s+/s'), array(" ", "", "", " "), $s);
}
function genrelist($catmode = 1) {
global $Cache;
if (!$ret = $Cache->get_value('category_list_mode_'.$catmode)){
$ret = array();
$res = sql_query("SELECT id, mode, name, image FROM categories WHERE mode = ".sqlesc($catmode)." ORDER BY sort_index, id");
while ($row = mysql_fetch_array($res))
$ret[] = $row;
$Cache->cache_value('category_list_mode_'.$catmode, $ret, 152800);
}
return $ret;
}
function searchbox_item_list($table = "sources"){
global $Cache;
if (!$ret = $Cache->get_value($table.'_list')){
$ret = array();
$res = sql_query("SELECT * FROM ".$table." ORDER BY sort_index, id");
while ($row = mysql_fetch_array($res))
$ret[] = $row;
$Cache->cache_value($table.'_list', $ret, 152800);
}
return $ret;
}
function langlist($type) {
global $Cache;
if (!$ret = $Cache->get_value($type.'_lang_list')){
$ret = array();
$res = sql_query("SELECT id, lang_name, flagpic, site_lang_folder FROM language WHERE ". $type ."=1 ORDER BY site_lang DESC, id ASC");
while ($row = mysql_fetch_array($res))
$ret[] = $row;
$Cache->cache_value($type.'_lang_list', $ret, 152800);
}
return $ret;
}
function linkcolor($num) {
if (!$num)
return "red";
// if ($num == 1)
// return "yellow";
return "green";
}
function writecomment($userid, $comment) {
$res = sql_query("SELECT modcomment FROM users WHERE id = '$userid'") or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res);
$modcomment = date("d-m-Y") . " - " . $comment . "" . ($arr[modcomment] != "" ? "\n\n" : "") . "$arr[modcomment]";
$modcom = sqlesc($modcomment);
return sql_query("UPDATE users SET modcomment = $modcom WHERE id = '$userid'") or sqlerr(__FILE__, __LINE__);
}
function return_torrent_bookmark_array($userid)
{
global $Cache;
static $ret;
if (!$ret){
if (!$ret = $Cache->get_value('user_'.$userid.'_bookmark_array')){
$ret = array();
$res = sql_query("SELECT * FROM bookmarks WHERE userid=" . sqlesc($userid));
if (mysql_num_rows($res) != 0){
while ($row = mysql_fetch_array($res))
$ret[] = $row['torrentid'];
$Cache->cache_value('user_'.$userid.'_bookmark_array', $ret, 132800);
} else {
$Cache->cache_value('user_'.$userid.'_bookmark_array', array(0), 132800);
}
}
}
return $ret;
}
function get_torrent_bookmark_state($userid, $torrentid, $text = false)
{
global $lang_functions;
$userid = intval($userid ?? 0);
$torrentid = intval($torrentid ?? 0);
$ret = array();
$ret = return_torrent_bookmark_array($userid);
if (!count($ret) || !in_array($torrentid, $ret, false)) // already bookmarked
$act = ($text == true ? $lang_functions['title_bookmark_torrent'] : "
$get_value) {
$get_name = mysql_real_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_name)));
$get_value = mysql_real_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_value)));
if ($get_name != "sort" && $get_name != "type") {
if ($count_get > 0) {
$oldlink .= "&" . $get_name . "=" . $get_value;
}
else {
$oldlink .= $get_name . "=" . $get_value;
}
$count_get++;
}
}
if ($count_get > 0) {
$oldlink = $oldlink . "&";
}
$sort = $_GET['sort'] ?? '';
$link = array();
for ($i=1; $i<=9; $i++){
if ($sort == $i)
$link[$i] = ($_GET['type'] == "desc" ? "asc" : "desc");
else $link[$i] = ($i == 1 ? "asc" : "desc");
}
?>
|
|
".$lang_functions['col_wait']."\n");
}
if ($CURUSER['showcomnum'] != 'no') { ?>
|
![<?php echo ($CURUSER['timetype'] != 'timealive' ? $lang_functions['title_time_added'] : $lang_functions['title_time_alive'])?> time](pic/trans.gif) |
![<?php echo $lang_functions['title_size'] ?> size](pic/trans.gif) |
![<?php echo $lang_functions['title_number_of_seeders'] ?> seeders](pic/trans.gif) |
![<?php echo $lang_functions['title_number_of_leechers'] ?> leechers](pic/trans.gif) |
![<?php echo $lang_functions['title_number_of_snatched']?> snatched](pic/trans.gif) |
|
= $torrentmanage_class) { ?>
|
\n");
print("");
if (isset($row["category"])) {
print(return_category_image($row["category"], "?"));
if ($has_secondicon){
print(get_second_icon($row, "pic/".$catimgurl."additional/"));
}
}
else
print("-");
print(" | \n");
//torrent name
$dispname = trim($row["name"]);
$short_torrent_name_alt = "";
$mouseovertorrent = "";
$tooltipblock = "";
$has_tooltip = false;
if ($enabletooltip_tweak == 'yes')
$tooltiptype = $CURUSER['tooltip'];
else
$tooltiptype = 'off';
switch ($tooltiptype){
case 'minorimdb' : {
if ($showextinfo['imdb'] == 'yes' && $row["url"])
{
$url = $row['url'];
$cache = $row['cache_stamp'];
$type = 'minor';
$has_tooltip = true;
}
break;
}
case 'medianimdb' :
{
if ($showextinfo['imdb'] == 'yes' && $row["url"])
{
$url = $row['url'];
$cache = $row['cache_stamp'];
$type = 'median';
$has_tooltip = true;
}
break;
}
case 'off' : break;
}
if (!$has_tooltip)
$short_torrent_name_alt = "title=\"".htmlspecialchars($dispname)."\"";
else{
$torrent_tooltip[$counter]['id'] = "torrent_" . $counter;
$torrent_tooltip[$counter]['content'] = "";
$mouseovertorrent = "onmouseover=\"get_ext_info_ajax('".$torrent_tooltip[$counter]['id']."','".$url."','".$cache."','".$type."'); domTT_activate(this, event, 'content', document.getElementById('" . $torrent_tooltip[$counter]['id'] . "'), 'trail', false, 'delay',600,'lifetime',6000,'fade','both','styleClass','niceTitle', 'fadeMax',87, 'maxWidth', 500);\"";
}
$count_dispname=mb_strlen($dispname,"UTF-8");
if (!$displaysmalldescr || $row["small_descr"] == "")// maximum length of torrent name
$max_length_of_torrent_name = 120;
elseif ($CURUSER['fontsize'] == 'large')
$max_length_of_torrent_name = 60;
elseif ($CURUSER['fontsize'] == 'small')
$max_length_of_torrent_name = 80;
else $max_length_of_torrent_name = 70;
if($count_dispname > $max_length_of_torrent_name)
$dispname=mb_substr($dispname, 0, $max_length_of_torrent_name-2,"UTF-8") . "..";
if ($row['pos_state'] == 'sticky' && $CURUSER['appendsticky'] == 'yes')
$stickyicon = "
";
else $stickyicon = "";
print("".$stickyicon."".htmlspecialchars($dispname)."");
$sp_torrent = get_torrent_promotion_append($row['sp_state'],"",true,$row["added"], $row['promotion_time_type'], $row['promotion_until']);
$picked_torrent = "";
if ($CURUSER['appendpicked'] != 'no'){
if($row['picktype']=="hot")
$picked_torrent = " [".$lang_functions['text_hot']."]";
elseif($row['picktype']=="classic")
$picked_torrent = " [".$lang_functions['text_classic']."]";
elseif($row['picktype']=="recommended")
$picked_torrent = " [".$lang_functions['text_recommended']."]";
}
if ($CURUSER['appendnew'] != 'no' && strtotime($row["added"]) >= $last_browse)
print(" (".$lang_functions['text_new_uppercase'].")");
$banned_torrent = ($row["banned"] == 'yes' ? " (".$lang_functions['text_banned'].")" : "");
print($banned_torrent.$picked_torrent.$sp_torrent);
if ($displaysmalldescr){
//small descr
$dissmall_descr = trim($row["small_descr"]);
$count_dissmall_descr=mb_strlen($dissmall_descr,"UTF-8");
$max_lenght_of_small_descr=$max_length_of_torrent_name; // maximum length
if($count_dissmall_descr > $max_lenght_of_small_descr)
{
$dissmall_descr=mb_substr($dissmall_descr, 0, $max_lenght_of_small_descr-2,"UTF-8") . "..";
}
print($dissmall_descr == "" ? "" : " ".htmlspecialchars($dissmall_descr));
}
print(" | ");
if ($enablePtGen && !empty($row['pt_gen'])) {
echo $ptGen->renderTorrentsPageAverageRating(json_decode($row['pt_gen'], true));
} elseif ($enableImdb && !empty($row['url'])) {
echo $imdb->renderTorrentsPageAverageRating($row['url']);
}
$act = "";
if ($CURUSER["dlicon"] != 'no' && $CURUSER["downloadpos"] != "no")
$act .= " " ;
if ($CURUSER["bmicon"] == 'yes'){
$bookmark = " href=\"javascript: bookmark(".$id.",".$counter.");\"";
$act .= ($act ? " " : "")."".get_torrent_bookmark_state($CURUSER['id'], $id)."";
}
print("".$act." | \n");
print("
| ");
if ($wait)
{
$elapsed = floor((TIMENOW - strtotime($row["added"])) / 3600);
if ($elapsed < $wait)
{
$color = dechex(floor(127*($wait - $elapsed)/48 + 128)*65536);
print("" . number_format($wait - $elapsed) . $lang_functions['text_h']." | \n");
}
else
print("".$lang_functions['text_none']." | \n");
}
if ($CURUSER['showcomnum'] != 'no')
{
print("");
$nl = "";
//comments
$nl = " ";
$lastcom_tooltip = [];
$torrent_tooltip = [];
if (!$row["comments"]) {
print("" . $row["comments"] . "");
} else {
if ($enabletooltip_tweak == 'yes' && $CURUSER['showlastcom'] != 'no')
{
if (!$lastcom = $Cache->get_value('torrent_'.$id.'_last_comment_content')){
$res2 = sql_query("SELECT user, added, text FROM comments WHERE torrent = $id ORDER BY id DESC LIMIT 1");
$lastcom = mysql_fetch_array($res2);
$Cache->cache_value('torrent_'.$id.'_last_comment_content', $lastcom, 1855);
}
$timestamp = strtotime($lastcom["added"]);
$hasnewcom = ($lastcom['user'] != $CURUSER['id'] && $timestamp >= $last_browse);
if ($lastcom)
{
if ($CURUSER['timetype'] != 'timealive')
$lastcomtime = $lang_functions['text_at_time'].$lastcom['added'];
else
$lastcomtime = $lang_functions['text_blank'].gettime($lastcom["added"],true,false,true);
$lastcom_tooltip[$counter]['id'] = "lastcom_" . $counter;
$lastcom_tooltip[$counter]['content'] = ($hasnewcom ? "(".$lang_functions['text_new_uppercase'].") " : "").$lang_functions['text_last_commented_by'].get_username($lastcom['user']) . $lastcomtime." ". format_comment(mb_substr($lastcom['text'],0,100,"UTF-8") . (mb_strlen($lastcom['text'],"UTF-8") > 100 ? " ......" : "" ),true,false,false,true,600,false,false);
$onmouseover = "onmouseover=\"domTT_activate(this, event, 'content', document.getElementById('" . $lastcom_tooltip[$counter]['id'] . "'), 'trail', false, 'delay', 500,'lifetime',3000,'fade','both','styleClass','niceTitle','fadeMax', 87,'maxWidth', 400);\"";
}
} else {
$hasnewcom = false;
$onmouseover = "";
}
print("". ($hasnewcom ? "" : ""). $row["comments"] .($hasnewcom ? "" : ""). "");
}
print(" | ");
}
$time = $row["added"];
$time = gettime($time,false,true);
print("". $time. " | ");
//size
print("" . mksize_compact($row["size"])." | ");
if ($row["seeders"]) {
$ratio = ($row["leechers"] ? ($row["seeders"] / $row["leechers"]) : 1);
$ratiocolor = get_slr_color($ratio);
print("".($ratiocolor ? "" . number_format($row["seeders"]) . "" : number_format($row["seeders"]))." | \n");
}
else
print("" . number_format($row["seeders"]) . " | \n");
if ($row["leechers"]) {
print("" .
number_format($row["leechers"]) . " | \n");
}
else
print("0 | \n");
if ($row["times_completed"] >=1)
print("" . number_format($row["times_completed"]) . " | \n");
else
print("" . number_format($row["times_completed"]) . " | \n");
if ($row["anonymous"] == "yes" && get_user_class() >= $torrentmanage_class)
{
print("".$lang_functions['text_anonymous']." ".(isset($row["owner"]) ? "(" . get_username($row["owner"]) .")" : "".$lang_functions['text_orphaned']."") . " | \n");
}
elseif ($row["anonymous"] == "yes")
{
print("".$lang_functions['text_anonymous']." | \n");
}
else
{
print("" . (isset($row["owner"]) ? get_username($row["owner"]) : "".$lang_functions['text_orphaned']."") . " | \n");
}
if (get_user_class() >= $torrentmanage_class)
{
print(" ");
print("
![\"".$lang_functions['text_edit']."\" \"E\"](\"pic/trans.gif\") | \n");
}
print("\n");
$counter++;
}
print("
");
if ($CURUSER['appendpromotion'] == 'highlight')
print("