function maketable($res, $mode = 'seeding')
{
    global $lang_getusertorrentlistajax, $CURUSER, $smalldescription_main;
    switch ($mode) {
        case 'uploaded':
            $showsize = true;
            $showsenum = true;
            $showlenum = true;
            $showuploaded = true;
            $showdownloaded = false;
            $showratio = false;
            $showsetime = true;
            $showletime = false;
            $showcotime = false;
            $showanonymous = true;
            $columncount = 8;
            break;
        case 'seeding':
            $showsize = true;
            $showsenum = true;
            $showlenum = true;
            $showuploaded = true;
            $showdownloaded = true;
            $showratio = true;
            $showsetime = false;
            $showletime = false;
            $showcotime = false;
            $showanonymous = false;
            $columncount = 8;
            break;
        case 'leeching':
            $showsize = true;
            $showsenum = true;
            $showlenum = true;
            $showuploaded = true;
            $showdownloaded = true;
            $showratio = true;
            $showsetime = false;
            $showletime = false;
            $showcotime = false;
            $showanonymous = false;
            $columncount = 8;
            break;
        case 'completed':
            $showsize = false;
            $showsenum = false;
            $showlenum = false;
            $showuploaded = true;
            $showdownloaded = false;
            $showratio = false;
            $showsetime = true;
            $showletime = true;
            $showcotime = true;
            $showanonymous = false;
            $columncount = 8;
            break;
        case 'incomplete':
            $showsize = false;
            $showsenum = false;
            $showlenum = false;
            $showuploaded = true;
            $showdownloaded = true;
            $showratio = true;
            $showsetime = false;
            $showletime = true;
            $showcotime = false;
            $showanonymous = false;
            $columncount = 7;
            break;
        default:
            break;
    }
    $ret = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"800\"><tr><td class=\"colhead\" style=\"padding: 0px\">" . $lang_getusertorrentlistajax['col_type'] . "</td><td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_name'] . "</td>" . ($showsize ? "<td class=\"colhead\" align=\"center\"><img class=\"size\" src=\"pic/trans.gif\" alt=\"size\" title=\"" . $lang_getusertorrentlistajax['title_size'] . "\" /></td>" : "") . ($showsenum ? "<td class=\"colhead\" align=\"center\"><img class=\"seeders\" src=\"pic/trans.gif\" alt=\"seeders\" title=\"" . $lang_getusertorrentlistajax['title_seeders'] . "\" /></td>" : "") . ($showlenum ? "<td class=\"colhead\" align=\"center\"><img class=\"leechers\" src=\"pic/trans.gif\" alt=\"leechers\" title=\"" . $lang_getusertorrentlistajax['title_leechers'] . "\" /></td>" : "") . ($showuploaded ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_uploaded'] . "</td>" : "") . ($showdownloaded ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_downloaded'] . "</td>" : "") . ($showratio ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_ratio'] . "</td>" : "") . ($showsetime ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_se_time'] . "</td>" : "") . ($showletime ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_le_time'] . "</td>" : "") . ($showcotime ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_time_completed'] . "</td>" : "") . ($showanonymous ? "<td class=\"colhead\" align=\"center\">" . $lang_getusertorrentlistajax['col_anonymous'] . "</td>" : "") . "</tr>\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 .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>" . return_category_image($arr['category'], "torrents.php?allsec=1&amp;") . "</td>\n" . "<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"" . htmlspecialchars("details.php?id=" . $arr[torrent] . "&hit=1") . "\" title=\"" . $nametitle . "\"><b>" . $dispname . "</b></a>" . $sp_torrent . ($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
        //size
        if ($showsize) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . mksize_compact($arr['size']) . "</td>";
        }
        //number of seeders
        if ($showsenum) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $arr['seeders'] . "</td>";
        }
        //number of leechers
        if ($showlenum) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $arr['leechers'] . "</td>";
        }
        //uploaded amount
        if ($showuploaded) {
            $uploaded = mksize_compact($arr["uploaded"]);
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $uploaded . "</td>";
        }
        //downloaded amount
        if ($showdownloaded) {
            $downloaded = mksize_compact($arr["downloaded"]);
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $downloaded . "</td>";
        }
        //ratio
        if ($showratio) {
            if ($arr['downloaded'] > 0) {
                $ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
                $ratio = "<font color=\"" . get_ratio_color($ratio) . "\">" . $ratio . "</font>";
            } elseif ($arr['uploaded'] > 0) {
                $ratio = "Inf.";
            } else {
                $ratio = "---";
            }
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $ratio . "</td>";
        }
        if ($showsetime) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . mkprettytime($arr['seedtime']) . "</td>";
        }
        if ($showletime) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . mkprettytime($arr['leechtime']) . "</td>";
        }
        if ($showcotime) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . "" . str_replace("&nbsp;", "<br />", gettime($arr['completedat'], false)) . "</td>";
        }
        if ($showanonymous) {
            $ret .= "<td class=\"rowfollow\" align=\"center\">" . $arr['anonymous'] . "</td>";
        }
        $ret .= "</tr>\n";
    }
    $ret .= "</table>\n";
    return $ret;
}
Example #2
0
function torrenttable($res, $variant = "torrent")
{
    global $Cache;
    global $lang_functions;
    global $CURUSER, $waitsystem;
    global $showextinfo;
    global $torrentmanage_class, $smalldescription_main, $enabletooltip_tweak;
    global $CURLANGDIR;
    if ($variant == "torrent") {
        $last_browse = $CURUSER['last_browse'];
        $sectiontype = $browsecatmode;
    } elseif ($variant == "music") {
        $last_browse = $CURUSER['last_music'];
        $sectiontype = $specialcatmode;
    } else {
        $last_browse = $CURUSER['last_browse'];
        $sectiontype = "";
    }
    $time_now = TIMENOW;
    if ($last_browse > $time_now) {
        $last_browse = $time_now;
    }
    if (get_user_class() < UC_VIP && $waitsystem == "yes") {
        $ratio = get_ratio($CURUSER["id"], false);
        $gigs = $CURUSER["uploaded"] / (1024 * 1024 * 1024);
        if ($gigs > 10) {
            if ($ratio < 0.4) {
                $wait = 24;
            } elseif ($ratio < 0.5) {
                $wait = 12;
            } elseif ($ratio < 0.6) {
                $wait = 6;
            } elseif ($ratio < 0.8) {
                $wait = 3;
            } else {
                $wait = 0;
            }
        } else {
            $wait = 0;
        }
    }
    ?>
<table class="torrents" cellspacing="0" cellpadding="5" width="100%">
<tr>
<?php 
    $count_get = 0;
    $oldlink = "";
    foreach ($_GET as $get_name => $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 .= "&amp;" . $get_name . "=" . $get_value;
            } else {
                $oldlink .= $get_name . "=" . $get_value;
            }
            $count_get++;
        }
    }
    if ($count_get > 0) {
        $oldlink = $oldlink . "&amp;";
    }
    $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";
        }
    }
    ?>
