".$lang_getusertorrentlistajax['col_type']."".$lang_getusertorrentlistajax['col_name']."". ($showsize ? "\"size\"" : "").($showsenum ? "\"seeders\"" : "").($showlenum ? "\"leechers\"" : "").($showuploaded ? "".$lang_getusertorrentlistajax['col_uploaded']."" : "") . ($showdownloaded ? "".$lang_getusertorrentlistajax['col_downloaded']."" : "").($showratio ? "".$lang_getusertorrentlistajax['col_ratio']."" : "").($showsetime ? "".$lang_getusertorrentlistajax['col_se_time']."" : "").($showletime ? "".$lang_getusertorrentlistajax['col_le_time']."" : "").($showcotime ? "".$lang_getusertorrentlistajax['col_time_completed']."" : "").($showanonymous ? "".$lang_getusertorrentlistajax['col_anonymous']."" : "")."\n"; while ($arr = mysql_fetch_assoc($res)) { $catimage = htmlspecialchars($arr["image"]); $catname = htmlspecialchars($arr["catname"]); $sphighlight = get_torrent_bg_color($arr['sp_state']); $sp_torrent = get_torrent_promotion_append($arr['sp_state']); //torrent name $dispname = $nametitle = htmlspecialchars($arr["torrentname"]); $count_dispname=mb_strlen($dispname,"UTF-8"); $max_lenght_of_torrent_name=($CURUSER['fontsize'] == 'large' ? 70 : 80); if($count_dispname > $max_lenght_of_torrent_name) $dispname=mb_substr($dispname, 0, $max_lenght_of_torrent_name,"UTF-8") . ".."; if ($smalldescription_main == 'yes'){ //small description $dissmall_descr = htmlspecialchars(trim($arr["small_descr"])); $count_dissmall_descr=mb_strlen($dissmall_descr,"UTF-8"); $max_lenght_of_small_descr=80; // maximum length if($count_dissmall_descr > $max_lenght_of_small_descr) { $dissmall_descr=mb_substr($dissmall_descr, 0, $max_lenght_of_small_descr,"UTF-8") . ".."; } } else $dissmall_descr == ""; $ret .= "".return_category_image($arr['category'], "torrents.php?allsec=1&")."\n" . "" . $dispname . "". $sp_torrent .($dissmall_descr == "" ? "" : "
" . $dissmall_descr) . ""; //size if ($showsize) $ret .= "". mksize_compact($arr['size']).""; //number of seeders if ($showsenum) $ret .= "".$arr['seeders'].""; //number of leechers if ($showlenum) $ret .= "".$arr['leechers'].""; //uploaded amount if ($showuploaded){ $uploaded = mksize_compact($arr["uploaded"]); $ret .= "".$uploaded.""; } //downloaded amount if ($showdownloaded){ $downloaded = mksize_compact($arr["downloaded"]); $ret .= "".$downloaded.""; } //ratio if ($showratio){ if ($arr['downloaded'] > 0) { $ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3); $ratio = "".$ratio.""; } elseif ($arr['uploaded'] > 0) $ratio = "Inf."; else $ratio = "---"; $ret .= "".$ratio.""; } if ($showsetime){ $ret .= "".mkprettytime($arr['seedtime']).""; } if ($showletime){ $ret .= "".mkprettytime($arr['leechtime']).""; } if ($showcotime) $ret .= ""."". str_replace(" ", "
", gettime($arr['completedat'],false)). ""; if ($showanonymous) $ret .= "".$arr['anonymous'].""; $ret .="\n"; } $ret .= "\n"; return $ret; } $id = 0+$_GET['userid']; $type = $_GET['type']; if (!in_array($type,array('uploaded','seeding','leeching','completed','incomplete'))) die; if(get_user_class() < $torrenthistory_class && $id != $CURUSER["id"]) permissiondenied(); switch ($type) { case 'uploaded': { $res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, categories.name AS catname, categories.image, category, sp_state, size, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__); $count = mysql_num_rows($res); if ($count > 0) { $torrentlist = maketable($res, 'uploaded'); } break; } // Current Seeding case 'seeding': { $res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr(); $count = mysql_num_rows($res); if ($count > 0){ $torrentlist = maketable($res, 'seeding'); } break; } // Current Leeching case 'leeching': { $res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr(); $count = mysql_num_rows($res); if ($count > 0){ $torrentlist = maketable($res, 'leeching'); } break; } // Completed torrents case 'completed': { $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr(); $count = mysql_num_rows($res); if ($count > 0) { $torrentlist = maketable($res, 'completed'); } break; } // Incomplete torrents case 'incomplete': { $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr(); $count = mysql_num_rows($res); if ($count > 0) { $torrentlist = maketable($res, 'incomplete'); } break; } default: { $count = 0; $torrentlist = ""; break; } } if ($count) echo "".$count."".$lang_getusertorrentlistajax['text_record'].add_s($count)."
".$torrentlist; else echo $lang_getusertorrentlistajax['text_no_record']; ?>