<td class="colhead" style="padding: 0px"><?php 
    echo $lang_functions['col_type'];
    ?>
</td>
<td class="colhead"><a href="?<?php 
    echo $oldlink;
    ?>
sort=1&amp;type=<?php 
    echo $link[1];
    ?>
"><?php 
    echo $lang_functions['col_name'];
    ?>
</a></td>
<?php 
    if ($wait) {
        print "<td class=\"colhead\">" . $lang_functions['col_wait'] . "</td>\n";
    }
    if ($CURUSER['showcomnum'] != 'no') {
        ?>
<td class="colhead"><a href="?<?php 
        echo $oldlink;
        ?>
sort=3&amp;type=<?php 
        echo $link[3];
        ?>
"><img class="comments" src="pic/trans.gif" alt="comments" title="<?php 
        echo $lang_functions['title_number_of_comments'];
        ?>
" /></a></td>
<?php 
    }
    ?>

<td class="colhead"><a href="?<?php 
    echo $oldlink;
    ?>
sort=4&amp;type=<?php 
    echo $link[4];
    ?>
"><img class="time" src="pic/trans.gif" alt="time" title="<?php 
    echo $CURUSER['timetype'] != 'timealive' ? $lang_functions['title_time_added'] : $lang_functions['title_time_alive'];
    ?>
" /></a></td>
<td class="colhead"><a href="?<?php 
    echo $oldlink;
    ?>
sort=5&amp;type=<?php 
    echo $link[5];
    ?>
"><img class="size" src="pic/trans.gif" alt="size" title="<?php 
    echo $lang_functions['title_size'];
    ?>
" /></a></td>
<td class="colhead"><a href="?<?php 
    echo $oldlink;
    ?>
sort=7&amp;type=<?php 
    echo $link[7];
    ?>
"><img class="seeders" src="pic/trans.gif" alt="seeders" title="<?php 
    echo $lang_functions['title_number_of_seeders'];
    ?>
" /></a></td>
<td class="colhead"><a href="?<?php 
    echo $oldlink;
    ?>
sort=8&amp;type=<?php 
    echo $link[8];
    ?>
"><img class="leechers" src="pic/trans.gif" alt="leechers" title="<?php 
    echo $lang_functions['title_number_of_leechers'];
    ?>
" /></a></td>
<td class="colhead"><a href="?<?php 
    echo $oldlink;
    ?>
sort=6&amp;type=<?php 
    echo $link[6];
    ?>
"><img class="snatched" src="pic/trans.gif" alt="snatched" title="<?php 
    echo $lang_functions['title_number_of_snatched'];
    ?>
" /></a></td>
<td class="colhead"><a href="?<?php 
    echo $oldlink;
    ?>
sort=9&amp;type=<?php 
    echo $link[9];
    ?>
"><?php 
    echo $lang_functions['col_uploader'];
    ?>
</a></td>
<?php 
    if (get_user_class() >= $torrentmanage_class) {
        ?>
	<td class="colhead"><?php 
        echo $lang_functions['col_action'];
        ?>
</td>
<?php 
    }
    ?>
</tr>
<?php 
    $caticonrow = get_category_icon_row($CURUSER['caticon']);
    if ($caticonrow['secondicon'] == 'yes') {
        $has_secondicon = true;
    } else {
        $has_secondicon = false;
    }
    $counter = 0;
    if ($smalldescription_main == 'no' || $CURUSER['showsmalldescr'] == 'no') {
        $displaysmalldescr = false;
    } else {
        $displaysmalldescr = true;
    }
    while ($row = mysql_fetch_assoc($res)) {
        $id = $row["id"];
        $sphighlight = get_torrent_bg_color($row['sp_state']);
        print "<tr" . $sphighlight . ">\n";
        print "<td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>";
        if (isset($row["category"])) {
            print return_category_image($row["category"], "?");
            if ($has_secondicon) {
                print get_second_icon($row, "pic/" . $catimgurl . "additional/");
            }
        } else {
            print "-";
        }
        print "</td>\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 = "<img class=\"sticky\" src=\"pic/trans.gif\" alt=\"Sticky\" title=\"" . $lang_functions['title_sticky'] . "\" />&nbsp;";
        } else {
            $stickyicon = "";
        }
        print "<td class=\"rowfollow\" width=\"100%\" align=\"left\"><table class=\"torrentname\" width=\"100%\"><tr" . $sphighlight . "><td class=\"embedded\">" . $stickyicon . "<a {$short_torrent_name_alt} {$mouseovertorrent} href=\"details.php?id=" . $id . "&amp;hit=1\"><b>" . htmlspecialchars($dispname) . "</b></a>";
        $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 = " <b>[<font class='hot'>" . $lang_functions['text_hot'] . "</font>]</b>";
            } elseif ($row['picktype'] == "classic") {
                $picked_torrent = " <b>[<font class='classic'>" . $lang_functions['text_classic'] . "</font>]</b>";
            } elseif ($row['picktype'] == "recommended") {
                $picked_torrent = " <b>[<font class='recommended'>" . $lang_functions['text_recommended'] . "</font>]</b>";
            }
        }
        if ($CURUSER['appendnew'] != 'no' && strtotime($row["added"]) >= $last_browse) {
            print "<b> (<font class='new'>" . $lang_functions['text_new_uppercase'] . "</font>)</b>";
        }
        $banned_torrent = $row["banned"] == 'yes' ? " <b>(<font class=\"striking\">" . $lang_functions['text_banned'] . "</font>)</b>" : "";
        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 == "" ? "" : "<br />" . htmlspecialchars($dissmall_descr);
        }
        print "</td>";
        $act = "";
        if ($CURUSER["dlicon"] != 'no' && $CURUSER["downloadpos"] != "no") {
            $act .= "<a href=\"download.php?id=" . $id . "\"><img class=\"download\" src=\"pic/trans.gif\" style='padding-bottom: 2px;' alt=\"download\" title=\"" . $lang_functions['title_download_torrent'] . "\" /></a>";
        }
        if ($CURUSER["bmicon"] == 'yes') {
            $bookmark = " href=\"javascript: bookmark(" . $id . "," . $counter . ");\"";
            $act .= ($act ? "<br />" : "") . "<a id=\"bookmark" . $counter . "\" " . $bookmark . " >" . get_torrent_bookmark_state($CURUSER['id'], $id) . "</a>";
        }
        print "<td width=\"20\" class=\"embedded\" style=\"text-align: right; \" valign=\"middle\">" . $act . "</td>\n";
        print "</tr></table></td>";
        if ($wait) {
            $elapsed = floor((TIMENOW - strtotime($row["added"])) / 3600);
            if ($elapsed < $wait) {
                $color = dechex(floor(127 * ($wait - $elapsed) / 48 + 128) * 65536);
                print "<td class=\"rowfollow nowrap\"><a href=\"faq.php#id46\"><font color=\"" . $color . "\">" . number_format($wait - $elapsed) . $lang_functions['text_h'] . "</font></a></td>\n";
            } else {
                print "<td class=\"rowfollow nowrap\">" . $lang_functions['text_none'] . "</td>\n";
            }
        }
        if ($CURUSER['showcomnum'] != 'no') {
            print "<td class=\"rowfollow\">";
            $nl = "";
            //comments
            $nl = "<br />";
            if (!$row["comments"]) {
                print "<a href=\"comment.php?action=add&amp;pid=" . $id . "&amp;type=torrent\" title=\"" . $lang_functions['title_add_comments'] . "\">" . $row["comments"] . "</a>";
            } 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 ? "<b>(<font class='new'>" . $lang_functions['text_new_uppercase'] . "</font>)</b> " : "") . $lang_functions['text_last_commented_by'] . get_username($lastcom['user']) . $lastcomtime . "<br />" . 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 "<b><a href=\"details.php?id=" . $id . "&amp;hit=1&amp;cmtpage=1#startcomments\" " . $onmouseover . ">" . ($hasnewcom ? "<font class='new'>" : "") . $row["comments"] . ($hasnewcom ? "</font>" : "") . "</a></b>";
            }
            print "</td>";
        }
        $time = $row["added"];
        $time = gettime($time, false, true);
        print "<td class=\"rowfollow nowrap\">" . $time . "</td>";
        //size
        print "<td class=\"rowfollow\">" . mksize_compact($row["size"]) . "</td>";
        if ($row["seeders"]) {
            $ratio = $row["leechers"] ? $row["seeders"] / $row["leechers"] : 1;
            $ratiocolor = get_slr_color($ratio);
            print "<td class=\"rowfollow\" align=\"center\"><b><a href=\"details.php?id=" . $id . "&amp;hit=1&amp;dllist=1#seeders\">" . ($ratiocolor ? "<font color=\"" . $ratiocolor . "\">" . number_format($row["seeders"]) . "</font>" : number_format($row["seeders"])) . "</a></b></td>\n";
        } else {
            print "<td class=\"rowfollow\"><span class=\"" . linkcolor($row["seeders"]) . "\">" . number_format($row["seeders"]) . "</span></td>\n";
        }
        if ($row["leechers"]) {
            print "<td class=\"rowfollow\"><b><a href=\"details.php?id=" . $id . "&amp;hit=1&amp;dllist=1#leechers\">" . number_format($row["leechers"]) . "</a></b></td>\n";
        } else {
            print "<td class=\"rowfollow\">0</td>\n";
        }
        if ($row["times_completed"] >= 1) {
            print "<td class=\"rowfollow\"><a href=\"viewsnatches.php?id=" . $row[id] . "\"><b>" . number_format($row["times_completed"]) . "</b></a></td>\n";
        } else {
            print "<td class=\"rowfollow\">" . number_format($row["times_completed"]) . "</td>\n";
        }
        if ($row["anonymous"] == "yes" && get_user_class() >= $torrentmanage_class) {
            print "<td class=\"rowfollow\" align=\"center\"><i>" . $lang_functions['text_anonymous'] . "</i><br />" . (isset($row["owner"]) ? "(" . get_username($row["owner"]) . ")" : "<i>" . $lang_functions['text_orphaned'] . "</i>") . "</td>\n";
        } elseif ($row["anonymous"] == "yes") {
            print "<td class=\"rowfollow\"><i>" . $lang_functions['text_anonymous'] . "</i></td>\n";
        } else {
            print "<td class=\"rowfollow\">" . (isset($row["owner"]) ? get_username($row["owner"]) : "<i>" . $lang_functions['text_orphaned'] . "</i>") . "</td>\n";
        }
        if (get_user_class() >= $torrentmanage_class) {
            print "<td class=\"rowfollow\"><a href=\"" . htmlspecialchars("fastdelete.php?id=" . $row[id]) . "\"><img class=\"staff_delete\" src=\"pic/trans.gif\" alt=\"D\" title=\"" . $lang_functions['text_delete'] . "\" /></a>";
            print "<br /><a href=\"edit.php?returnto=" . rawurlencode($_SERVER["REQUEST_URI"]) . "&amp;id=" . $row["id"] . "\"><img class=\"staff_edit\" src=\"pic/trans.gif\" alt=\"E\" title=\"" . $lang_functions['text_edit'] . "\" /></a></td>\n";
        }
        print "</tr>\n";
        $counter++;
    }
    print "</table>";
    if ($CURUSER['appendpromotion'] == 'highlight') {
        print "<p align=\"center\"> " . $lang_functions['text_promoted_torrents_note'] . "</p>\n";
    }
    if ($enabletooltip_tweak == 'yes' && (!isset($CURUSER) || $CURUSER['showlastcom'] == 'yes')) {
        create_tooltip_container($lastcom_tooltip, 400);
    }
    create_tooltip_container($torrent_tooltip, 500);
}
Example #3
0
// ------------- start: hot and classic movies ------------------//
if ($showextinfo['imdb'] == 'yes' && ($showmovies['hot'] == "yes" || $showmovies['classic'] == "yes")) {
    $type = array('hot', 'classic');
    foreach ($type as $type_each) {
        if ($showmovies[$type_each] == 'yes' && (!isset($CURUSER) || $CURUSER['show' . $type_each] == 'yes')) {
            $Cache->new_page($type_each . '_resources', 900, true);
            if (!$Cache->get_page()) {
                $Cache->add_whole_row();
                $imdbcfg = new imdb_config();
                $res = sql_query("SELECT * FROM torrents WHERE picktype = " . sqlesc($type_each) . " AND seeders > 0 AND url != '' ORDER BY id DESC LIMIT 30") or sqlerr(__FILE__, __LINE__);
                if (mysql_num_rows($res) > 0) {
                    $movies_list = "";
                    $count = 0;
                    $allImdb = array();
                    while ($array = mysql_fetch_array($res)) {
                        $pro_torrent = get_torrent_promotion_append($array[sp_state], 'word');
                        if ($imdb_id = parse_imdb_id($array["url"])) {
                            if (array_search($imdb_id, $allImdb) !== false) {
                                //a torrent with the same IMDb url already exists
                                continue;
                            }
                            $allImdb[] = $imdb_id;
                            $photo_url = $imdbcfg->photodir . $imdb_id . $imdbcfg->imageext;
                            if (file_exists($photo_url)) {
                                $thumbnail = "<img width=\"101\" height=\"140\" src=\"" . $photo_url . "\" border=\"0\" alt=\"poster\" />";
                            } else {
                                continue;
                            }
                        } else {
                            continue;
                        }
Example #4
0
                 $other_source_info = $copy_row[source_name] . ", ";
             }
             if (isset($copy_row["medium_name"])) {
                 $other_medium_info = $copy_row[medium_name] . ", ";
             }
             if (isset($copy_row["codec_name"])) {
                 $other_codec_info = $copy_row[codec_name] . ", ";
             }
             if (isset($copy_row["standard_name"])) {
                 $other_standard_info = $copy_row[standard_name] . ", ";
             }
             if (isset($copy_row["processing_name"])) {
                 $other_processing_info = $copy_row[processing_name] . ", ";
             }
             $sphighlight = get_torrent_bg_color($copy_row['sp_state']);
             $sp_info = get_torrent_promotion_append($copy_row['sp_state']);
             $s .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>" . return_category_image($copy_row["catid"], "torrents.php?allsec=1&amp;") . "</td><td class=\"rowfollow\" align=\"left\"><a href=\"" . htmlspecialchars(get_protocol_prefix() . $BASEURL . "/details.php?id=" . $copy_row["id"] . "&hit=1") . "\">" . $dispname . "</a>" . $sp_info . "</td>" . "<td class=\"rowfollow\" align=\"left\">" . rtrim(trim($other_source_info . $other_medium_info . $other_codec_info . $other_standard_info . $other_processing_info), ",") . "</td>" . "<td class=\"rowfollow\" align=\"center\">" . mksize($copy_row["size"]) . "</td>" . "<td class=\"rowfollow nowrap\" align=\"center\">" . str_replace("&nbsp;", "<br />", gettime($copy_row["added"], false)) . "</td>" . "<td class=\"rowfollow\" align=\"center\">" . $copy_row["seeders"] . "</td>" . "<td class=\"rowfollow\" align=\"center\">" . $copy_row["leechers"] . "</td>" . "</tr>\n";
         }
         $s .= "</table>\n";
         tr("<a href=\"javascript: klappe_news('othercopy')\"><span class=\"nowrap\"><img class=\"" . ($copies_count > 5 ? "plus" : "minus") . "\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picothercopy\" title=\"" . $lang_detail['title_show_or_hide'] . "\" /> " . $lang_details['row_other_copies'] . "</span></a>", "<b>" . $copies_count . $lang_details['text_other_copies'] . " </b><br /><div id='kothercopy' style=\"" . ($copies_count > 5 ? "display: none;" : "display: block;") . "\">" . $s . "</div>", 1);
     }
 }
 if ($row["type"] == "multi") {
     $files_info = "<b>" . $lang_details['text_num_files'] . "</b>" . $row["numfiles"] . $lang_details['text_files'] . "<br />";
     $files_info .= "<span id=\"showfl\"><a href=\"javascript: viewfilelist(" . $id . ")\" >" . $lang_details['text_see_full_list'] . "</a></span><span id=\"hidefl\" style=\"display: none;\"><a href=\"javascript: hidefilelist()\">" . $lang_details['text_hide_list'] . "</a></span>";
 }
 function hex_esc($matches)
 {
     return sprintf("%02x", ord($matches[0]));
 }
 if ($enablenfo_main == 'yes') {