コード例 #1
0
function torrenttable($res, $variant = "index")
{
    global $INSTALLER09, $CURUSER, $lang, $free, $mc1;
    require_once INCL_DIR . 'bbcode_functions.php';
    $htmlout = $prevdate = $free_slot = $free_color = $slots_check = $double_slot = $private = $newgenre = $oldlink = $char = $description = $type = $sort = $row = $youtube = '';
    $count_get = 0;
    /** ALL FREE/DOUBLE **/
    foreach ($free as $fl) {
        switch ($fl['modifier']) {
            case 1:
                $free_display = '[Free]';
                break;
            case 2:
                $free_display = '[Double]';
                break;
            case 3:
                $free_display = '[Free and Double]';
                break;
            case 4:
                $free_display = '[Silver]';
                break;
        }
        $slot = make_freeslots($CURUSER['id'], 'fllslot_');
        $book = make_bookmarks($CURUSER['id'], 'bookmm_');
        $all_free_tag = $fl['modifier'] != 0 && ($fl['expires'] > TIME_NOW || $fl['expires'] == 1) ? ' <a class="info" href="#">
            <b>' . $free_display . '</b> 
            <span>' . ($fl['expires'] != 1 ? '
            Expires: ' . get_date($fl['expires'], 'DATE') . '<br />
            (' . mkprettytime($fl['expires'] - TIME_NOW) . ' to go)</span></a><br />' : 'Unlimited</span></a><br />') : '';
    }
    $oldlink = array();
    foreach ($_GET as $key => $var) {
        if (in_array($key, array('sort', 'type'))) {
            continue;
        }
        if (is_array($var)) {
            foreach ($var as $s_var) {
                $oldlink[] = sprintf('%s=%s', urlencode($key) . '%5B%5D', urlencode($s_var));
            }
        } else {
            $oldlink[] = sprintf('%s=%s', urlencode($key), urlencode($var));
        }
    }
    $oldlink = !empty($oldlink) ? join('&amp;', array_map('htmlsafechars', $oldlink)) . '&amp;' : '';
    $links = array('link1', 'link2', 'link3', 'link4', 'link5', 'link6', 'link7', 'link8', 'link9');
    $i = 1;
    foreach ($links as $link) {
        if (isset($_GET['sort']) && $_GET['sort'] == $i) {
            ${$link} = isset($_GET['type']) && $_GET['type'] == 'desc' ? 'asc' : 'desc';
        } else {
            ${$link} = 'desc';
        }
        $i++;
    }
    $htmlout .= "<!--<div class='global_icon'><img src='images/global.design/torrents.png' alt='' title='Categorys' class='global_image' width='25'/></div>\n    <div class='global_head'>Torrents</div><br />\n    <div class='global_text'><br />-->\n   <table border='1' cellspacing='0' cellpadding='5'>\n   <tr>\n   <td class='colhead' align='center'>{$lang["torrenttable_type"]}</td>\n   <td class='colhead' align='left'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=1&amp;type={$link1}'>{$lang["torrenttable_name"]}</a></td>\n   <td class='colhead' align='left'><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download' title='Download' /></td>";
    $htmlout .= $variant == 'index' ? "<td class='colhead' align='center'><a href='{$INSTALLER09['baseurl']}/bookmarks.php'><img src='{$INSTALLER09['pic_base_url']}bookmarks.png'  border='0' alt='Bookmark' title='Go To My Bookmarks' /></a></td>" : '';
    if ($variant == "mytorrents") {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n";
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n";
    }
    $htmlout .= "<td class='colhead' align='right'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=2&amp;type={$link2}'>{$lang["torrenttable_files"]}</a></td>\n   <td class='colhead' align='right'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=3&amp;type={$link3}'>{$lang["torrenttable_comments"]}</a></td>\n   <td class='colhead' align='center'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=4&amp;type={$link4}'>{$lang["torrenttable_added"]}</a></td>\n   <td class='colhead' align='center'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=5&amp;type={$link5}'>{$lang["torrenttable_size"]}</a></td>\n   <td class='colhead' align='center'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=6&amp;type={$link6}'>{$lang["torrenttable_snatched"]}</a></td>\n   <td class='colhead' align='right'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=7&amp;type={$link7}'>{$lang["torrenttable_seeders"]}</a></td>\n   <td class='colhead' align='right'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=8&amp;type={$link8}'>{$lang["torrenttable_leechers"]}</a></td>";
    if ($variant == 'index') {
        $htmlout .= "<td class='colhead' align='center'><a href='{$_SERVER["PHP_SELF"]}?{$oldlink}sort=9&amp;type={$link9}'>{$lang["torrenttable_uppedby"]}</a></td>\n";
    }
    $htmlout .= "</tr>\n";
    $categories = genrelist();
    foreach ($categories as $key => $value) {
        $change[$value['id']] = array('id' => $value['id'], 'name' => $value['name'], 'image' => $value['image']);
    }
    while ($row = mysqli_fetch_assoc($res)) {
        //== @author StarionTurbo @copyright 2007 @modname Show torrents by day @version v1.0
        if ($CURUSER['split'] == 'yes') {
            if (get_date($row['added'], 'DATE') == $prevdate) {
                $cleandate = '';
            } else {
                $htmlout .= "<tr><td colspan='12' class='colhead' align='left'><b>{$lang['torrenttable_upped']} " . get_date($row['added'], 'DATE') . "</b></td></tr>";
            }
            $prevdate = get_date($row['added'], 'DATE');
        }
        $row['cat_name'] = htmlsafechars($change[$row['category']]['name']);
        $row['cat_pic'] = htmlsafechars($change[$row['category']]['image']);
        /** Freeslot/doubleslot in Use **/
        $id = $row["id"];
        foreach ($slot as $sl) {
            $slots_check = ($sl['torrentid'] == $id && $sl['free'] == 'yes' or $sl['doubleup'] == 'yes');
        }
        if ($row["sticky"] == "yes") {
            $htmlout .= "<tr class='highlight'>\n";
        } else {
            $htmlout .= '<tr class="' . ($free_color && $all_free_tag != '' || $row['free'] != 0 || $slots_check ? 'freeleech_color' : 'browse_color') . '">';
        }
        $htmlout .= "<td align='center' style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            $htmlout .= "<a href='browse.php?cat=" . (int) $row['category'] . "'>";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                $htmlout .= "<img border='0' src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/{$row['cat_pic']}' alt='{$row['cat_name']}' />";
            } else {
                $htmlout .= htmlsafechars($row["cat_name"]);
            }
            $htmlout .= "</a>";
        } else {
            $htmlout .= "-";
        }
        $htmlout .= "</td>\n";
        $dispname = htmlsafechars($row["name"]);
        $smalldescr = !empty($row['description']) ? "<i>[" . htmlsafechars($row['description']) . "]</i>" : "";
        $checked = !empty($row['checked_by']) && $CURUSER['class'] >= UC_USER ? "&nbsp;<img src='{$INSTALLER09['pic_base_url']}mod.gif' width='15' border='0' alt='Checked - by " . htmlsafechars($row['checked_by']) . "' title='Checked - by " . htmlsafechars($row['checked_by']) . "' />" : "";
        $poster = empty($row["poster"]) ? "<img src=\\'{$INSTALLER09['pic_base_url']}noposter.png\\' width=\\'150\\' height=\\'220\\' border=\\'0\\' alt=\\'Poster\\' title=\\'poster\\' />" : "<img src=\\'" . htmlsafechars($row['poster']) . "\\' width=\\'150\\' height=\\'220\\' border=\\'0\\' alt=\\'Poster\\' title=\\'poster\\' />";
        //$rating = empty($row["rating"]) ? "No votes yet":"".ratingpic($row["rating"])."";
        $youtube = !empty($row['youtube']) ? "<a href='" . htmlsafechars($row['youtube']) . "' target='_blank'><img src='{$INSTALLER09['pic_base_url']}youtube.png' width='14' height='14' border='0' alt='Youtube Trailer' title='Youtube Trailer' /></a>" : "";
        if (isset($row["descr"])) {
            $descr = str_replace("\"", "&quot;", readMore($row["descr"], 350, "details.php?id=" . (int) $row["id"] . "&amp;hit=1"));
        }
        $descr = str_replace('&', '&amp;', $descr);
        $htmlout .= "<td align='left'><a href='details.php?";
        if ($variant == "mytorrents") {
            $htmlout .= "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        $htmlout .= "id={$id}";
        if ($variant == "index") {
            $htmlout .= "&amp;hit=1";
        }
        $newgenre = '';
        if (!empty($row['newgenre'])) {
            $newgenre = array();
            $row['newgenre'] = explode(',', $row['newgenre']);
            foreach ($row['newgenre'] as $foo) {
                $newgenre[] = '<a href="browse.php?search=' . trim(strtolower($foo)) . '&amp;searchin=genre">' . $foo . '</a>';
            }
            $newgenre = '<i>' . join(', ', $newgenre) . '</i>';
        }
        $sticky = $row['sticky'] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}sticky.gif' style='border:none' alt='Sticky' title='Sticky !' />" : "";
        $nuked = $row["nuked"] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}nuked.gif' style='border:none' alt='Nuked'  align='right' title='Reason :" . htmlsafechars($row["nukereason"]) . "' />" : "";
        $release_group = $row['release_group'] == "scene" ? "&nbsp;<img src='{$INSTALLER09['pic_base_url']}scene.gif' title='Scene' alt='Scene' style='border:none' />" : ($row['release_group'] == "p2p" ? "&nbsp;<img src='{$INSTALLER09['pic_base_url']}p2p.gif' title='P2P' alt='P2P' />" : "");
        $viponly = $row["vip"] == "1" ? "<img src='{$INSTALLER09['pic_base_url']}star.png' border='0' alt='Vip Torrent' title='Vip Torrent' />" : "";
        $bump = $row['bump'] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}up.gif' width='12px' alt='Re-Animated torrent' title='This torrent was ReAnimated!' />" : "";
        /** FREE Torrent **/
        $free_tag = $row['free'] != 0 ? ' <a class="info" href="#"><b>[FREE]</b> <span>' . ($row['free'] > 1 ? 'Expires: ' . get_date($row['free'], 'DATE') . '<br />(' . mkprettytime($row['free'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />') . '</span></a>' : $all_free_tag;
        /** Silver Torrent **/
        $silver_tag = $row['silver'] != 0 ? ' <a class="info" href="#"><b>[SILVER]</b> <span>' . ($row['silver'] > 1 ? 'Expires: ' . get_date($row['silver'], 'DATE') . '<br />(' . mkprettytime($row['silver'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />') . '</span></a>' : '';
        if (!empty($slot)) {
            foreach ($slot as $sl) {
                if ($sl['torrentid'] == $id && $sl['free'] == 'yes') {
                    $free_slot = 1;
                }
                if ($sl['torrentid'] == $id && $sl['doubleup'] == 'yes') {
                    $double_slot = 1;
                }
                if ($free_slot && $double_slot) {
                    break;
                }
            }
        }
        $free_slot = $free_slot == 1 ? '&nbsp;<img src="' . $INSTALLER09['pic_base_url'] . 'freedownload.gif" width="12px" alt="Free Slot" title="Free Slot in Use" />&nbsp;<small>Free Slot</small>' : '';
        $double_slot = $double_slot == 1 ? '&nbsp;<img src="' . $INSTALLER09['pic_base_url'] . 'doubleseed.gif" width="12px" alt="Double Upload Slot" title="Double Upload Slot in Use" />&nbsp;<small>Double Slot</small>' : '';
        //==
        $Subs = '';
        if (in_array($row["category"], $INSTALLER09['movie_cats']) && !empty($row["subs"])) {
            $subs_array = explode(",", $row["subs"]);
            require_once CACHE_DIR . 'subs.php';
            foreach ($subs_array as $k => $sid) {
                foreach ($subs as $sub) {
                    if ($sub["id"] == $sid) {
                        $Subs = "<img border=\\'0\\' width=\\'16px\\' style=\\'padding:3px;\\' src=\\'{$sub["pic"]}\\' alt=\\'{$sub["name"]}\\' title=\\'{$sub["name"]}\\' />";
                    }
                }
            }
        } else {
            $Subs = "---";
        }
        $htmlout .= "' onmouseover=\"Tip('<b>" . CutName($dispname, 80) . "</b><br /><b>Added:&nbsp;" . get_date($row['added'], 'DATE', 0, 1) . "</b><br /><b>Size:&nbsp;" . mksize(htmlsafechars($row["size"])) . "</b><br /><b>Subtitle:&nbsp;{$Subs}</b><br /><b>Seeders:&nbsp;" . htmlsafechars($row["seeders"]) . "</b><br /><b>Leechers:&nbsp;" . htmlsafechars($row["leechers"]) . "</b><br />{$poster}');\" onmouseout=\"UnTip();\"><b>" . CutName($dispname, 45) . "</b></a>&nbsp;&nbsp;<a href=\"javascript:klappe_descr('descr" . (int) $row["id"] . "');\" ><img src=\"{$INSTALLER09['pic_base_url']}plus.png\" border=\"0\" alt=\"Show torrent info in this page\" title=\"Show torrent info in this page\" /></a>&nbsp;&nbsp;{$youtube}&nbsp;{$viponly}&nbsp;{$release_group}&nbsp;{$sticky}&nbsp;" . ($row['added'] >= $CURUSER['last_browse'] ? " <img src='{$INSTALLER09['pic_base_url']}newb.png' border='0' alt='New !' title='New !' />" : "") . "&nbsp;{$checked}&nbsp;{$free_tag}&nbsp;{$silver_tag}&nbsp;{$nuked}<br />{$free_slot}&nbsp;{$double_slot}&nbsp;{$newgenre}&nbsp;{$bump}&nbsp;{$smalldescr}</td>\n";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='center'><a href=\"download.php?torrent={$id}" . ($CURUSER['ssluse'] == 3 ? "&amp;ssl=1" : "") . "\"><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></td>\n";
        }
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='center'><a href='edit.php?id=" . (int) $row['id'] . "amp;returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "'>{$lang["torrenttable_edit"]}</a></td>\n";
        }
        $htmlout .= $variant == "index" ? "<td align='center'><a href=\"download.php?torrent={$id}" . ($CURUSER['ssluse'] == 3 ? "&amp;ssl=1" : "") . "\"><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></td>" : "";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='right'>";
            if ($row["visible"] == "no") {
                $htmlout .= "<b>{$lang["torrenttable_not_visible"]}</b>";
            } else {
                $htmlout .= "{$lang["torrenttable_visible"]}";
            }
            $htmlout .= "</td>\n";
        }
        /** pdq bookmarks **/
        $booked = '';
        if (!empty($book)) {
            foreach ($book as $bk) {
                if ($bk['torrentid'] == $id) {
                    $booked = 1;
                }
            }
        }
        $rm_status = !$booked ? ' style="display:none;"' : ' style="display:inline;"';
        $bm_status = $booked ? ' style="display:none;"' : ' style="display:inline;"';
        $bookmark = '<span id="bookmark' . $id . '"' . $bm_status . '>
                    <a href="bookmark.php?torrent=' . $id . '&amp;action=add" class="bookmark" name="' . $id . '">
                    <span title="Bookmark it!" class="add_bookmark_b">
                    <img src="' . $INSTALLER09['pic_base_url'] . 'aff_tick.gif" align="top" width="14px" alt="Bookmark it!" title="Bookmark it!" />
                    </span>
                    </a>
                    </span>
                    
                    <span id="remove' . $id . '"' . $rm_status . '>
                    <a href="bookmark.php?torrent=' . $id . '&amp;action=delete" class="remove" name="' . $id . '">
                    <span class="remove_bookmark_b">
                    <img src="' . $INSTALLER09['pic_base_url'] . 'aff_cross.gif" align="top" width="14px" alt="Delete Bookmark!" title="Delete Bookmark!" />
                    </span>
                    </a>
                    </span>';
        if ($variant == "index") {
            $htmlout .= "<td align='right'>{$bookmark}</td>";
        }
        if ($row["type"] == "single") {
            $htmlout .= "<td align='right'>" . (int) $row["numfiles"] . "</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . (int) $row["numfiles"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . (int) $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            $htmlout .= "<td align='right'>" . (int) $row["comments"] . "</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;hit=1&amp;tocomm=1'>" . (int) $row["comments"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;page=0#startcomments'>" . (int) $row["comments"] . "</a></b></td>\n";
            }
        }
        $htmlout .= "<td align='center'><span style='white-space: nowrap;'>" . str_replace(",", "<br />", get_date($row['added'], '')) . "</span></td>\n";
        $htmlout .= "<td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        if ($row["times_completed"] != 1) {
            $_s = "" . $lang["torrenttable_time_plural"] . "";
        } else {
            $_s = "" . $lang["torrenttable_time_singular"] . "";
        }
        $htmlout .= "<td align='center'><a href='snatches.php?id={$id}'>" . number_format($row["times_completed"]) . "<br />{$_s}</a></td>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#seeders'><font color='" . get_slr_color($ratio) . "'>" . (int) $row["seeders"] . "</font></a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["seeders"]) . "' href='peerlist.php?id={$id}#seeders'>" . (int) $row["seeders"] . "</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'><span class='" . linkcolor($row["seeders"]) . "'>" . (int) $row["seeders"] . "</span></td>\n";
        }
        if ($row["leechers"]) {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["leechers"]) . "' href='peerlist.php?id={$id}#leechers'>" . (int) $row["leechers"] . "</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'>0</td>\n";
        }
        if ($variant == "index") {
            $htmlout .= "<td align='center'>" . (isset($row["username"]) ? $row["anonymous"] == "yes" && $CURUSER['class'] < UC_STAFF && $row['owner'] != $CURUSER['id'] ? "<i>" . $lang['torrenttable_anon'] . "</i>" : "<a href='userdetails.php?id=" . (int) $row["owner"] . "'><b>" . htmlsafechars($row["username"]) . "</b></a>" : "<i>(" . $lang["torrenttable_unknown_uploader"] . ")</i>") . "</td>\n";
        }
        $htmlout .= "</tr>\n";
        $htmlout .= "<tr id=\"kdescr" . (int) $row["id"] . "\" style=\"display:none;\"><td width=\"100%\" colspan=\"12\">" . format_comment($descr, false) . "</td></tr>\n";
    }
    $htmlout .= "</table><!--</div>-->\n";
    return $htmlout;
}
コード例 #2
0
ファイル: bookmarks.php プロジェクト: CharlieHD/U-232-V3
function bookmarktable($res, $variant = "index")
{
    global $INSTALLER09, $CURUSER, $lang;
    $htmlout = '';
    $htmlout .= "\r\n   <span>Icon Legend :\r\n   <img src='{$INSTALLER09['pic_base_url']}aff_cross.gif' alt='Delete Bookmark' border='none' /> = Delete Bookmark |\r\n   <img src='{$INSTALLER09['pic_base_url']}zip.gif' alt='Download Bookmark' border='none' /> = Download Torrent |\r\n   <img alt='Bookmark is Private' src='{$INSTALLER09['pic_base_url']}key.gif' border='none'  /> = Bookmark is Private |\r\n   <img src='{$INSTALLER09['pic_base_url']}public.gif' alt='Bookmark is Public' border='none'  /> = Bookmark is Public</span>\r\n   <table border='1' cellspacing='0' cellpadding='5'>\r\n   <tr>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_type"]}</td>\r\n   <td class='colhead' align='left'>{$lang["torrenttable_name"]}</td>";
    $htmlout .= ($variant == 'index' ? '<td class="colhead" align="center">Delete</td><td class="colhead" align="right">' : '') . 'Download</td><td class="colhead" align="right">Share</td>';
    if ($variant == "mytorrents") {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n";
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n";
    }
    $htmlout .= "<td class='colhead' align='right'>{$lang["torrenttable_files"]}</td>\r\n   <td class='colhead' align='right'>{$lang["torrenttable_comments"]}</td>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_added"]}</td>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_size"]}</td>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_snatched"]}</td>\r\n   <td class='colhead' align='right'>{$lang["torrenttable_seeders"]}</td>\r\n   <td class='colhead' align='right'>{$lang["torrenttable_leechers"]}</td>";
    if ($variant == 'index') {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_uppedby"]}</td>\n";
    }
    $htmlout .= "</tr>\n";
    $categories = genrelist();
    foreach ($categories as $key => $value) {
        $change[$value['id']] = array('id' => $value['id'], 'name' => $value['name'], 'image' => $value['image']);
    }
    while ($row = mysqli_fetch_assoc($res)) {
        $row['cat_name'] = htmlsafechars($change[$row['category']]['name']);
        $row['cat_pic'] = htmlsafechars($change[$row['category']]['image']);
        $id = (int) $row["id"];
        $htmlout .= "<tr>\n";
        $htmlout .= "<td align='center' style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            $htmlout .= '<a href="browse.php?cat=' . (int) $row['category'] . '">';
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                $htmlout .= "<img border='0' src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/" . htmlsafechars($row['cat_pic']) . "' alt='" . htmlsafechars($row['cat_name']) . "' />";
            } else {
                $htmlout .= htmlsafechars($row["cat_name"]);
            }
            $htmlout .= "</a>";
        } else {
            $htmlout .= "-";
        }
        $htmlout .= "</td>\n";
        $dispname = htmlsafechars($row["name"]);
        $htmlout .= "<td align='left'><a href='details.php?";
        if ($variant == "mytorrents") {
            $htmlout .= "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        $htmlout .= "id={$id}";
        if ($variant == "index") {
            $htmlout .= "&amp;hit=1";
        }
        $htmlout .= "'><b>{$dispname}</b></a>&nbsp;</td>\n";
        $htmlout .= $variant == "index" ? "<td align='center'><a href='bookmark.php?torrent={$id}&amp;action=delete'><img src='{$INSTALLER09['pic_base_url']}aff_cross.gif' border='0' alt='Delete Bookmark!' title='Delete Bookmark!' /></a></td>" : "";
        $htmlout .= $variant == "index" ? "<td align='center'><a href='download.php?torrent={$id}'><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download Bookmark!' title='Download Bookmark!' /></a></td>" : "";
        $bm = sql_query("SELECT * FROM bookmarks WHERE torrentid=" . sqlesc($id) . " && userid=" . sqlesc($CURUSER['id']));
        $bms = mysqli_fetch_assoc($bm);
        if ($bms['private'] == 'yes' && $bms['userid'] == $CURUSER['id']) {
            $makepriv = "<a href='bookmark.php?torrent={$id}&amp;action=public'><img src='{$INSTALLER09['pic_base_url']}key.gif' border='0' alt='Mark Bookmark Public!' title='Mark Bookmark Public!' /></a>";
            $htmlout .= "" . ($variant == "index" ? "<td align='center'>{$makepriv}</td>" : "");
        } elseif ($bms['private'] == 'no' && $bms['userid'] == $CURUSER['id']) {
            $makepriv = "<a href='bookmark.php?torrent=" . $id . "&amp;action=private'><img src='{$INSTALLER09['pic_base_url']}public.gif' border='0' alt='Mark Bookmark Private!' title='Mark Bookmark Private!' /></a>";
            $htmlout .= "" . ($variant == "index" ? "<td align='center'>{$makepriv}</td>" : "");
        }
        if ($variant == "mytorrents") {
            $htmlout .= "</td><td align='center'><a href='edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;id=" . (int) $row["id"] . "'>{$lang["torrenttable_edit"]}</a>\n";
        }
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='right'>";
            if ($row["visible"] == "no") {
                $htmlout .= "<b>" . $lang["torrenttable_not_visible"] . "</b>";
            } else {
                $htmlout .= "" . $lang["torrenttable_visible"] . "";
            }
            $htmlout .= "</td>\n";
        }
        if ($row["type"] == "single") {
            $htmlout .= "<td align='right'>" . (int) $row['numfiles'] . "</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . (int) $row['numfiles'] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . (int) $row['numfiles'] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            $htmlout .= "<td align='right'>" . (int) $row['comments'] . "</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;hit=1&amp;tocomm=1'>" . (int) $row['comments'] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;page=0#startcomments'>" . (int) $row['comments'] . "</a></b></td>\n";
            }
        }
        $htmlout .= "<td align='center'><span style='white-space: nowrap;'>" . str_replace(",", "<br />", get_date($row['added'], '')) . "</span></td>\n";
        $htmlout .= "<td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        if ($row["times_completed"] != 1) {
            $_s = "" . $lang["torrenttable_time_plural"] . "";
        } else {
            $_s = "" . $lang["torrenttable_time_singular"] . "";
        }
        $htmlout .= "<td align='center'><a href='snatches.php?id={$id}'>" . number_format($row["times_completed"]) . "<br />{$_s}</a></td>\n";
        if ((int) $row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = (int) $row["seeders"] / (int) $row["leechers"];
                } else {
                    $ratio = 1;
                }
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#seeders'><font color='" . get_slr_color($ratio) . "'>" . (int) $row['seeders'] . "</font></a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["seeders"]) . "' href='peerlist.php?id={$id}#seeders'>" . (int) $row['seeders'] . "</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'><span class='" . linkcolor($row["seeders"]) . "'>" . (int) $row['seeders'] . "</span></td>\n";
        }
        if ((int) $row["leechers"]) {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["leechers"]) . "' href='peerlist.php?id={$id}#leechers'>" . (int) $row['leechers'] . "</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'>0</td>\n";
        }
        if ($variant == "index") {
            $htmlout .= "<td align='center'>" . (isset($row["username"]) ? "<a href='userdetails.php?id=" . (int) $row['owner'] . "'><b>" . htmlsafechars($row["username"]) . "</b></a>" : "<i>(" . $lang["torrenttable_unknown_uploader"] . ")</i>") . "</td>\n";
        }
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
コード例 #3
0
function torrenttable($res, $variant = "index")
{
    global $TBDEV, $CURUSER, $lang, $free;
    $htmlout = '';
    /** ALL FREE/DOUBLE **/
    foreach ($free as $fl) {
        switch ($fl['modifier']) {
            case 1:
                $free_display = '[Free]';
                break;
            case 2:
                $free_display = '[Double]';
                break;
            case 3:
                $free_display = '[Free and Double]';
                break;
        }
        $all_free_tag = $fl['modifier'] != 0 && ($fl['expires'] > TIME_NOW || $fl['expires'] == 1) ? ' <a class="info" href="#">
            <b>' . $free_display . '</b> 
            <span>' . ($fl['expires'] != 1 ? '
            Expires: ' . get_date($fl['expires'], 'DATE') . '<br />
            (' . mkprettytime($fl['expires'] - time()) . ' to go)</span></a><br />' : 'Unlimited</span></a><br />') : '';
    }
    $prevdate = "";
    $count_get = 0;
    $oldlink = $char = $description = $type = $sort = $row = '';
    foreach ($_GET as $get_name => $get_value) {
        $get_name = strip_tags(str_replace(array("\"", "'"), array("", ""), $get_name));
        $get_value = strip_tags(str_replace(array("\"", "'"), array("", ""), $get_value));
        if ($get_name != "sort" && $get_name != "type") {
            if ($count_get > 0) {
                $oldlink = $oldlink . "&amp;" . $get_name . "=" . $get_value;
            } else {
                $oldlink = $oldlink . $get_name . "=" . $get_value;
            }
            $count_get++;
        }
    }
    if ($count_get > 0) {
        $oldlink = $oldlink . "&amp;";
    }
    $links = array('link1', 'link2', 'link3', 'link4', 'link5', 'link6', 'link7', 'link8', 'link9');
    $i = 1;
    foreach ($links as $link) {
        if (isset($_GET['sort']) && $_GET['sort'] == $i) {
            ${$link} = isset($_GET['type']) && $_GET['type'] == 'desc' ? 'asc' : 'desc';
        } else {
            ${$link} = 'desc';
        }
        $i++;
    }
    $htmlout .= "<table border='1' cellspacing='0' cellpadding='5'>\r\n   <tr>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_type"]}</td>\r\n   <td class='colhead' align='left'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=1&amp;type={$link1}'>{$lang["torrenttable_name"]}</a></td>\r\n   <td class='colhead' align='left'><img src='" . $TBDEV['pic_base_url'] . "zip.gif' border='0' alt='Download' title='Download' /></td>";
    $htmlout .= $variant == 'index' ? "<td class='colhead' align='center'><a href='" . $TBDEV['baseurl'] . "/bookmarks.php'><img src='" . $TBDEV['pic_base_url'] . "bookmark.gif'  border='0' alt='Bookmark' title='Go To My Bookmarks' /></a></td>" : '';
    if ($variant == "mytorrents") {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n";
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n";
    }
    $htmlout .= "<td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=2&amp;type={$link2}'>{$lang["torrenttable_files"]}</a></td>\r\n   <td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=3&amp;type={$link3}'>{$lang["torrenttable_comments"]}</a></td>\r\n   <td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=4&amp;type={$link4}'>{$lang["torrenttable_added"]}</a></td>\r\n   <td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=5&amp;type={$link5}'>{$lang["torrenttable_size"]}</a></td>\r\n   <td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=6&amp;type={$link6}'>{$lang["torrenttable_snatched"]}</a></td>\r\n   <td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=7&amp;type={$link7}'>{$lang["torrenttable_seeders"]}</a></td>\r\n   <td class='colhead' align='right'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=8&amp;type={$link8}'>{$lang["torrenttable_leechers"]}</a></td>";
    if ($variant == 'index') {
        $htmlout .= "<td class='colhead' align='center'><a href='{$TBDEV['baseurl']}/browse.php?{$oldlink}sort=9&amp;type={$link9}'>{$lang["torrenttable_uppedby"]}</a></td>\n";
    }
    $htmlout .= "</tr>\n";
    while ($row = mysql_fetch_assoc($res)) {
        $id = $row["id"];
        if ($row["sticky"] == "yes") {
            $htmlout .= "<tr class='highlight'>\n";
        } else {
            $htmlout .= "<tr>\n";
        }
        $htmlout .= "<td align='center' style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            $htmlout .= "<a href='browse.php?cat={$row['category']}'>";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                $htmlout .= "<img border='0' src='{$TBDEV['pic_base_url']}caticons/{$row['cat_pic']}' alt='{$row['cat_name']}' />";
            } else {
                $htmlout .= $row["cat_name"];
            }
            $htmlout .= "</a>";
        } else {
            $htmlout .= "-";
        }
        $htmlout .= "</td>\n";
        $dispname = htmlspecialchars($row["name"]);
        $checked = !empty($row['checked_by']) && $CURUSER['class'] >= UC_USER ? "&nbsp;<img src='{$TBDEV['pic_base_url']}mod.gif' width='15' border='0' alt='Checked - by " . htmlspecialchars($row['checked_by']) . "' title='Checked - by " . htmlspecialchars($row['checked_by']) . "' />" : "";
        $poster = empty($row["poster"]) ? "<img src=\\'{$TBDEV['pic_base_url']}noposter.png\\' width=\\'150\\' height=\\'220\\' border=\\'0\\' alt=\\'Poster\\' title=\\'poster\\' />" : "<img src=\\'" . htmlspecialchars($row['poster']) . "\\' width=\\'150\\' height=\\'220\\' border=\\'0\\' alt=\\'Poster\\' title=\\'poster\\' />";
        if ($row["descr"]) {
            $descr = str_replace("\"", "&quot;", readMore($row["descr"], 350, "details.php?id=" . $row["id"] . "&amp;hit=1"));
        }
        $htmlout .= "<td align='left'><a href='details.php?";
        $htmlout .= "<td align='left'><a href='details.php?";
        if ($variant == "mytorrents") {
            $htmlout .= "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        $htmlout .= "id={$id}";
        if ($variant == "index") {
            $htmlout .= "&amp;hit=1";
        }
        $sticky = $row['sticky'] == "yes" ? "<img src='{$TBDEV['pic_base_url']}sticky.gif' border='0' alt='Sticky' title='Sticky !' />" : "";
        $nuked = $row["nuked"] == "yes" ? "<img src='{$TBDEV['pic_base_url']}nuked.gif' style='border:none' alt='Nuked'  align='right' title='Reason :" . htmlspecialchars($row["nukereason"]) . "' />" : "";
        /** FREE Torrent **/
        $free_tag = $row['free'] != 0 ? ' <a class="info" href="#"><b>[FREE]</b> <span>' . ($row['free'] > 1 ? 'Expires: ' . get_date($row['free'], 'DATE') . '<br />(' . mkprettytime($row['free'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />') . '</span></a>' : $all_free_tag;
        /** Freeslot Slot in Use **/
        $isdlfree = $row['tid'] == $id && $row['uid'] == $CURUSER['id'] && $row['freeslot'] != 0 ? '<a class="info" href="#"><img src="' . $TBDEV['baseurl'] . '/pic/freedownload.gif" alt="" /><span>Freeleech slot in use<br />' . ($row['freeslot'] != 0 ? $row['freeslot'] > 1 ? 'Expires: ' . get_date($row['freeslot'], 'DATE') . '<br />(' . mkprettytime($row['freeslot'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />' : '') . '</span></a>' : '';
        /** Double Upload Slot in Use **/
        $isdouble = $row['tid'] == $id && $row['uid'] == $CURUSER['id'] && $row['doubleup'] != 0 ? ' <a class="info" href="#"><img src="' . $TBDEV['baseurl'] . '/pic/doubleseed.gif" alt="" /><span>Double Upload slot in use<br />' . ($row['doubleup'] != 0 ? $row['doubleup'] > 1 ? 'Expires: ' . get_date($row['doubleup'], 'DATE') . '<br />(' . mkprettytime($row['doubleup'] - TIME_NOW) . ' to go)<br />' : 'Unlimited<br />' : '') . '</span></a>' : '';
        $htmlout .= "' onmouseover=\"Tip('<b>" . CutName($dispname, 80) . "</b><br /><b>Added:&nbsp;" . get_date($row['added'], 'DATE', 0, 1) . "</b><br /><b>Size:&nbsp;" . mksize(htmlspecialchars($row["size"])) . "</b><br /><b>Seeders:&nbsp;" . htmlspecialchars($row["seeders"]) . "</b><br /><b>Leechers:&nbsp;" . htmlspecialchars($row["leechers"]) . "</b><br />{$poster}');\" onmouseout=\"UnTip();\"><b>" . CutName($dispname, 45) . "</b></a>&nbsp;&nbsp;<a href=\"javascript:klappe_descr('descr" . $row["id"] . "');\" ><img src=\"/pic/plus.gif\" border=\"0\" alt=\"Show torrent info in this page\" title=\"Show torrent info in this page\" /></a>&nbsp;&nbsp;{$sticky}&nbsp;" . ($row['added'] >= $CURUSER['last_browse'] ? " <img src='{$TBDEV['pic_base_url']}newb.png' border='0' alt='New !' title='New !' />" : "") . "&nbsp;{$checked}&nbsp;{$free_tag}&nbsp;{$nuked}<br />\n" . $isdlfree . $isdouble . "</td>\n";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='center'><a href=\"download.php?torrent=" . $id . "\"><img src='" . $TBDEV['pic_base_url'] . "zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></td>\n";
        }
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='center'><a href='edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;id={$row['id']}'>" . $lang["torrenttable_edit"] . "</a></td>\n";
        }
        $htmlout .= $variant == "index" ? "<td align='center'><a href=\"download.php?torrent=" . $id . "\"><img src='" . $TBDEV['pic_base_url'] . "zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></td>" : "";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='right'>";
            if ($row["visible"] == "no") {
                $htmlout .= "<b>" . $lang["torrenttable_not_visible"] . "</b>";
            } else {
                $htmlout .= "" . $lang["torrenttable_visible"] . "";
            }
            $htmlout .= "</td>\n";
        }
        $bookmarked = !isset($row["bookmark"]) ? "<a href='bookmark.php?torrent=" . $id . "&amp;action=add'><img src='" . $TBDEV['pic_base_url'] . "bookmark.gif' border='0' alt='Bookmark it!' title='Bookmark it!' /></a>" : "<a href='bookmark.php?torrent=" . $id . "&amp;action=delete'><img src='" . $TBDEV['pic_base_url'] . "plus2.gif' border='0' alt='Delete Bookmark!' title='Delete Bookmark!' /></a>";
        if ($variant == "index") {
            $htmlout .= "<td align='right'>{$bookmarked}</td>";
        }
        if ($row["type"] == "single") {
            $htmlout .= "<td align='right'>{$row["numfiles"]}</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . $row["numfiles"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            $htmlout .= "<td align='right'>{$row["comments"]}</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;hit=1&amp;tocomm=1'>" . $row["comments"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;page=0#startcomments'>" . $row["comments"] . "</a></b></td>\n";
            }
        }
        $htmlout .= "<td align='center'><span style='white-space: nowrap;'>" . str_replace(",", "<br />", get_date($row['added'], '')) . "</span></td>\n";
        $htmlout .= "<td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        if ($row["times_completed"] != 1) {
            $_s = "" . $lang["torrenttable_time_plural"] . "";
        } else {
            $_s = "" . $lang["torrenttable_time_singular"] . "";
        }
        $htmlout .= "<td align='center'><a href='snatches.php?id={$id}'>" . number_format($row["times_completed"]) . "<br />{$_s}</a></td>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#seeders'>\r\n                <font color='" . get_slr_color($ratio) . "'>{$row["seeders"]}</font></a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["seeders"]) . "' href='peerlist.php?id={$id}#seeders'>{$row["seeders"]}</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'><span class='" . linkcolor($row["seeders"]) . "'>" . $row["seeders"] . "</span></td>\n";
        }
        if ($row["leechers"]) {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["leechers"]) . "' href='peerlist.php?id={$id}#leechers'>{$row["leechers"]}</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'>0</td>\n";
        }
        if ($variant == "index") {
            if ($row["anonymous"] == "yes") {
                $htmlout .= "<td align='center'><i>Anonymous</i></td>\n";
            } else {
                $htmlout .= "<td align='center'>" . (isset($row["username"]) ? "<a href='{$TBDEV['baseurl']}/userdetails.php?id=" . $row["owner"] . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>" : "<i>(" . $lang["torrenttable_unknown_uploader"] . ")</i>") . "</td>\n";
            }
        }
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
コード例 #4
0
function torrenttable($res, $variant = "index")
{
    global $pic_base_url, $CURUSER;
    $wait = 0;
    #Morgan: Remove wait times
    /*
    	if ($CURUSER["class"] < UC_VIP)
      {
    	  $gigs = $CURUSER["uploaded"] / (1024*1024*1024);
    	  $ratio = (($CURUSER["downloaded"] > 0) ? ($CURUSER["uploaded"] / $CURUSER["downloaded"]) : 0);
    	  if ($ratio < 0.5 || $gigs < 5) $wait = 48;
    	  elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 24;
    	  elseif ($ratio < 0.8 || $gigs < 8) $wait = 12;
    	  elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 6;
    	  else $wait = 0;
      }
    */
    ?>
<table border="1" cellspacing="0" cellpadding="5">

<tr>

<td class="colhead" align="center">Category</td>
<td class="colhead" align="left">Name</td>
<!--<td class="heading" align="left">DL</td>-->
<?php 
    if ($wait) {
        print "<td class=\"colhead\" align=\"center\">Wait</td>\n";
    }
    if ($variant == "mytorrents") {
        print "<td class=\"colhead\" align=\"center\">Edit</td>\n";
        print "<td class=\"colhead\" align=\"center\">Visible</td>\n";
    }
    ?>
<td class="colhead" align="right">Files</td>
<td class="colhead" align="right">Comments</td>
<!--<td class="colhead" align="center">Rating</td>-->
<td class="colhead" align="center">Added</td>
<!--<td class="colhead" align="center">TTL</td>-->
<td class="colhead" align="center">Size</td>
<!--
<td class="colhead" align="right">Views</td>
<td class="colhead" align="right">Hits</td>
-->
<td class="colhead" align="center">Downloaded</td>
<td class="colhead" align="right">Uploaders</td>
<td class="colhead" align="right">Downloaders</td>
<td class="colhead" align="center">License</td>
<?php 
    if ($variant == "index") {
        print "<td class=\"colhead\" align='center'>Upped&nbsp;by</td>\n";
    }
    print "</tr>\n";
    while ($row = mysql_fetch_assoc($res)) {
        $id = $row["id"];
        print "<tr>\n";
        print "<td align='center' style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            print "<a href=\"browse.php?cat=" . $row["category"] . "\">";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                #              print("<img border=\"0\" src=\"{$pic_base_url}caticons/{$row['cat_pic']}\" alt=\"{$row['cat_name']}\" />");
                print $row["cat_name"];
            } else {
                print $row["cat_name"];
            }
            print "</a>";
        } else {
            print "-";
        }
        print "</td>\n";
        $dispname = htmlspecialchars($row["name"]);
        print "<td align='left'><a href=\"details.php?";
        if ($variant == "mytorrents") {
            print "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        print "id={$id}";
        if ($variant == "index") {
            print "&amp;hit=1";
        }
        print "\"><b>{$dispname}</b></a>\n";
        if ($wait) {
            $elapsed = floor((time() - $row["added"]) / 3600);
            if ($elapsed < $wait) {
                $color = dechex(floor(127 * ($wait - $elapsed) / 48 + 128) * 65536);
                print "<td align='center'><span style=\"white-space: nowrap;\"><a href=\"faq.php#dl8\"><font color=\"{$color}\">" . number_format($wait - $elapsed) . " h</font></a></span></td>\n";
            } else {
                print "<td align='center'><span style=\"white-space: nowrap;\">None</span></td>\n";
            }
        }
        /*
                if ($row["nfoav"] && get_user_class() >= UC_POWER_USER)
                  print("<a href='viewnfo.php?id=$row[id]''><img src=\"{$pic_base_url}viewnfo.gif" border='0' alt='View NFO' /></a>\n");
                if ($variant == "index")
                    print("<a href=\"download.php/$id/" . rawurlencode($row["filename"]) . "\"><img src=\"{$pic_base_url}download.gif\" border='0' alt='Download' /></a>\n");
        
                else */
        if ($variant == "mytorrents") {
            print "</td><td align=\"center\"><a href=\"edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;id=" . $row["id"] . "\">edit</a>\n";
        }
        print "</td>\n";
        if ($variant == "mytorrents") {
            print "<td align=\"right\">";
            if ($row["visible"] == "no") {
                print "<b>no</b>";
            } else {
                print "yes";
            }
            print "</td>\n";
        }
        if ($row["type"] == "single") {
            print "<td align=\"right\">" . $row["numfiles"] . "</td>\n";
        } else {
            if ($variant == "index") {
                print "<td align=\"right\"><b><a href=\"filelist.php?id={$id}\">" . $row["numfiles"] . "</a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a href=\"filelist.php?id={$id}\">" . $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            print "<td align=\"right\">" . $row["comments"] . "</td>\n";
        } else {
            if ($variant == "index") {
                print "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;hit=1&amp;tocomm=1\">" . $row["comments"] . "</a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;page=0#startcomments\">" . $row["comments"] . "</a></b></td>\n";
            }
        }
        /*
                print("<td align=\"center\">");
                if (!isset($row["rating"]))
                    print("---");
                else {
                    $rating = round($row["rating"] * 2) / 2;
                    $rating = ratingpic($row["rating"]);
                    if (!isset($rating))
                        print("---");
                    else
                        print($rating);
                }
                print("</td>\n");
        */
        print "<td align='center'><span style=\"white-space: nowrap;\">" . str_replace(",", "<br />", get_date($row['added'], '')) . "</span></td>\n";
        #	$ttl = (28*24) - floor((time() - $row["added"]) / 3600);
        #	if ($ttl == 1) $ttl .= "<br />hour"; else $ttl .= "<br />hours";
        #print("<td align='center'>$ttl</td>\n");
        print "<td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        //        print("<td align=\"right\">" . $row["views"] . "</td>\n");
        //        print("<td align=\"right\">" . $row["hits"] . "</td>\n");
        $_s = "";
        if ($row["times_completed"] != 1) {
            $_s = "s";
        }
        print "<td align='center'>" . number_format($row["times_completed"]) . "<br />time{$_s}</td>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                print "<td align='right'><b><a href='peerlist.php?id={$id}#seeders'><font color='" . get_slr_color($ratio) . "'>" . $row["seeders"] . "</font></a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a class=\"" . linkcolor($row["seeders"]) . "\" href=\"peerlist.php?id={$id}#seeders\">" . $row["seeders"] . "</a></b></td>\n";
            }
        } else {
            print "<td align=\"right\"><span class=\"" . linkcolor($row["seeders"]) . "\">" . $row["seeders"] . "</span></td>\n";
        }
        if ($row["leechers"]) {
            if ($variant == "index") {
                print "<td align='right'><b><a href='peerlist.php?id={$id}#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a class=\"" . linkcolor($row["leechers"]) . "\" href=\"peerlist.php?id={$id}#leechers\">" . $row["leechers"] . "</a></b></td>\n";
            }
        } else {
            print "<td align=\"right\">0</td>\n";
        }
        #license
        print "<td align='center'><a href=\"" . $row["lic_url"] . "\"target=\"_blank\">" . $row["lic_name"] . "</a></td>";
        if ($variant == "index") {
            print "<td align='center'>" . (isset($row["username"]) ? "<a href='browse.php?user="******"owner"] . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>" : "<i>(unknown)</i>") . "</td>\n";
        }
        print "</tr>\n";
    }
    print "</table>\n";
    //return $rows;
}
コード例 #5
0
function torrenttable($res, $variant = "index")
{
    global $INSTALLER09, $CURUSER, $lang, $free, $mc1;
    require_once INCL_DIR . 'bbcode_functions.php';
    require_once CLASS_DIR . 'class_user_options_2.php';
    $htmlout = $prevdate = $nuked = $free_slot = $freetorrent = $free_color = $slots_check = $double_slot = $private = $newgenre = $oldlink = $char = $description = $type = $sort = $row = $youtube = '';
    $count_get = 0;
    /** ALL FREE/DOUBLE **/
    foreach ($free as $fl) {
        switch ($fl['modifier']) {
            case 1:
                $free_display = '[Free]';
                break;
            case 2:
                $free_display = '[Double]';
                break;
            case 3:
                $free_display = '[Free and Double]';
                break;
            case 4:
                $free_display = '[Silver]';
                break;
        }
        $slot = make_freeslots($CURUSER['id'], 'fllslot_');
        $book = make_bookmarks($CURUSER['id'], 'bookmm_');
        $all_free_tag = $fl['modifier'] != 0 && ($fl['expires'] > TIME_NOW || $fl['expires'] == 1) ? ' <a class="info" href="#">
            <b>' . $free_display . '</b> 
            <span>' . ($fl['expires'] != 1 ? '
            Expires: ' . get_date($fl['expires'], 'DATE') . '<br />            (' . mkprettytime($fl['expires'] - TIME_NOW) . ' to go)</span></a><br />' : 'Unlimited</span></a><br />') : '';
    }
    $oldlink = array();
    foreach ($_GET as $key => $var) {
        if (in_array($key, array('sort', 'type'))) {
            continue;
        }
        if (is_array($var)) {
            foreach ($var as $s_var) {
                $oldlink[] = sprintf('%s=%s', urlencode($key) . '%5B%5D', urlencode($s_var));
            }
        } else {
            $oldlink[] = sprintf('%s=%s', urlencode($key), urlencode($var));
        }
    }
    $oldlink = !empty($oldlink) ? join('&amp;', array_map('htmlsafechars', $oldlink)) . '&amp;' : '';
    $links = array('link1', 'link2', 'link3', 'link4', 'link5', 'link6', 'link7', 'link8', 'link9');
    $i = 1;
    foreach ($links as $link) {
        if (isset($_GET['sort']) && $_GET['sort'] == $i) {
            ${$link} = isset($_GET['type']) && $_GET['type'] == 'desc' ? 'asc' : 'desc';
        } else {
            ${$link} = 'desc';
        }
        $i++;
    }
    while ($row = mysqli_fetch_assoc($res)) {
        //==
        if ($CURUSER['opt2'] & user_options_2::SPLIT) {
            if (get_date($row['added'], 'DATE') == $prevdate) {
                $cleandate = '';
            } else {
                $htmlout .= "<!--<b>{$lang['torrenttable_upped']} " . get_date($row['added'], 'DATE') . "</b>-->";
            }
            $prevdate = get_date($row['added'], 'DATE');
        }
        $imdb = "<b>IMDB:&nbsp;" . (preg_match('/imdb.com.*tt\\d{2,}/i', $row['url']) ? "<a href='{$row['url']}' target='_blank'>Click Here</a>" : "None listed") . "</b><br />";
        $htmlout .= "<div class='container'><div class='row'>\n<div class='col-sm-3 col-sm-offset-0 panel panel-default browsep'>";
        $htmlout .= "<br /><table class='table table-bordered' >";
        $id = (int) $row["id"];
        foreach ($slot as $sl) {
            $slots_check = ($sl['torrentid'] == $id && $sl['free'] == 'yes' or $sl['doubleup'] == 'yes');
        }
        if ($row["sticky"] == "yes") {
            $htmlout .= "<tr class='highlight'>\n";
        } else {
            $htmlout .= '<tr class="' . ($free_color && $all_free_tag != '' || $row['free'] != 0 || $slots_check ? 'freeleech_color' : 'browse_color') . '">';
        }
        $htmlout .= "";
        $dispname = htmlsafechars($row["name"]);
        $htmlout .= "<div style='display:block; height:5px;'></div>\n<a href='details.php?id={$id}'><div class='text-center squashp browsed'>{$dispname}</a></div><div style='display:block; height:5px;'></div>";
        $categories = genrelist();
        foreach ($categories as $key => $value) {
            $change[$value['id']] = array('id' => $value['id'], 'name' => $value['name'], 'image' => $value['image'], 'min_class' => $value['min_class']);
        }
        $row['cat_name'] = htmlsafechars($change[$row['category']]['name']);
        $row['cat_pic'] = htmlsafechars($change[$row['category']]['image']);
        $row['min_class'] = htmlsafechars($change[$row['category']]['min_class']);
        $htmlout .= "<div style='display:block; height:5px;'></div><a href='details.php?id={$id}'><div class='text-center browsepd'>";
        if (!empty($row["poster"]) && isset($row["cat_pic"]) && $row["cat_pic"] != "") {
            $htmlout .= "<img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/{$row['cat_pic']}' alt='{$row['cat_name']}' class='overlay'><img src='" . htmlsafechars($row["poster"]) . "' alt='Poster' title='Poster' class='tt''>";
        }
        if (empty($row["poster"]) && isset($row["cat_pic"]) && $row["cat_pic"] != "") {
            $htmlout .= "<img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/{$row['cat_pic']}' alt='{$row['cat_name']}' class='overlaynp'><img src='{$INSTALLER09['pic_base_url']}noposter.png' class='tt'><br />";
        }
        $htmlout .= "</div></a><div style='display:block; height:5px;'></div>";
        $htmlout .= "<div class='text-center browsepd'>";
        if ($variant == "mytorrents") {
            $htmlout .= "<a class='btn btn-primary' href=\"download.php?torrent={$id}" . ($CURUSER['ssluse'] == 3 ? "&amp;ssl=1" : "") . "\"><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a>\n";
        }
        if ($variant == "mytorrents") {
            $htmlout .= "<button class='btn btn-primary'><a href='edit.php?id=" . (int) $row['id'] . "amp;returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "'>{$lang["torrenttable_edit"]}</a></button>\n";
        }
        $htmlout .= $variant == "index" ? "DOWNLOAD&nbsp;<a class='btn btn-primary' href=\"download.php?torrent={$id}" . ($CURUSER['ssluse'] == 3 ? "&amp;ssl=1" : "") . "\"><img src='{$INSTALLER09['pic_base_url']}zip.gif' border='0' alt='Download This Torrent!' title='Download This Torrent!' /></a></button>" : "";
        if ($variant == "mytorrents") {
            $htmlout .= "test";
            if ($row["visible"] == "no") {
                $htmlout .= "<b>{$lang["torrenttable_not_visible"]}</b>";
            } else {
                $htmlout .= "{$lang["torrenttable_visible"]}";
            }
            $htmlout .= "<!--<br />-->";
        }
        $htmlout .= "</div>";
        $booked = '';
        if (!empty($book)) {
            foreach ($book as $bk) {
                if ($bk['torrentid'] == $id) {
                    $booked = 1;
                }
            }
        }
        $rm_status = !$booked ? ' style="display:none;"' : ' style="display:inline;"';
        $bm_status = $booked ? ' style="display:none;"' : ' style="display:inline;"';
        $bookmark = '<div style="display:block; height:5px;"></div><div class="browsemp">
<b>Bookmark This:</b>&nbsp;<span id="bookmark' . $id . '"' . $bm_status . '><a href="bookmark.php?torrent=' . $id . '&amp;action=add" class="bookmark" name="' . $id . '"><span title="Bookmark it!" class="add_bookmark_b">
                    <img src="' . $INSTALLER09['pic_base_url'] . 'aff_tick.gif" align="top" width="14px" alt="Bookmark it!" title="Bookmark it!" />
                    </span>
                    </a>
                    </span>
                    <span id="remove' . $id . '"' . $rm_status . '>
                    <a href="bookmark.php?torrent=' . $id . '&amp;action=delete" class="remove" name="' . $id . '">
                    <span class="remove_bookmark_b"><img src="' . $INSTALLER09['pic_base_url'] . 'aff_cross.gif" align="top" width="14px" alt="Delete Bookmark!" title="Delete Bookmark!" />
                    </span>
                    </a>
                    </span><br />';
        if ($variant == "index") {
            $htmlout .= "{$bookmark}";
        }
        $Subs = '';
        if (in_array($row["category"], $INSTALLER09['movie_cats']) && !empty($row["subs"])) {
            $subs_array = explode(",", $row["subs"]);
            require_once CACHE_DIR . 'subs.php';
            foreach ($subs_array as $k => $sid) {
                foreach ($subs as $sub) {
                    if ($sub["id"] == $sid) {
                        $Subs = "<img border='0' width='16px' style='padding:3px;' src='" . htmlsafechars($sub["pic"]) . "' alt='" . htmlsafechars($sub["name"]) . "' title='" . htmlsafechars($sub["name"]) . "' />";
                    }
                }
            }
        } else {
            $Subs = "---";
        }
        if ($row["type"] == "single") {
            $htmlout .= "<b>Files:</b>" . (int) $row["numfiles"] . "<br />";
        } else {
            if ($variant == "index") {
                $htmlout .= "<b>Files:&nbsp;<a href='filelist.php?id={$id}'>" . (int) $row["numfiles"] . "</a></b><br />";
            } else {
                $htmlout .= "<b>Files:&nbsp;<a href='filelist.php?id={$id}'>" . (int) $row["numfiles"] . "</a></b><br />";
            }
        }
        $htmlout .= "Size:&nbsp;" . str_replace(" ", " ", mksize($row["size"])) . "\n";
        if ($row["times_completed"] != 1) {
            $_s = "" . $lang["torrenttable_time_plural"] . "";
        } else {
            $_s = "" . $lang["torrenttable_time_singular"] . "";
        }
        $What_Script_S = XBT_TRACKER == true ? 'snatches_xbt.php?id=' : 'snatches.php?id=';
        $htmlout .= "<br />Snatches:<a href='{$What_Script_S}" . "{$id}'>{$_s}&nbsp;<b>downloaded</b>&nbsp;" . number_format($row["times_completed"]) . "</a>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                $What_Script_P = XBT_TRACKER == true ? 'peerlist_xbt.php?id=' : 'peerlist.php?id=';
                $htmlout .= "<br /><b>Seeders:</b>&nbsp;<b><a href='{$What_Script_P}" . "{$id}#seeders'><font color='" . get_slr_color($ratio) . "'>" . (int) $row["seeders"] . "</font></a></b>&nbsp;\n";
            } else {
                $What_Script_P = XBT_TRACKER == true ? 'peerlist_xbt.php?id=' : 'peerlist.php?id=';
                $htmlout .= "<br /><b>Seeders:</b>&nbsp;<b><a class='" . linkcolor($row["seeders"]) . "' href='{$What_Script_P}" . "{$id}#seeders'>" . (int) $row["seeders"] . "</a></b>&nbsp;\n";
            }
        } else {
            $htmlout .= "<br /><b>Seeders:</b>&nbsp;<span class='" . linkcolor($row["seeders"]) . "'>" . (int) $row["seeders"] . "</span>\n";
        }
        if ($row["leechers"]) {
            $What_Script_P = XBT_TRACKER == true ? 'peerlist_xbt.php?id=' : 'peerlist.php?id=';
            if ($variant == "index") {
                $htmlout .= "<b><a href='{$What_Script_P}" . "{$id}#leechers'>" . number_format($row["leechers"]) . "</a></b>\n";
            } else {
                $htmlout .= "<b><a class='" . linkcolor($row["leechers"]) . "' href='{$What_Script_P}" . "{$id}#leechers'>" . (int) $row["leechers"] . "</a></b>\n";
            }
        } else {
            $htmlout .= "<b>Leechers:</b>&nbsp;0\n";
        }
        if ($variant == "index") {
            $htmlout .= "<br /><b>Upped By:</b>&nbsp;" . (isset($row["username"]) ? $row["anonymous"] == "yes" && $CURUSER['class'] < UC_STAFF && $row['owner'] != $CURUSER['id'] ? "<i>" . $lang['torrenttable_anon'] . "</i>" : "<a href='userdetails.php?id=" . (int) $row["owner"] . "'><b>" . htmlsafechars($row["username"]) . "</b></a>" : "<i>(" . $lang["torrenttable_unknown_uploader"] . ")</i>") . "\n";
        }
        if ($CURUSER['class'] >= UC_STAFF) {
            $url = "edit.php?id=" . (int) $row["id"];
            if (isset($_GET["returnto"])) {
                $addthis = "&amp;returnto=" . urlencode($_GET["returnto"]);
                $url .= $addthis;
            }
            $editlink = "a href=\"{$url}\" class=\"sublink\"";
            $del_link = $CURUSER['class'] === UC_MAX ? "<a href='fastdelete.php?id=" . (int) $row['id'] . "'>&nbsp;<img src='pic/button_delete2.gif' alt='Fast Delete' title='Fast Delete' /></a>" : "";
            $htmlout .= "<br />\n<b>Added:&nbsp;" . get_date($row['added'], 'DATE') . "</b><br />" . $imdb . "<b>Subtitle:&nbsp;{$Subs}</b><br />";
            if (!$row["comments"]) {
                $htmlout .= "<b>Comments:</b>&nbsp;" . (int) $row["comments"] . "\n";
            } else {
                if ($variant == "index") {
                    $htmlout .= "<b>Comments:</b>&nbsp;<b><a href='details.php?id={$id}&amp;hit=1&amp;tocomm=1'>" . (int) $row["comments"] . "</a></b>\n";
                } else {
                    $htmlout .= "<b>Comments:</b>&nbsp;<b><a href='details.php?id={$id}&amp;page=0#startcomments'>" . (int) $row["comments"] . "</a></b>\n";
                }
            }
            if ($CURUSER['class'] >= UC_STAFF) {
                $htmlout .= "<br /><b>Tools:</b>&nbsp;";
            }
            $htmlout .= "<{$editlink}><img src='pic/button_edit2.gif' alt='Fast Edit' title='Fast Edit' /></a>{$del_link}";
        }
        $htmlout .= "</div></table><br /></div><div style='display:block;width:5px;'></div>";
    }
    $htmlout .= "</div></div>\n";
    return $htmlout;
}
コード例 #6
0
ファイル: sharemarks.php プロジェクト: CharlieHD/U-232-V2
function sharetable($res, $variant = "index")
{
    global $INSTALLER09, $CURUSER, $lang;
    $htmlout = '';
    $htmlout .= "\r\n<span>Icon Legend :\r\n<img src='{$INSTALLER09['pic_base_url']}plus.gif' alt='Delete Bookmark' border='none' /> = Delete Bookmark |\r\n<img src='{$INSTALLER09['pic_base_url']}download.gif' alt='Download Bookmark' border='none' />= Download Torrent |\r\n<img alt='Bookmark is Private' src='{$INSTALLER09['pic_base_url']}key.gif' border='none'  /> = Bookmark is Private |\r\n<img src='{$INSTALLER09['pic_base_url']}public.gif' alt='Bookmark is Public' border='none'  /> = Bookmark is Public</span>\r\n<table border='1' cellspacing='0' cellpadding='5'>\r\n<tr>\r\n<td class='colhead' align='center'>Type</td>\r\n<td class='colhead' align='left'>Name</td>";
    $userid = (int) $_GET['id'];
    if ($CURUSER['id'] == $userid) {
        $htmlout .= ($variant == 'index' ? '<td class="colhead" align="center">Download</td><td class="colhead" align="right">' : '') . 'Delete</td>';
    } else {
        $htmlout .= ($variant == 'index' ? '<td class="colhead" align="center">Download</td><td class="colhead" align="right">' : '') . 'Bookmark</td>';
    }
    if ($variant == "mytorrents") {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n";
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n";
    }
    $htmlout .= "<td class='colhead' align='right'>{$lang["torrenttable_files"]}</td>\r\n   <td class='colhead' align='right'>{$lang["torrenttable_comments"]}</td>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_added"]}</td>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_size"]}</td>\r\n   <td class='colhead' align='center'>{$lang["torrenttable_snatched"]}</td>\r\n   <td class='colhead' align='right'>{$lang["torrenttable_seeders"]}</td>\r\n   <td class='colhead' align='right'>{$lang["torrenttable_leechers"]}</td>";
    if ($variant == 'index') {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_uppedby"]}</td>\n";
    }
    $htmlout .= "</tr>\n";
    while ($row = mysql_fetch_assoc($res)) {
        $id = $row["id"];
        $htmlout .= "<tr>\n";
        $htmlout .= "<td align='center' style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            $htmlout .= "<a href='browse.php?cat={$row['category']}'>";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                $htmlout .= "<img border='0' src='{$INSTALLER09['pic_base_url']}caticons/{$row['cat_pic']}' alt='{$row['cat_name']}' />";
            } else {
                $htmlout .= $row["cat_name"];
            }
            $htmlout .= "</a>";
        } else {
            $htmlout .= "-";
        }
        $htmlout .= "</td>\n";
        $dispname = htmlspecialchars($row["name"]);
        $htmlout .= "<td align='left'><a href='details.php?";
        if ($variant == "mytorrents") {
            $htmlout .= "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        $htmlout .= "id={$id}";
        if ($variant == "index") {
            $htmlout .= "&amp;hit=1";
        }
        $htmlout .= "'><b>{$dispname}</b></a>&nbsp;</td>";
        $htmlout .= $variant == "index" ? "<td align='center'><a href=\"download.php?torrent=" . $id . "\"><img src='" . $INSTALLER09['pic_base_url'] . "download.gif' border='0' alt='Download Bookmark!' title='Download Bookmark!' /></a></td>" : "";
        $bm = sql_query("SELECT * FROM bookmarks WHERE torrentid={$id} && userid={$CURUSER['id']}");
        $bms = mysql_fetch_assoc($bm);
        $bookmarked = empty($bms) ? '<a href=\'bookmark.php?torrent=' . $id . '&amp;action=add\'><img src=\'' . $INSTALLER09['pic_base_url'] . 'bookmark.gif\' border=\'0\' alt=\'Bookmark it!\' title=\'Bookmark it!\'></a>' : '<a href="bookmark.php?torrent=' . $id . '&amp;action=delete"><img src=\'' . $INSTALLER09['pic_base_url'] . 'plus.gif\' border=\'0\' alt=\'Delete Bookmark!\' title=\'Delete Bookmark!\' /></a>';
        $htmlout .= $variant == "index" ? "<td align='center'>{$bookmarked}</td>" : "";
        if ($variant == "mytorrents") {
            $htmlout .= "</td><td align='center'><a href='edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;id={$row['id']}'>" . $lang["torrenttable_edit"] . "</a>\n";
        }
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='right'>";
            if ($row["visible"] == "no") {
                $htmlout .= "<b>" . $lang["torrenttable_not_visible"] . "</b>";
            } else {
                $htmlout .= "" . $lang["torrenttable_visible"] . "";
            }
            $htmlout .= "</td>\n";
        }
        if ($row["type"] == "single") {
            $htmlout .= "<td align='right'>{$row["numfiles"]}</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . $row["numfiles"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            $htmlout .= "<td align='right'>{$row["comments"]}</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;hit=1&amp;tocomm=1'>" . $row["comments"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;page=0#startcomments'>" . $row["comments"] . "</a></b></td>\n";
            }
        }
        $htmlout .= "<td align='center'><span style='white-space: nowrap;'>" . str_replace(",", "<br />", get_date($row['added'], '')) . "</span></td>\n";
        $htmlout .= "\r\n    <td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        if ($row["times_completed"] != 1) {
            $_s = "" . $lang["torrenttable_time_plural"] . "";
        } else {
            $_s = "" . $lang["torrenttable_time_singular"] . "";
        }
        $htmlout .= "<td align='center'><a href='snatches.php?id={$id}'>" . number_format($row["times_completed"]) . "<br />{$_s}</a></td>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#seeders'>\r\n                <font color='" . get_slr_color($ratio) . "'>{$row["seeders"]}</font></a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["seeders"]) . "' href='peerlist.php?id={$id}#seeders'>{$row["seeders"]}</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'><span class='" . linkcolor($row["seeders"]) . "'>" . $row["seeders"] . "</span></td>\n";
        }
        if ($row["leechers"]) {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["leechers"]) . "' href='peerlist.php?id={$id}#leechers'>{$row["leechers"]}</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'>0</td>\n";
        }
        if ($variant == "index") {
            $htmlout .= "<td align='center'>" . (isset($row["username"]) ? "<a href='userdetails.php?id=" . $row["owner"] . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>" : "<i>(" . $lang["torrenttable_unknown_uploader"] . ")</i>") . "</td>\n";
        }
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
コード例 #7
0
ファイル: functions.php プロジェクト: skygunner/ekucms
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);
}
コード例 #8
0
function bookmarktable($res, $variant = "index")
{
    global $pic_base_url, $CURUSER;
    $wait = 0;
    if ($CURUSER["class"] < UC_VIP) {
        $gigs = $CURUSER["uploaded"] / (1024 * 1024 * 1024);
        $ratio = $CURUSER["downloaded"] > 0 ? $CURUSER["uploaded"] / $CURUSER["downloaded"] : 0;
        if ($ratio < 0.5 || $gigs < 5) {
            $wait = 48;
        } elseif ($ratio < 0.65 || $gigs < 6.5) {
            $wait = 24;
        } elseif ($ratio < 0.8 || $gigs < 8) {
            $wait = 12;
        } elseif ($ratio < 0.95 || $gigs < 9.5) {
            $wait = 6;
        } else {
            $wait = 0;
        }
    }
    ?>
<p align="center">Icon Legend :
<img alt="Delete Bookmark" src="pic/plus2.gif" border="none">
= Delete Bookmark |
<img alt="Download Bookmark" by="" src="pic/download.gif">
= Download Torrent |
<img alt="Bookmark is Private" src="pic/key.gif" border="none">
= Bookmark is Private |
<img alt="Bookmark is Public" src="pic/public.gif" border="none">
= Bookmark is Public</p>
<table border="1" cellspacing=0 cellpadding=5>
<tr>
<td class="colhead" align="center">Type</td>
<td class="colhead" align=left>Name</td>
<?php 
    echo ($variant == 'index' ? '<td class=colhead align=center>Delete</td><td class=colhead align="right">' : '') . 'Download</td><td class=colhead align="right">Share</td>';
    if ($wait) {
        print "<td class=\"colhead\" align=\"center\">Wait</td>\n";
    }
    if ($variant == "mytorrents") {
        print "<td class=\"colhead\" align=\"center\">Edit</td>\n";
        print "<td class=\"colhead\" align=\"center\">Visible</td>\n";
    }
    ?>
<td class="colhead" align=right>Files</td>
<td class="colhead" align=right>Comm.</td>
<!--<td class="colhead" align="center">Rating</td>-->
<td class="colhead" align="center">Added</td>
<td class="colhead" align="center">TTL</td>
<td class="colhead" align="center">Size</td>
<!--
<td class="colhead" align=right>Views</td>
<td class="colhead" align=right>Hits</td>
-->
<td class="colhead" align="center">Snatched</td>
<td class="colhead" align=right>Seeders</td>
<td class="colhead" align=right>Leechers</td>
<?php 
    if ($variant == "index") {
        print "<td class=\"colhead\" align=center>Upped&nbsp;by</td>\n";
    }
    print "</tr>\n";
    while ($row = mysql_fetch_assoc($res)) {
        $id = $row["id"];
        print "<tr>\n";
        print "<td align=center style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            print "<a href=\"browse.php?cat=" . $row["category"] . "\">";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                print "<img border=\"0\" src=\"{$pic_base_url}/{$row['cat_pic']}\" alt=\"{$row['cat_name']}\" />";
            } else {
                print $row["cat_name"];
            }
            print "</a>";
        } else {
            print "-";
        }
        print "</td>\n";
        $dispname = htmlspecialchars($row["name"]);
        print "<td align=left><a href=\"details.php?";
        if ($variant == "mytorrents") {
            print "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        print "id={$id}";
        if ($variant == "index") {
            print "&amp;hit=1";
        }
        print "\"><b>{$dispname}</b></a>\n";
        echo $variant == 'index' ? '<td align=center><a href="bookmark.php?torrent=' . $id . '&action=delete"><img src="' . $pic_base_url . 'plus2.gif" border="0" alt="Delete Bookmark!" title="Delete Bookmark!"></a></td>' : '';
        echo $variant == 'index' ? '<td align=center><a href=download.php/' . $id . '/' . rawurlencode($row['filename']) . '><img src="' . $pic_base_url . 'download.gif" border="0" alt="Download Bookmark!" title="Download Bookmark!"></a></td>' : '';
        $bm = mysql_query("SELECT * FROM bookmarks WHERE torrentid={$id} && userid={$CURUSER['id']}");
        $bms = mysql_fetch_assoc($bm);
        if ($bms['private'] == 'yes' && $bms['userid'] == $CURUSER['id']) {
            $makepriv = '<a href="bookmark.php?torrent=' . $id . '&action=public"><img src="' . $pic_base_url . 'key.gif" border="0" alt="Mark Bookmark Public!" title="Mark Bookmark Public!"></a>';
            echo $variant == 'index' ? '<td align=center>' . $makepriv . '</td>' : '';
        } elseif ($bms['private'] == 'no' && $bms['userid'] == $CURUSER['id']) {
            $makepriv = '<a href="bookmark.php?torrent=' . $id . '&action=private"><img src="' . $pic_base_url . 'public.gif" border="0" alt="Mark Bookmark Private!" title="Mark Bookmark Private!"></a>';
            echo $variant == 'index' ? '<td align=center>' . $makepriv . '</td>' : '';
        }
        if ($wait) {
            $elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
            if ($elapsed < $wait) {
                $color = dechex(floor(127 * ($wait - $elapsed) / 48 + 128) * 65536);
                print "<td align=center><nobr><a href=\"faq.php#dl8\"><font color=\"{$color}\">" . number_format($wait - $elapsed) . " h</font></a></nobr></td>\n";
            } else {
                print "<td align=center><nobr>None</nobr></td>\n";
            }
        }
        /*
        if ($row["nfoav"] && get_user_class() >= UC_POWER_USER)
        print("<a href=viewnfo.php?id=$row[id]><img src=\"{$pic_base_url}viewnfo.gif" border=0 alt='View NFO'></a>\n");
        
        else */
        if ($variant == "mytorrents") {
            print "<td align=\"center\"><a href=\"edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;id=" . $row["id"] . "\">edit</a>\n";
        }
        print "</td>\n";
        if ($variant == "mytorrents") {
            print "<td align=\"right\">";
            if ($row["visible"] == "no") {
                print "<b>no</b>";
            } else {
                print "yes";
            }
            print "</td>\n";
        }
        if ($row["type"] == "single") {
            print "<td align=\"right\">" . $row["numfiles"] . "</td>\n";
        } else {
            if ($variant == "index") {
                print "<td align=\"right\"><b><a href=\"filelist.php?id={$id}\">" . $row["numfiles"] . "</a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a href=\"filelist.php?id={$id}\">" . $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            print "<td align=\"right\">" . $row["comments"] . "</td>\n";
        } else {
            if ($variant == "index") {
                print "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;hit=1&amp;tocomm=1\">" . $row["comments"] . "</a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;page=0#startcomments\">" . $row["comments"] . "</a></b></td>\n";
            }
        }
        /*
        print("<td align=\"center\">");
        if (!isset($row["rating"]))
        print("---");
        else {
        $rating = round($row["rating"] * 2) / 2;
        $rating = ratingpic($row["rating"]);
        if (!isset($rating))
        print("---");
        else
        print($rating);
        }
        print("</td>\n");
        */
        print "<td align=center><nobr>" . str_replace(" ", "<br />", $row["added"]) . "</nobr></td>\n";
        $ttl = 28 * 24 - floor((gmtime() - sql_timestamp_to_unix_timestamp($row["added"])) / 3600);
        if ($ttl == 1) {
            $ttl .= "<br />hour";
        } else {
            $ttl .= "<br />hours";
        }
        print "<td align=center>{$ttl}</td>\n";
        print "<td align=center>" . str_replace(" ", "<br />", prefixed($row["size"])) . "</td>\n";
        // print("<td align=\"right\">" . $row["views"] . "</td>\n");
        // print("<td align=\"right\">" . $row["hits"] . "</td>\n");
        $_s = "";
        if ($row["times_completed"] != 1) {
            $_s = "s";
        }
        print "<td align=center>" . number_format($row["times_completed"]) . "<br />time{$_s}</td>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                print "<td align=right><b><a href=peerlist.php?id={$id}#seeders><font color=" . get_slr_color($ratio) . ">" . $row["seeders"] . "</font></a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a class=\"" . linkcolor($row["seeders"]) . "\" href=\"peerlist.php?id={$id}#seeders\">" . $row["seeders"] . "</a></b></td>\n";
            }
        } else {
            print "<td align=\"right\"><span class=\"" . linkcolor($row["seeders"]) . "\">" . $row["seeders"] . "</span></td>\n";
        }
        if ($row["leechers"]) {
            if ($variant == "index") {
                print "<td align=right><b><a href=peerlist.php?id={$id}#leechers>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a class=\"" . linkcolor($row["leechers"]) . "\" href=\"peerlist.php?id={$id}#leechers\">" . $row["leechers"] . "</a></b></td>\n";
            }
        } else {
            print "<td align=\"right\">0</td>\n";
        }
        if ($variant == "index") {
            print "<td align=center>" . (isset($row["username"]) ? "<a href=userdetails.php?id=" . $row["owner"] . "><b>" . htmlspecialchars($row["username"]) . "</b></a>" : "<i>(unknown)</i>") . "</td>\n";
        }
        print "</tr>\n";
    }
    print "</table>\n";
    // return $rows;
}
コード例 #9
0
function torrenttable($res, $variant = "index")
{
    global $TBDEV, $CURUSER, $lang;
    $wait = 0;
    $htmlout = '';
    if ($CURUSER["class"] < UC_VIP) {
        $gigs = $CURUSER["uploaded"] / (1024 * 1024 * 1024);
        $ratio = $CURUSER["downloaded"] > 0 ? $CURUSER["uploaded"] / $CURUSER["downloaded"] : 0;
        if ($ratio < 0.5 || $gigs < 5) {
            $wait = 48;
        } elseif ($ratio < 0.65 || $gigs < 6.5) {
            $wait = 24;
        } elseif ($ratio < 0.8 || $gigs < 8) {
            $wait = 12;
        } elseif ($ratio < 0.95 || $gigs < 9.5) {
            $wait = 6;
        } else {
            $wait = 0;
        }
    }
    $htmlout .= "<table border='1' cellspacing='0' cellpadding='5'>\r\n    <tr>\r\n    <td class='colhead' align='center'>{$lang["torrenttable_type"]}</td>\r\n    <td class='colhead' align='left'>{$lang["torrenttable_name"]}</td>\r\n    <!--<td class='heading' align='left'>{$lang["torrenttable_dl"]}</td>-->";
    if ($wait) {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_wait"]}</td>\n";
    }
    if ($variant == "mytorrents") {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n";
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n";
    }
    $htmlout .= "<td class='colhead' align='right'>{$lang["torrenttable_files"]}</td>\r\n    <td class='colhead' align='right'>{$lang["torrenttable_comments"]}</td>\r\n    <!--<td class='colhead' align='center'>{$lang["torrenttable_rating"]}</td>-->\r\n    <td class='colhead' align='center'>{$lang["torrenttable_added"]}</td>\r\n    <td class='colhead' align='center'>{$lang["torrenttable_ttl"]}</td>\r\n    <td class='colhead' align='center'>{$lang["torrenttable_size"]}</td>\r\n    <!--\r\n    <td class='colhead' align='right'>{$lang["torrenttable_views"]}</td>\r\n    <td class='colhead' align='right'>{$lang["torrenttable_hits"]}</td>\r\n    -->\r\n    <td class='colhead' align='center'>{$lang["torrenttable_snatched"]}</td>\r\n    <td class='colhead' align='right'>{$lang["torrenttable_seeders"]}</td>\r\n    <td class='colhead' align='right'>{$lang["torrenttable_leechers"]}</td>";
    if ($variant == 'index') {
        $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_uppedby"]}</td>\n";
    }
    $htmlout .= "</tr>\n";
    while ($row = mysql_fetch_assoc($res)) {
        $id = $row["id"];
        $htmlout .= "<tr>\n";
        $htmlout .= "<td align='center' style='padding: 0px'>";
        if (isset($row["cat_name"])) {
            $htmlout .= "<a href='browse.php?cat={$row['category']}'>";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                $htmlout .= "<img border='0' src='{$TBDEV['pic_base_url']}caticons/{$row['cat_pic']}' alt='{$row['cat_name']}' />";
            } else {
                $htmlout .= $row["cat_name"];
            }
            $htmlout .= "</a>";
        } else {
            $htmlout .= "-";
        }
        $htmlout .= "</td>\n";
        $dispname = htmlspecialchars($row["name"]);
        $htmlout .= "<td align='left'><a href='details.php?";
        if ($variant == "mytorrents") {
            $htmlout .= "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        $htmlout .= "id={$id}";
        if ($variant == "index") {
            $htmlout .= "&amp;hit=1";
        }
        $htmlout .= "'><b>{$dispname}</b></a>\n";
        if ($wait) {
            $elapsed = floor((time() - $row["added"]) / 3600);
            if ($elapsed < $wait) {
                $color = dechex(floor(127 * ($wait - $elapsed) / 48 + 128) * 65536);
                $htmlout .= "<td align='center'><span style='white-space: nowrap;'><a href='faq.php#dl8'><font color='{$color}'>" . number_format($wait - $elapsed) . " " . $lang["torrenttable_wait_h"] . "</font></a></span></td>\n";
            } else {
                $htmlout .= "<td align='center'><span style='white-space: nowrap;'>{$lang["torrenttable_wait_none"]}</span></td>\n";
            }
        }
        /*
                if ($row["nfoav"] && get_user_class() >= UC_POWER_USER)
                  print("<a href='viewnfo.php?id=$row[id]''><img src='{$TBDEV['pic_base_url']}viewnfo.gif" border='0' alt='".$lang["torrenttable_view_nfo_alt"]."' /></a>\n");
                if ($variant == "index")
                    print("<a href='download.php/$id/" . rawurlencode($row["filename"]) . "'><img src='{$TBDEV['pic_base_url']}download.gif' border='0' alt='".$lang["torrenttable_download_alt"]."' /></a>\n");
        
                else */
        if ($variant == "mytorrents") {
            $htmlout .= "</td><td align='center'><a href='edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;id={$row['id']}'>" . $lang["torrenttable_edit"] . "</a>\n";
        }
        $htmlout .= "</td>\n";
        if ($variant == "mytorrents") {
            $htmlout .= "<td align='right'>";
            if ($row["visible"] == "no") {
                $htmlout .= "<b>" . $lang["torrenttable_not_visible"] . "</b>";
            } else {
                $htmlout .= "" . $lang["torrenttable_visible"] . "";
            }
            $htmlout .= "</td>\n";
        }
        if ($row["type"] == "single") {
            $htmlout .= "<td align='right'>{$row["numfiles"]}</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . $row["numfiles"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='filelist.php?id={$id}'>" . $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            $htmlout .= "<td align='right'>{$row["comments"]}</td>\n";
        } else {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;hit=1&amp;tocomm=1'>" . $row["comments"] . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a href='details.php?id={$id}&amp;page=0#startcomments'>" . $row["comments"] . "</a></b></td>\n";
            }
        }
        /*
                print("<td align='center'>");
                if (!isset($row["rating"]))
                    print("---");
                else {
                    $rating = round($row["rating"] * 2) / 2;
                    $rating = ratingpic($row["rating"]);
                    if (!isset($rating))
                        print("---");
                    else
                        print($rating);
                }
                print("</td>\n");
        */
        $htmlout .= "<td align='center'><span style='white-space: nowrap;'>" . str_replace(",", "<br />", get_date($row['added'], '')) . "</span></td>\n";
        $ttl = 28 * 24 - floor((time() - $row["added"]) / 3600);
        if ($ttl == 1) {
            $ttl .= "<br />" . $lang["torrenttable_hour_singular"] . "";
        } else {
            $ttl .= "<br />" . $lang["torrenttable_hour_plural"] . "";
        }
        $htmlout .= "<td align='center'>{$ttl}</td>\n\r\n    <td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        //        print("<td align='right'>" . $row["views"] . "</td>\n");
        //        print("<td align='right'>" . $row["hits"] . "</td>\n");
        if ($row["times_completed"] != 1) {
            $_s = "" . $lang["torrenttable_time_plural"] . "";
        } else {
            $_s = "" . $lang["torrenttable_time_singular"] . "";
        }
        $htmlout .= "<td align='center'>" . number_format($row["times_completed"]) . "<br />{$_s}</td>\n";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#seeders'>\r\n                <font color='" . get_slr_color($ratio) . "'>{$row["seeders"]}</font></a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["seeders"]) . "' href='peerlist.php?id={$id}#seeders'>{$row["seeders"]}</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'><span class='" . linkcolor($row["seeders"]) . "'>" . $row["seeders"] . "</span></td>\n";
        }
        if ($row["leechers"]) {
            if ($variant == "index") {
                $htmlout .= "<td align='right'><b><a href='peerlist.php?id={$id}#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n";
            } else {
                $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["leechers"]) . "' href='peerlist.php?id={$id}#leechers'>{$row["leechers"]}</a></b></td>\n";
            }
        } else {
            $htmlout .= "<td align='right'>0</td>\n";
        }
        if ($variant == "index") {
            $htmlout .= "<td align='center'>" . (isset($row["username"]) ? "<a href='userdetails.php?id=" . $row["owner"] . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>" : "<i>(" . $lang["torrenttable_unknown_uploader"] . ")</i>") . "</td>\n";
        }
        $htmlout .= "</tr>\n";
    }
    $htmlout .= "</table>\n";
    return $htmlout;
}
コード例 #10
0
ファイル: bittorrent.php プロジェクト: herrag33k/TomTorrent
function torrenttable($res, $variant = "index") {
	global $pic_base_url, $CURUSER, $BASEURL;

	if ($CURUSER['class'] <= UC_POWER_USER && $CURUSER['donor'] === 'no') {
		$gigs = $CURUSER['uploaded'] / (1024*1024*1024);
		$ratio = (($CURUSER['downloaded'] > '2147483648') ? ($CURUSER['uploaded'] / $CURUSER['downloaded']) : '1');
		$space = date('YmdHis');
		if($space < '20060804180000' || $space > '20060807235959') {
			if ($ratio < '0.75' && $ratio >= '0.5')
				$wait = '12';
			elseif ($ratio < '0.5')
				$wait = '24';
			else
				$wait = '0';
		} else
			$wait = '0';
		$t1 = str_replace(array(' ',':','-','\''),'',sqlesc(get_date_time(gmtime() - 1209600)));
		$t2 = str_replace(array(' ',':','-'),'',$CURUSER['added']);
		if($CURUSER['donor'] === 'yes' || $t2 >= $t1)
			$wait = '0';
		if($CURUSER['warned'] == 'yes')
			$wait = '24';
	}
	if(isset($_GET['sort'])) {
		$order = $_GET['d'];
		if($order == 'ASC')
			$sort = '&d=DESC';
		elseif($order == 'DESC')
			$sort = '&d=ASC';
	} else
		$sort = '&d=DESC';

	if($_GET['search'])
		$search = '&search='.$_GET['search'];
	else
		$search = '';

	$verifystring = verifystring($_GET['cat'],'num');
	if($verifystring === TRUE)
	        $catsort = '&amp;cat='.$_GET['cat'];

	$s_catz = $_REQUEST['s_catz'];

	$verifystring = verifystring($_GET['incldead'],'num');
	if($verifystring === TRUE)
	        $incldead = '&amp;incldead='.$_GET['incldead'];

	$extrapar = $catsort.$search.$sort.$s_catz.$incldead;

	if($_POST['new_renew'] === '1') {
		$lasttorrent = mysql_result(mysql_query('SELECT id FROM torrents ORDER BY id DESC LIMIT 1'),0);
		mysql_query('UPDATE users SET lasttorrent='.$lasttorrent.' WHERE id='.$CURUSER['id']);
		$_SESSION['lasttorrent'] = $lasttorrent;
		$header = 'Refresh: url='.$BASEURL.$_SERVER['REQUEST_URI'];
		header($header);
	}
	if($CURUSER['birta_nytt'] === '1') {
		echo '
		<form action="'.$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'].'" method="post">
		<input type="hidden" name="new_renew" value="1">
		<input type="submit" value="Endursetja \'ný torrent\' merkinguna">
		</form><br />';
	}
?>

<table border="1" cellspacing="0" cellpadding="5">
<tr>
<td class="colhead" align="center"><a style="text-decoration:none;color:white;" href="browse.php?sort=type<?php 
echo $extrapar;
?>
">#</a></td>

<td class="colhead" align="left"><a style="text-decoration:none;color:white;" href="browse.php?sort=name<?php 
echo $extrapar;
?>
">Nafn</a></td>

<?

if ($wait > '0')
	echo '<td class="colhead" align="center">Bið</td>'."\n";
if ($variant == 'mytorrents') {
	echo '<td class="colhead" align="center">Breyta</td>'."\n";
	echo '<td class="colhead" align="center">Sýnilegt</td>'."\n";
}
?>

<td class="colhead" align="right"><a style="text-decoration:none;color:white;" href="browse.php?sort=numfiles<?php 
echo $extrapar;
?>
">Skrár</a></td>
<td class="colhead" align="right"><a style="text-decoration:none;color:white;" href="browse.php?sort=comments<?php 
echo $extrapar;
?>
">Umsagnir</a></td>
<td class="colhead" align="center"><a style="text-decoration:none;color:white;" href="browse.php?sort=ratingsum<?php 
echo $extrapar;
?>
">Einkunn</a></td>
<td class="colhead" align="center"><a style="text-decoration:none;color:white;" href="browse.php?sort=added<?php 
echo $extrapar;
?>
">Bætt inn</a></td>
<td class="colhead" align="center"><a style="text-decoration:none;color:white;" href="browse.php?sort=added<?php 
echo $extrapar;
?>
">TTL</a></td>
<td class="colhead" align="center">Samtals hraði</td>
<td class="colhead" align="center"><a style="text-decoration:none;color:white;" href="browse.php?sort=size<?php 
echo $extrapar;
?>
">Stærð</a></td>
<td class="colhead" align="center"><a style="text-decoration: none; color: white;" href="browse.php?sort=times_completed<?php 
echo $extrapar;
?>
">Sótt</a></td>
<td class="colhead" align="right"><a style="text-decoration:none;color:white;" href="browse.php?sort=seeders<?php 
echo $extrapar;
?>
">Að deila</a></td>
<td class="colhead" align="right"><a style="text-decoration:none;color:white;" href="browse.php?sort=leechers<?php 
echo $extrapar;
?>
">Að sækja</a></td>
<?

if ($variant == "index")
	echo '<td class="colhead" align="center">Sent inn af</td>'."\n";

echo '</tr>'."\n";

while ($row = mysql_fetch_assoc($res)) {
	$id = $row['id'];
	if($row['reviewed'] > '0' && $CURUSER['class'] >= UC_MODERATOR)
		echo '<tr style="background-color:DarkGray">'."\n";
	else
		echo '<tr>'."\n";

	echo '<td align="center" style="padding:0px">';
	if (isset($row['cat_name'])) {
		echo '<a href="browse.php?c'.$row['category'].'=1">';
		if (!empty($row['cat_pic']))
			echo '<img border="0" src="'.$pic_base_url.$row['cat_pic'].'" alt="'. $row['cat_name'].'" />';
		else
			echo $row['cat_name'];
		echo '</a>';
	} else
		echo '-';
	echo '</td>'."\n";

	$dispname = htmlspecialchars($row['name']);
	echo '<td align="left"><a href="details.php?';
	if ($variant == 'mytorrents')
		echo 'returnto='. urlencode($_SERVER['REQUEST_URI']).'&amp;';
	echo 'id='.$id;
	if ($variant == 'index')
		echo '&amp;hit=1';
	if(strlen($dispname) > '65')
		$dispname = substr($dispname, '0','60') . '...';
	echo '"><b>'.$dispname.'</b></a>'."\n";
	if($id > $_SESSION['lasttorrent'] && $CURUSER['birta_nytt'] === '1')
		echo '<img src="/pic/new.png" /> ';
	if($row['nuked'] == 'yes')
		echo '<b>[SPRENGT:</b>'.$row['nukedr'].'<b>]</b> <img src="ismod/nuked.gif" border="0" valign="bottom" alt="'.$row['nukedr'].'">'."\n";
	if($row['scene'] == 'y')
		echo '<b>[Scene útgáfa]:</b>'."\n";
	if ($variant == "index" && $wait == 0)
		echo '<a href="download.php/'.$id.'/'.rawurlencode($row['filename']).'"><img src="ismod/nidur.gif" border="0" alt="Sækja"><img src="ismod/nidur.gif" border="0" alt="Sækja"></a>'."\n";
	if ($wait > '0') {
		$elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
		if ($elapsed < $wait) {
			$color = dechex(floor(127*($wait - $elapsed)/48 + 128)*65536);
			echo '<td align="center"><nobr><a href="/faq.php#dl8"><font color="'.$color.'">'.number_format($wait - $elapsed).' klst</font></a></nobr></td>'."\n";
		} else {
			if ($variant == 'index')
				echo '<a href="download.php/'.$id.'/'.rawurlencode($row['filename']). '"><img src="ismod/nidur.gif" border="0" alt="Sækja"><img src="ismod/nidur.gif" border="0" alt="Sækja" /></a>'."\n";
			echo '<td align="center"><nobr>Engin</nobr></td>'."\n";
		}
        }

	if ($variant == 'mytorrents')
		echo '<td align="center"><a href="edit.php?returnto='.urlencode($_SERVER['REQUEST_URI']).'&amp;id='.$row['id'].'">Breyta</a>'."\n";
	echo '</td>'."\n";
	if ($variant == 'mytorrents') {
		echo '<td align="right">';
		if ($row['visible'] == 'no')
			echo '<b>Nei</b>';
		else
			echo 'Já';
		echo '</td>'."\n";
	}

	if ($row['type'] == 'single')
		echo '<td align="right">'.$row['numfiles'].'</td>'."\n";
	else {
		if ($variant == 'index')
			echo '<td align="right"><b><a href="details.php?id='.$id.'&amp;hit=1&amp;filelist=1">'.$row['numfiles'].'</a></b></td>'."\n";
		else
			echo '<td align="right"><b><a href="details.php?id='.$id.'&amp;filelist=1#filelist">'.$row['numfiles'].'</a></b></td>'."\n";
	}

	if ($row['comments'] === '0')
		echo '<td align="right">'.$row['comments'].'</td>'."\n";
	else {
		if ($variant == 'index')
			echo '<td align="right"><b><a href="details.php?id='.$id.'&amp;hit=1&amp;tocomm=1">'.$row['comments'].'</a></b></td>'."\n";
		else
			echo '<td align="right"><b><a href="details.php?id='.$id.'&amp;page=0#startcomments">'.$row['comments'].'</a></b></td>'."\n";
	}

	echo '<td align="center">';
	if (!isset($row['rating']))
		echo '---';
	else {
		$rating = round($row['rating'] * 2) / 2;
		$rating = ratingpic($row['rating']);
		if (!isset($rating))
			echo '---';
		else
			echo $rating;
	}
        echo '</td>'."\n";
        echo '<td align="center"><nobr>'.str_replace(' ', '<br />', $row['added']).'</nobr></td>'."\n";
	$ttl = (28*24) - floor((gmtime() - sql_timestamp_to_unix_timestamp($row["added"])) / 3600);
	if ($ttl == '1')
		$ttl .= '<br />klst';
	else
		$ttl .= '<br />klst';
	echo '<td align="center">'.$ttl.'</td>'."\n";
	// Totalspeed mod
	$resSpeed = mysql_query('SELECT seeders,leechers FROM torrents WHERE id='.$id.' AND visible=\'yes\' ORDER BY added DESC LIMIT 15') or sqlerr(__FILE__, __LINE__);
	if ($rowTmp = mysql_fetch_row($resSpeed))
		list($seedersTmp,$leechersTmp) = $rowTmp; 
	if ($seedersTmp >= '1' && $leechersTmp >= '1'){
		$speedQ = mysql_query('SELECT (t.size * t.times_completed + SUM(p.downloaded)) / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) AS totalspeed FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = \'no\' AND p.torrent = \''.$id.'\' GROUP BY t.id ORDER BY added ASC LIMIT 15') or sqlerr(__FILE__, __LINE__);
		$a = mysql_fetch_assoc($speedQ);
		$totalspeed = mksize($a['totalspeed']) . '/s';
	}
	echo '<td align="center">'.$totalspeed.'</td>'."\n";
	echo '<td align="center">'.str_replace(' ', '<br />', mksize($row['size'])).'</td>'."\n";
	$_s = '';
	if ($row['times_completed'] != '1')
		$_s = 's';
	echo '<td align="center"><a href="viewsnatches.php?id='.$row[id].'">'.number_format($row['times_completed']).'<br />time'.$_s.'</a></td>'."\n";

	if ($row["seeders"]) {
		if ($variant == "index") {
			if ($row["leechers"]) $ratio = $row["seeders"] / $row["leechers"]; else $ratio = 1;
				print("<td align=right><b><a href=details.php?id=$id&amp;hit=1&amp;toseeders=1><font color=" .
			get_slr_color($ratio) . ">" . $row["seeders"] . "</font></a></b></td>\n");
		} else
			echo '<td align="right"><b><a class="'.linkcolor($row['seeders']).'" href="details.php?id='.$id.'&amp;dllist=1#seeders\">'.$row['seeders'].'</a></b></td>'."\n";
	} else
		echo '<td align="right"><span class="'.linkcolor($row['seeders']).'">'.$row['seeders'].'</span></td>'."\n";

	if ($row["leechers"]) {
		if ($variant == "index")
			echo '<td align="right"><b><a href="details.php?id='.$id.'&amp;hit=1&amp;todlers=1">'.number_format($row['leechers']).($peerlink ? '</a>' : '').'</b></td>'."\n";
		else
			echo '<td align="right"><b><a class="'.linkcolor($row['leechers']).'" href="details.php?id='.$id.'&amp;dllist=1#leechers">'.$row['leechers'].'</a></b></td>'."\n";
	} else
		echo '<td align="right">0</td>'."\n";

	if ($variant == 'index') {
		echo '<td align="center">';
		if($row['anonymous'] === '1')
			echo '<i>(Nafnleynd)</i>';
		else
			echo '<a href=userdetails.php?id='.$row['owner'].'><b>'.htmlspecialchars($row['username']).'</b></a>'; 
		echo '</td>'."\n";
	}
        echo '</tr>'."\n";
}
	echo '</table>'."\n";
	return $rows;
}
コード例 #11
0
function torrenttable($records, $variant = "index")
{
    global $pic_base_url, $DEFAULTBASEURL, $config, $php_file, $page_find, $lang_off, $language, $CURUSER, $ss_uri, $waiton, $wait1, $wait2, $wait3, $wait4, $oldtorrents, $progress, $cat_ico_uri;
    $q = sql_query("select count(id) as num, YEAR(added) as year, MONTH(added) as month , DAY(added) as day FROM torrents  group by year,month,day ORDER BY day,month,year DESC") or print "error";
    while ($a = mysql_fetch_assoc($q)) {
        $split[$a["year"] . $a["month"] . $a["day"]] = $a["num"];
    }
    if ((bool) $waiton) {
        if ($CURUSER["class"] < UC_VIP) {
            $gigs = $CURUSER["uploaded"] / (1024 * 1024 * 1024);
            $ratio = $CURUSER["downloaded"] > 0 ? $CURUSER["uploaded"] / $CURUSER["downloaded"] : 0;
            if ($ratio < 0.5 || $gigs < 5) {
                $wait = $wait1;
            } elseif ($ratio < 0.65 || $gigs < 6.5) {
                $wait = $wait2;
            } elseif ($ratio < 0.8 || $gigs < 8) {
                $wait = $wait3;
            } elseif ($ratio < 0.95 || $gigs < 9.5) {
                $wait = $wait4;
            } else {
                $wait = 0;
            }
        }
    }
    if (get_user_class() >= UC_MODERATOR) {
        echo "<form method=post action=deltorrent.php?mode=delete>";
    }
    ?>
<table border="1" cellspacing=0 cellpadding=5 onMouseover="changeto(event, '#1E1E2A')" onMouseout="changeback(event, 'black')">
<tr>
<?php 
    // sorting by MarkoStamcar // modified by xuzo :))
    $oldlink = '';
    $count_get = 0;
    $char = '';
    if (!isset($wait)) {
        $wait = 0;
    }
    $description = '';
    $preres = '';
    $type = '';
    $sort = '';
    $row = '';
    foreach ($_GET as $get_name => $get_value) {
        $get_name = mysql_escape_string(strip_tags(str_replace(array("\"", "'"), array("", ""), $get_name)));
        $get_value = mysql_escape_string(strip_tags(str_replace(array("\"", "'"), array("", ""), $get_value)));
        if ($get_name != "sort" && $get_name != "type") {
            if ($count_get > 0) {
                $oldlink = $oldlink . "&amp;" . $get_name . "=" . $get_value;
            } else {
                $oldlink = $oldlink . $get_name . "=" . $get_value;
            }
            $count_get++;
        }
    }
    if ($count_get > 0) {
        $oldlink = $oldlink . "&amp;";
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "1") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link1 = "asc";
        } else {
            $link1 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "2") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link2 = "asc";
        } else {
            $link2 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "3") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link3 = "asc";
        } else {
            $link3 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "4") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link4 = "asc";
        } else {
            $link4 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "5") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link5 = "asc";
        } else {
            $link5 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "6") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link6 = "asc";
        } else {
            $link6 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "7") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link7 = "asc";
        } else {
            $link7 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "8") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link8 = "asc";
        } else {
            $link8 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "9") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link9 = "asc";
        } else {
            $link9 = "desc";
        }
    }
    if (isset($_GET["sort"]) && $_GET["sort"] == "10") {
        if (isset($_GET["type"]) && $_GET["type"] == "desc") {
            $link10 = "asc";
        } else {
            $link10 = "desc";
        }
    }
    if (empty($link1)) {
        $link1 = "asc";
    }
    // for torrent name
    if (empty($link2)) {
        $link2 = "desc";
    }
    if (empty($link3)) {
        $link3 = "desc";
    }
    if (empty($link4)) {
        $link4 = "desc";
    }
    if (empty($link5)) {
        $link5 = "desc";
    }
    if (empty($link6)) {
        $link6 = "desc";
    }
    if (empty($link7)) {
        $link7 = "desc";
    }
    if (empty($link8)) {
        $link8 = "desc";
    }
    if (empty($link9)) {
        $link9 = "desc";
    }
    if (empty($link10)) {
        $link10 = "desc";
    }
    ?>
<td class="colhead" align="center"><?php 
    echo $language['type'];
    ?>
</td>
<td class="colhead" align="left"><a href="browse.php?<?php 
    echo $oldlink;
    ?>
sort=1&amp;type=<?php 
    echo $link1;
    ?>
"><?php 
    echo $language['name'];
    ?>
</a></td>
    <td class="colhead" align="left"><?php 
    echo $language['subs'];
    ?>
</td>
    <?php 
    echo $variant == 'index' ? '<td class=colhead align=center><a href="bookmarks.php"><img src="' . $pic_base_url . 'bookmark.gif"  border="0" alt="Bookmark" title="Bookmark" /></a></td>' : '';
    if ((bool) $waiton) {
        print "<td class=\"colhead\" align=\"center\">" . $language['wait'] . "</td>\n";
    }
    if ($oldtorrents) {
        ?>
    <td class="colhead" align="center"><a href="browse.php?<?php 
        echo $oldlink;
        ?>
sort=4&amp;type=<?php 
        echo $link4;
        ?>
">&nbsp;&nbsp;<img src=pic/added.gif border=0 alt=TTL /></a></td>
    <?php 
    }
    ?>
    <td class="colhead" align="left"><a href="browse.php?<?php 
    echo $oldlink;
    ?>
sort=2&amp;type=<?php 
    echo $link2;
    ?>
">&nbsp;&nbsp;&nbsp;<img src=pic/files.gif border=0 alt=Files /></a></td>
    <td class="colhead" align="left"><a href="browse.php?<?php 
    echo $oldlink;
    ?>
sort=3&amp;type=<?php 
    echo $link3;
    ?>
"><img src=pic/comments.gif border=0 alt=Comments /></a></td>
<td class="colhead" align="center"><img src="pic/download.gif" border=0 alt=download /></td>
<td class="colhead" align="center"><?php 
    echo $language['prog'];
    ?>
</td>
<td class="colhead" align="center"><a href="browse.php?<?php 
    echo $oldlink;
    ?>
sort=6&amp;type=<?php 
    echo $link6;
    ?>
"><?php 
    echo $language['size'];
    ?>
</a></td>
<td class="colhead" align="center"><a href="browse.php?<?php 
    echo $oldlink;
    ?>
sort=7&amp;type=<?php 
    echo $link7;
    ?>
">&nbsp;&nbsp;<img src=pic/top2.gif border=0 alt=Snatched /></a></td>
<td class="colhead" align="center"><a href="browse.php?<?php 
    echo $oldlink;
    ?>
sort=8&amp;type=<?php 
    echo $link8;
    ?>
">&nbsp;&nbsp;<img src=pic/arrowup2.gif border="0" alt=Seeders />&nbsp;&nbsp;</a></td>
<td class="colhead" align="center"><a href="browse.php?<?php 
    echo $oldlink;
    ?>
sort=9&amp;type=<?php 
    echo $link9;
    ?>
">&nbsp;&nbsp;<img src=pic/arrowdown2.gif border="0" alt=Leechers />&nbsp;&nbsp;</a></td>
<?php 
    if ($variant == "index") {
        echo "<td class=\"colhead\" align=\"center\"><a href=\"browse.php?{$oldlink}sort=9&amp;type={$link9}\"><img border=0 src=\"/pic/upper.gif\" alt=\"Upped By\" /></a></td>\n";
    }
    if (get_user_class() >= UC_MODERATOR) {
        echo "<td class=\"colhead\" align=center>" . $language['delete'] . "</td>\n";
    }
    echo "</tr>\n";
    foreach ($records as $row) {
        // while ($row = mysql_fetch_assoc($res)) {
        if ($CURUSER['split'] == "yes" && $_SERVER["REQUEST_URI"] == "/browse.php" && !isset($_GET["page"])) {
            /**
             *
             * @author StarionTurbo
             * @copyright 2007
             * @modname Show torrents by day
             * @version v1.0
             */
            /**
             * * Make some date varibles *
             */
            $day_added = $row['added'];
            $day_show = strtotime($day_added);
            $thisdate = date('Y-m-d', $day_show);
            $thisdate2 = date("Ynj", $day_show);
            /**
             * * If date already exist, disable $cleandate varible *
             */
            // if($thisdate==$prevdate){
            if (isset($prevdate) && $thisdate == $prevdate) {
                $cleandate = '';
                /**
                 * * If date does not exist, make some varibles *
                 */
            } else {
                $num = isset($split[$thisdate2]) ? $split[$thisdate2] : 0;
                $day_added = 'Upped on ' . date('l, j. M', strtotime($row['added']));
                // You can change this to something else
                $cleandate = "<tr><td colspan=\"15\"><b>{$day_added} (" . $num . " torrent" . ($num > 1 ? "s" : "") . ")</b></td></tr>\n";
                // This also...
            }
            /**
             * * Prevent that "torrents added..." wont appear again with the same date *
             */
            $prevdate = $thisdate;
            $man = array('Jan' => 'January', 'Feb' => 'February', 'Mar' => 'March', 'Apr' => 'April', 'May' => 'May', 'Jun' => 'June', 'Jul' => 'July', 'Aug' => 'August', 'Sep' => 'September', 'Oct' => 'October', 'Nov' => 'November', 'Dec' => 'December');
            foreach ($man as $eng => $ger) {
                $cleandate = str_replace($eng, $ger, $cleandate);
            }
            $dag = array('Mon' => 'Monday', 'Tues' => 'Tuesday', 'Wednes' => 'Wednesday', 'Thurs' => 'Thursday', 'Fri' => 'Friday', 'Satur' => 'Saturday', 'Sun' => 'Sunday');
            foreach ($dag as $eng => $ger) {
                $cleandate = str_replace($eng . 'day', $ger . '', $cleandate);
            }
            /**
             * * If torrents not listed by added date *
             */
            if ($row["sticky"] == "no") {
                // delete this line if you dont have sticky torrents or you want to display the addate for them also
                if (!isset($_GET['sort']) && !isset($_GET['d'])) {
                    echo $cleandate . "\n";
                }
            }
        }
        //ends the condition
        // ///standard sticky torrent hlight////////
        /*
                    $id = $row["id"];
                    if ($row["sticky"] == "yes"){
                    echo("<tr class=highlight>\n");
                    } else {
                    echo("<tr>\n");
                    }*/
        // ////End Sticky only highlight/////////////////
        // /////highlight torrenttable////////////////
        $id = $row['id'];
        if ($CURUSER["ttablehl"] != "yes") {
            echo '<tr>';
        } else {
            $countstatsclr = ($CURUSER['stylesheet'] == "1" ? "teal" : "") . ($CURUSER['stylesheet'] == "2" ? "teal" : "") . ($CURUSER['stylesheet'] == "3" ? "teal" : "") . ($CURUSER['stylesheet'] == "4" ? "teal" : "") . ($CURUSER['stylesheet'] == "5" ? "teal" : "") . ($CURUSER['stylesheet'] == "6" ? "teal" : "") . ($CURUSER['stylesheet'] == "7" ? "teal" : "");
            $nukedclr = ($CURUSER['stylesheet'] == "1" ? "red" : "") . ($CURUSER['stylesheet'] == "2" ? "red" : "") . ($CURUSER['stylesheet'] == "3" ? "red" : "") . ($CURUSER['stylesheet'] == "4" ? "red" : "") . ($CURUSER['stylesheet'] == "5" ? "red" : "") . ($CURUSER['stylesheet'] == "6" ? "red" : "") . ($CURUSER['stylesheet'] == "7" ? "red" : "");
            $sceneclr = ($CURUSER['stylesheet'] == "1" ? "orange" : "") . ($CURUSER['stylesheet'] == "2" ? "orange" : "") . ($CURUSER['stylesheet'] == "3" ? "orange" : "") . ($CURUSER['stylesheet'] == "4" ? "orange" : "") . ($CURUSER['stylesheet'] == "5" ? "orange" : "") . ($CURUSER['stylesheet'] == "6" ? "orange" : "") . ($CURUSER['stylesheet'] == "7" ? "orange" : "");
            $requestclr = ($CURUSER['stylesheet'] == "1" ? "#777777" : "") . ($CURUSER['stylesheet'] == "2" ? "#777777" : "") . ($CURUSER['stylesheet'] == "3" ? "#777777" : "") . ($CURUSER['stylesheet'] == "4" ? "#777777" : "") . ($CURUSER['stylesheet'] == "5" ? "#777777" : "") . ($CURUSER['stylesheet'] == "6" ? "#777777" : "") . ($CURUSER['stylesheet'] == "7" ? "#777777" : "");
            $stickyclr = ($CURUSER['stylesheet'] == "1" ? "gold" : "") . ($CURUSER['stylesheet'] == "2" ? "gold" : "") . ($CURUSER['stylesheet'] == "3" ? "gold" : "") . ($CURUSER['stylesheet'] == "4" ? "gold" : "") . ($CURUSER['stylesheet'] == "5" ? "gold" : "") . ($CURUSER['stylesheet'] == "6" ? "gold" : "") . ($CURUSER['stylesheet'] == "7" ? "gold" : "");
            $hl = ($row['countstats'] == "no" && $row['nuked'] == "no" ? $countstatsclr : "") . ($row['scene'] == "yes" && $row['request'] == "no" && $row['nuked'] == "no" ? $sceneclr : "") . ($row['request'] == "yes" && $row['scene'] == "no" && $row['nuked'] == "no" ? $requestclr : "") . ($row['sticky'] == "yes" ? $stickyclr : "") . ($row['nuked'] == "yes" ? $nukedclr : "");
            // //comment out to use gif indicate for seeding/leeching lower//////
            $req = sql_query("SELECT torrent, seeder FROM peers WHERE userid={$CURUSER['id']} AND torrent={$id}") or sqlerr();
            if (mysql_num_rows($req) > 0) {
                $peerid = mysql_fetch_assoc($req);
            }
            if ($peerid['seeder'] == 'yes' && $peerid['torrent'] == $id) {
                $hl = '#00AB3F';
            }
            if ($peerid['seeder'] == 'no' && $peerid['torrent'] == $id) {
                $hl = '#b22222 ';
            }
            $bgc = "bgcolor=" . $hl . "";
            echo '<tr ' . $bgc . '>';
        }
        // //////////////////end highlight torrenttable - comment out to use standard or gif indicator code lower/////////
        echo "<td align=center style='padding: 0px'>";
        // cached category icons
        include 'include/cache/categories.php';
        foreach ($categories as $cat) {
            if ($cat["id"] == $row["category"]) {
                echo "<a href=\"browse.php?cat=" . $cat["id"] . "\"><img src=\"pic/caticons/{$cat_ico_uri}/" . $cat["image"] . "\" border=\"0\" title=\"category " . $cat["name"] . "\" /></a>";
            }
        }
        echo "</td>\n";
        // end cat icon cache
        // ///////added under torrent name - uncomment out to use////
        //$added = "$row[added] (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"])) . " ago)";
        // ////////////////////////////////////end added///////////
        $genre = safeChar($row["newgenre"]);
        $nukereason = safeChar($row["nukereason"]);
        $scene = $row["scene"] == "yes" ? "&nbsp;<img src='pic/scene.gif' border=0 title='Scene' alt='Scene'/>" : "";
        $request = $row["request"] == "yes" ? "&nbsp;<img src='pic/request.gif' border=0 title='Request' alt='Request'/>" : "";
        $nuked = $row["nuked"] == "yes" ? "&nbsp;<img src='pic/nuked.gif' border=0 title='nuked' alt='Nuked'/>" : "";
        $newtag = sql_timestamp_to_unix_timestamp($row['added']) >= $_SESSION['browsetime'] ? '&nbsp;<img src=' . $pic_base_url . 'new.gif alt=NEW!>' : '';
        $viponly = $row["vip"] == "yes" ? "<img src='pic/star.gif' border=0 title='Vip Torrent' />" : "";
        // ///////freeslot in use on browse//////////
        $freeimg = '<img src="/pic/freedownload.gif" border=0"/>';
        $doubleimg = '<img src="/pic/doubleseed.gif" border=0"/>';
        $isdlfree = $row['doubleslot'] == 'yes' ? ' ' . $doubleimg . ' slot in use' : '';
        $isdouble = $row['freeslot'] == 'yes' ? ' ' . $freeimg . ' slot in use' : '';
        $uclass = '';
        // torrent name
        $dispname = $CURUSER["view_uclass"] == 'no' ? safeChar($row["name"]) : "<font color=\"#" . get_user_class_color($row["uclass"]) . "\">" . safeChar($row["name"]) . "</font>";
        // checked mod by pdq
        $checked = !empty($row['checked_by']) && $CURUSER['class'] >= UC_MODERATOR ? "&nbsp;<img src='" . $pic_base_url . "mod.gif' width='15' border='0' title='Checked - by " . safeChar($row['checked_by']) . "' />" : "";
        $sticky = $row["sticky"] == "yes" ? "<img src='pic/sticky.gif' border='0' alt='sticky' title='Sticky'>" : "";
        $countstats = $row["countstats"] == "no" ? "<img src='pic/freedownload.gif' border='0' alt='Free' title='Free Torrent'>" : "";
        $half = $row["half"] == "yes" ? "<img src='pic/halfdownload.png' border='0' alt='Half Leech' title='Half Leech'>" : "";
        // ///
        ///////////small description
        if (!empty($row['description'])) {
            $description = "(" . safeChar($row["description"]) . ")";
        } else {
            $description = "";
        }
        // ////////////////////////////////////////////////////////////////////////
        // ////////////////////////////////////////////////////////////////////////
        if ($row["poster"]) {
            $poster = "<img src=" . $row["poster"] . " width=150 border=0 />";
        }
        if ($row["descr"]) {
            $descr = ereg_replace("\"", "&quot;", readMore($row["descr"], 350, "details.php?id=" . $row["id"] . "&amp;hit=1"));
        }
        // userclass color mod ==end
        $dispname = ereg_replace('\\.', ' ', $dispname);
        echo "<td align=left><a href=details.php?id={$id} onmouseover=\"Tip('{$poster}');\" onmouseout=\"UnTip();\"><b>" . CutName($dispname, $char) . "</b></a>&nbsp;<a href=\"javascript:klappe_descr('descr" . $row["id"] . "');\" ><img src=\"/pic/plus.gif\" border=\"0\" title=\"Show torrent info in this page\"/></a>&nbsp;{$sticky}&nbsp;{$request}&nbsp;{$scene}&nbsp;{$nuked}<br />{$nukereason}&nbsp;{$newtag}&nbsp;{$viponly}&nbsp;{$countstats}&nbsp;{$half}&nbsp;{$description}\n";
        // //////////multiplicator///
        if ($row["multiplicator"] == "2") {
            $multiplicator = "&nbsp;<img src=\"pic/multi2.gif\" title=\"X2 Upload\">&nbsp;";
        } elseif ($row["multiplicator"] == "3") {
            $multiplicator = "&nbsp;<img src=\"pic/multi3.gif\" title=\"X3 Upload\">&nbsp;";
        } elseif ($row["multiplicator"] == "4") {
            $multiplicator = "&nbsp;<img src=\"pic/multi4.gif\" title=\"X4 Upload\">&nbsp;";
        } elseif ($row["multiplicator"] == "5") {
            $multiplicator = "&nbsp;<img src=\"pic/multi5.gif\" title=\"X5 Upload\">&nbsp;";
        }
        if ($row["multiplicator"] != "0") {
            echo "" . $multiplicator . "";
        }
        if ($row["pweb"] > 0) {
            echo "<img border=0 src=pic/seeder.gif onmouseover=\"Tip('web seeded by " . $row["pweb"] . " users');\" onmouseout=\"UnTip();\"/>";
        }
        // ////torrent added/genre/checked////
        //echo ($added);
        echo $genre;
        echo $checked;
        echo $isdlfree . '' . $isdouble;
        /////////////////subtitles
        $movie_cat = array("3", "5", "10", "11");
        //add here your movie category
        print "<td align=\"center\" nowrap=\"nowrap\" >\n";
        if (in_array($row["category"], $movie_cat) && !empty($row["subs"])) {
            $subs_array = explode(",", $row["subs"]);
            include 'cache/subs.php';
            foreach ($subs_array as $k => $sid) {
                foreach ($subs as $sub) {
                    if ($sub["id"] == $sid) {
                        print "<img border=\"0\" width=\"16px\" style=\"padding:3px;\"src=\"" . $sub["pic"] . "\" alt=\"" . $sub["name"] . "\" title=\"" . $sub["name"] . "\" />";
                    }
                }
            }
        } else {
            echo "---";
        }
        echo "</td>";
        ///////////////////end subs/////////
        //////////////////bookmarks/////////
        $bookmarked = !isset($row["bookmark"]) ? '<a href=\'bookmark.php?torrent=' . $id . '&amp;action=add\'><img src=\'' . $pic_base_url . 'bookmark.gif\' border=\'0\' alt=\'Bookmark it!\' title=\'Bookmark it!\' /></a>' : '<a href="bookmark.php?torrent=' . $id . '&amp;action=delete"><img src=\'' . $pic_base_url . 'plus2.gif\' border=\'0\' alt=\'Delete Bookmark!\' title=\'Delete Bookmark!\' /></a>';
        echo $variant == 'index' ? '<td align=right>' . $bookmarked . '</td>' : '';
        // == wait times on/off from admincp
        if ((bool) $waiton) {
            if ((int) $wait > 0) {
                $elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
                if ($elapsed < $wait) {
                    $color = dechex(floor(127 * ($wait - $elapsed) / 48 + 128) * 65536);
                    print "<td align=center nowrap=\"nowrap\"><a href=\"faq.php#dl8\"><font color=\"{$color}\">" . number_format($wait - $elapsed) . " h</font></a></td>\n";
                } else {
                    print "<td align=center>None</td>\n";
                }
            } else {
                print "<td align=center>None</td>\n";
            }
        }
        /////////////////ttl on/off from admincp
        if ($oldtorrents) {
            $ttl = 28 * 24 - floor((gmtime() - sql_timestamp_to_unix_timestamp($row["added"])) / 3600);
            if ($ttl == 1) {
                $ttl .= "<br />hour";
            } else {
                $ttl .= "<br />hours";
            }
            echo '<td align=center>' . $ttl . '</td>';
        }
        /////////////////////////////////
        if (isset($row['type']) && $row['type'] == "single") {
            // if ($row["type"] == "single")
            echo "<td align=\"right\">" . $row["numfiles"] . "</td>\n";
        } else {
            if ($variant == "index") {
                echo "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;hit=1\">" . $row["numfiles"] . "</a></b></td>\n";
            }
        }
        //////////////////////////////////////////
        if (!$row["comments"]) {
            echo "<td align=\"right\">" . $row["comments"] . "</td>\n";
        } else {
            if ($variant == "index") {
                echo "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;hit=1&amp;tocomm=1\">" . $row["comments"] . "</a></b></td>\n";
            } else {
                echo "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;page=0#startcomments\">" . $row["comments"] . "</a></b></td>\n";
            }
        }
        // ////Hide the quick download if download disabled/////
        if ($CURUSER["downloadpos"] == 'no') {
            echo "<td class=embedded><img src=" . $pic_base_url . "downloadpos.gif alt='no download' style='margin-left: 4pt' /></td>\n";
        } else {
            if ($CURUSER["downloadpos"] == 'yes') {
                echo "<td align=\"center\"><a href=\"/download.php/{$id}/" . rawurlencode($row["filename"]) . "\"><img src=pic/download.gif border=0 alt=Download /></a></td>\n";
            }
        }
        // Progressbar Mod
        // /comment out to remove indicator on browse//////
        $seedersProgressbar = array();
        $leechersProgressbar = array();
        $progressPerTorrent = 0;
        $iProgressbar = 0;
        if (isset($progress[$row["id"]])) {
            foreach ($progress[$row["id"]] as $rowProgressbar) {
                $progressPerTorrent += sprintf("%.2f", 100 * (1 - $rowProgressbar["to_go"] / $rowProgressbar["size"]));
                $iProgressbar++;
            }
        }
        if ($iProgressbar == 0) {
            $iProgressbar = 1;
        }
        $progressTotal = sprintf("%.2f", $progressPerTorrent / $iProgressbar);
        $picProgress = get_percent_completed_image(floor($progressTotal)) . "<br/>(" . round($progressTotal) . "%)";
        echo "<td align=center>{$picProgress}</td>\n";
        // End Progress Bar mod//////////////////////////
        echo "<td align=center>" . str_replace(" ", "<br/>", prefixed($row["size"])) . "</td>\n";
        $_s = "";
        if ($row["times_completed"] != 1) {
            $_s = "s";
        }
        if (get_user_class() >= UC_MODERATOR) {
            echo "<td align=center>" . ($row["times_completed"] > 0 ? "<a href=snatches.php?id={$id}>" . safeChar(number_format($row["times_completed"])) . "<br/>time{$_s}</a>" : "0 times") . "</td>\n";
        } else {
            echo "<td align=center>" . ($row["times_completed"] > 0 ? "" . safeChar(number_format($row["times_completed"])) . "<br/>time{$_s}</a>" : "0 times") . "</td>\n";
        }
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                echo "<td align=right><b><a href=details.php?id={$id}&amp;hit=1#seeders><font color=" . get_slr_color($ratio) . ">" . $row["seeders"] . "</font></a></b></td>\n";
            } else {
                echo "<td align=\"right\"><b><a class=\"" . linkcolor($row["seeders"]) . "\" href=\"details.php?id={$id}#seeders\">" . $row["seeders"] . "</a></b></td>\n";
            }
        } else {
            echo "<td align=\"right\"><span class=\"" . linkcolor($row["seeders"]) . "\">" . $row["seeders"] . "</span></td>\n";
        }
        $peerlink = '';
        if ($row["leechers"]) {
            if ($variant == "index") {
                echo "<td align=right><b><a href=details.php?id={$id}&amp;hit=1&amp;#leechers>" . number_format($row["leechers"]) . ($peerlink ? "</a>" : "") . "</b></td>\n";
            } else {
                echo "<td align=\"right\"><b><a class=\"" . linkcolor($row["leechers"]) . "\" href=\"details.php?id={$id}#leechers\">" . $row["leechers"] . "</a></b></td>\n";
            }
        } else {
            echo "<td align=\"right\">0</td>\n";
        }
        // //Anonymous and delete torrent begin
        if ($variant == "index") {
            if ($row["anonymous"] == "yes") {
                echo "<td align=center><i>Anonymous</i></td>\n";
                if (get_user_class() >= UC_MODERATOR) {
                    echo "<td align=\"center\" bgcolor=\"#FF0000\"><input type=\"checkbox\" name=\"delete[]\" value=\"" . safeChar($id) . "\" /></td>\n";
                }
            } else {
                if ($variant == "index") {
                    if ($CURUSER["view_uclass"] == 'yes') {
                        echo "<td align=center>" . (isset($row["username"]) ? "<a href=userdetails.php?id=" . $row["owner"] . "><font color=\"#" . get_user_class_color($row["uclass"]) . "\">" . safeChar($row["username"]) . "</font></a>" : "<i>(unknown)</i>") . "</td>\n";
                    } else {
                        echo "<td align=center>" . (isset($row["username"]) ? "<a href=userdetails.php?id=" . $row["owner"] . "><b>" . safechar($row["username"]) . "</b></a>" : "<i>(unknown)</i>") . "</td>\n";
                    }
                }
                // ///////modified Delete torrent with anonymous uploader
                if (get_user_class() >= UC_MODERATOR) {
                    echo "<td align=\"center\" bgcolor=\"#FF0000\"><input type=\"checkbox\" name=\"delete[]\" value=\"" . safeChar($id) . "\" /></td>\n";
                }
            }
        }
        echo "</tr>\n";
        echo "<tr id=\"kdescr" . $row["id"] . "\"style=\"display:none;\"><td width=\"90%\"  colspan=\"" . (get_user_class() >= UC_MODERATOR ? "15" : "13") . "\">" . $descr . "</td></tr>\n";
    }
    if (get_user_class() >= UC_MODERATOR) {
        echo "<tr ><td align=\"center\" colspan=16><input type=submit value=Delete /></td></tr>\n";
    }
    echo "</table></form>\n";
}
コード例 #12
0
function torrenttable($res, $variant = "index")
{
    global $pic_base_url, $CURUSER, $use_wait, $use_ttl, $ttl_days, $tracker_lang;
    if ($use_wait) {
        if ($CURUSER["class"] < UC_VIP && $CURUSER) {
            $gigs = $CURUSER["uploaded"] / (1024 * 1024 * 1024);
            $ratio = $CURUSER["downloaded"] > 0 ? $CURUSER["uploaded"] / $CURUSER["downloaded"] : 0;
            if ($ratio < 0.5 || $gigs < 5) {
                $wait = 48;
            } elseif ($ratio < 0.65 || $gigs < 6.5) {
                $wait = 24;
            } elseif ($ratio < 0.8 || $gigs < 8) {
                $wait = 12;
            } elseif ($ratio < 0.95 || $gigs < 9.5) {
                $wait = 6;
            } else {
                $wait = 0;
            }
        }
    }
    print "<tr>\n";
    // sorting by MarkoStamcar
    $count_get = 0;
    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 = $oldlink . "&" . $get_name . "=" . $get_value;
            } else {
                $oldlink = $oldlink . $get_name . "=" . $get_value;
            }
            $count_get++;
        }
    }
    if ($count_get > 0) {
        $oldlink = $oldlink . "&";
    }
    if ($_GET['sort'] == "1") {
        if ($_GET['type'] == "desc") {
            $link1 = "asc";
        } else {
            $link1 = "desc";
        }
    }
    if ($_GET['sort'] == "2") {
        if ($_GET['type'] == "desc") {
            $link2 = "asc";
        } else {
            $link2 = "desc";
        }
    }
    if ($_GET['sort'] == "3") {
        if ($_GET['type'] == "desc") {
            $link3 = "asc";
        } else {
            $link3 = "desc";
        }
    }
    if ($_GET['sort'] == "4") {
        if ($_GET['type'] == "desc") {
            $link4 = "asc";
        } else {
            $link4 = "desc";
        }
    }
    if ($_GET['sort'] == "5") {
        if ($_GET['type'] == "desc") {
            $link5 = "asc";
        } else {
            $link5 = "desc";
        }
    }
    if ($_GET['sort'] == "7") {
        if ($_GET['type'] == "desc") {
            $link7 = "asc";
        } else {
            $link7 = "desc";
        }
    }
    if ($_GET['sort'] == "8") {
        if ($_GET['type'] == "desc") {
            $link8 = "asc";
        } else {
            $link8 = "desc";
        }
    }
    if ($_GET['sort'] == "9") {
        if ($_GET['type'] == "desc") {
            $link9 = "asc";
        } else {
            $link9 = "desc";
        }
    }
    if ($_GET['sort'] == "10") {
        if ($_GET['type'] == "desc") {
            $link10 = "asc";
        } else {
            $link10 = "desc";
        }
    }
    if ($link1 == "") {
        $link1 = "asc";
    }
    // for torrent name
    if ($link2 == "") {
        $link2 = "desc";
    }
    if ($link3 == "") {
        $link3 = "desc";
    }
    if ($link4 == "") {
        $link4 = "desc";
    }
    if ($link5 == "") {
        $link5 = "desc";
    }
    if ($link7 == "") {
        $link7 = "desc";
    }
    if ($link8 == "") {
        $link8 = "desc";
    }
    if ($link9 == "") {
        $link9 = "desc";
    }
    if ($link10 == "") {
        $link10 = "desc";
    }
    $script = "browse.php";
    if ($variant == "mytorrents") {
        $script = "mytorrents.php";
    }
    if ($variant == "bookmarks") {
        $script = "bookmarks.php";
    }
    ?>
<td class="colhead" align="center"><?php 
    echo $tracker_lang['type'];
    ?>
</td>
<td class="colhead" align="left"><a href="<?php 
    print $script;
    ?>
?<?php 
    print $oldlink;
    ?>
sort=1&type=<?php 
    print $link1;
    ?>
" class="altlink_white"><?php 
    echo $tracker_lang['name'];
    ?>
</a> / <a href="<?php 
    print $script;
    ?>
?<?php 
    print $oldlink;
    ?>
sort=4&type=<?php 
    print $link4;
    ?>
" class="altlink_white"><?php 
    echo $tracker_lang['added'];
    ?>
</a></td>
<!--<td class="heading" align="left">DL</td>-->
<?php 
    if ($wait) {
        print "<td class=\"colhead\" align=\"center\">" . $tracker_lang['wait'] . "</td>\n";
    }
    if ($variant == "mytorrents") {
        print "<td class=\"colhead\" align=\"center\">" . $tracker_lang['visible'] . "</td>\n";
    }
    ?>
<td class="colhead" align="center"><a href="<?php 
    print $script;
    ?>
?<?php 
    print $oldlink;
    ?>
sort=2&type=<?php 
    print $link2;
    ?>
" class="altlink_white"><?php 
    echo $tracker_lang['files'];
    ?>
</a></td>
<td class="colhead" align="center"><a href="<?php 
    print $script;
    ?>
?<?php 
    print $oldlink;
    ?>
sort=3&type=<?php 
    print $link3;
    ?>
" class="altlink_white"><?php 
    echo $tracker_lang['comments'];
    ?>
</a></td>
<?php 
    if ($use_ttl) {
        ?>
	<td class="colhead" align="center"><?php 
        echo $tracker_lang['ttl'];
        ?>
</td>
<?php 
    }
    ?>
<td class="colhead" align="center"><a href="<?php 
    print $script;
    ?>
?<?php 
    print $oldlink;
    ?>
sort=5&type=<?php 
    print $link5;
    ?>
" class="altlink_white"><?php 
    echo $tracker_lang['size'];
    ?>
</a></td>
<!--
<td class="colhead" align="right">Views</td>
<td class="colhead" align="right">Hits</td>
-->
<td class="colhead" align="center"><a href="<?php 
    print $script;
    ?>
?<?php 
    print $oldlink;
    ?>
sort=7&type=<?php 
    print $link7;
    ?>
" class="altlink_white"><?php 
    echo $tracker_lang['seeds'];
    ?>
</a>|<a href="<?php 
    print $script;
    ?>
?<?php 
    print $oldlink;
    ?>
sort=8&type=<?php 
    print $link8;
    ?>
" class="altlink_white"><?php 
    echo $tracker_lang['leechers'];
    ?>
</a></td>
<?php 
    if ($variant == "index" || $variant == "bookmarks") {
        print "<td class=\"colhead\" align=\"center\"><a href=\"{$script}?{$oldlink}sort=9&type={$link9}\" class=\"altlink_white\">" . $tracker_lang['uploadeder'] . "</a></td>\n";
    }
    if (get_user_class() >= UC_MODERATOR && $variant == "index") {
        print "<td class=\"colhead\" align=\"center\"><a href=\"{$script}?{$oldlink}sort=10&type={$link10}\" class=\"altlink_white\">Изменен</td>";
    }
    if (get_user_class() >= UC_MODERATOR && $variant == "index") {
        print "<td class=\"colhead\" align=\"center\">" . $tracker_lang['delete'] . "</td>\n";
    }
    if ($variant == "bookmarks") {
        print "<td class=\"colhead\" align=\"center\">" . $tracker_lang['delete'] . "</td>\n";
    }
    print "</tr>\n";
    print "<tbody id=\"highlighted\">";
    if (get_user_class() >= UC_MODERATOR && $variant == "index") {
        print "<form method=\"post\" action=\"deltorrent.php?mode=delete\">";
    }
    if ($variant == "bookmarks") {
        print "<form method=\"post\" action=\"takedelbookmark.php\">";
    }
    while ($row = mysql_fetch_assoc($res)) {
        $id = $row["id"];
        print "<tr" . ($row["not_sticky"] == "no" ? " class=\"highlight\"" : "") . ">\n";
        print "<td align=\"center\" style=\"padding: 0px\">";
        if (isset($row["cat_name"])) {
            print "<a href=\"browse.php?cat=" . $row["category"] . "\">";
            if (isset($row["cat_pic"]) && $row["cat_pic"] != "") {
                print "<img border=\"0\" src=\"{$pic_base_url}/cats/" . $row["cat_pic"] . "\" alt=\"" . $row["cat_name"] . "\" />";
            } else {
                print $row["cat_name"];
            }
            print "</a>";
        } else {
            print "-";
        }
        print "</td>\n";
        $dispname = $row["name"];
        switch ($row['free']) {
            case 'yes':
                $freepic = "<img src=\"{$pic_base_url}/freedownload.gif\" title=\"" . $tracker_lang['golden'] . "\" alt=\"" . $tracker_lang['golden'] . "\">";
                break;
            case 'silver':
                $freepic = "<img src=\"{$pic_base_url}/silverdownload.gif\" title=\"" . $tracker_lang['silver'] . "\" alt=\"" . $tracker_lang['silver'] . "\">";
                break;
            case 'no':
                $freepic = '';
        }
        $thisisfree = $freepic;
        print "<td align=\"left\">" . ($row["not_sticky"] == "no" ? "Важный: " : "") . "<a href=\"details.php?";
        if ($variant == "mytorrents") {
            print "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;";
        }
        print "id={$id}";
        if ($variant == "index" || $variant == "bookmarks") {
            print "&amp;hit=1";
        }
        print "\"><b>{$dispname}</b></a> {$thisisfree}\n";
        if ($variant != "bookmarks" && $CURUSER) {
            print "<a href=\"bookmark.php?torrent={$row['id']}\"><img border=\"0\" src=\"{$pic_base_url}/bookmark.gif\" alt=\"" . $tracker_lang['bookmark_this'] . "\" title=\"" . $tracker_lang['bookmark_this'] . "\" /></a>\n";
        }
        print "<a href=\"download.php?id={$id}\"><img src=\"{$pic_base_url}/download.gif\" border=\"0\" alt=\"" . $tracker_lang['download'] . "\" title=\"" . $tracker_lang['download'] . "\"></a>\n";
        if ($row['multitracker'] == 'yes') {
            print "<a href=\"" . magnet(true, $row['info_hash'], $row['filename'], $row['size']) . "\"><img src=\"{$pic_base_url}/magnet.png\" border=\"0\" alt=\"{$tracker_lang['magnet']}\" title=\"{$tracker_lang['magnet']}\"></a>\n";
            $allow_update = strtotime($row['last_mt_update']) < TIMENOW - 3600;
            if ($allow_update) {
                $suffix = '_update';
            }
            $multi_image = "<img src=\"{$pic_base_url}/multitracker.png\" border=\"0\" alt=\"{$tracker_lang['external_torrent' . $suffix]}\" title=\"{$tracker_lang['external_torrent' . $suffix]}\" />\n";
            if ($allow_update) {
                $multi_image = "<a href=\"update_multi.php?id={$id}\">{$multi_image}</a>\n";
            }
            echo $multi_image;
        }
        if ($CURUSER["id"] == $row["owner"] || get_user_class() >= UC_MODERATOR) {
            $owned = 1;
        } else {
            $owned = 0;
        }
        if ($owned) {
            print "<a href=\"edit.php?id={$row['id']}\"><img border=\"0\" src=\"{$pic_base_url}/pen.gif\" alt=\"" . $tracker_lang['edit'] . "\" title=\"" . $tracker_lang['edit'] . "\" /></a>\n";
        }
        if ($row["readtorrent"] == 0 && $variant == "index") {
            print "<b><font color=\"red\" size=\"1\">[новый]</font></b>";
        }
        print "<br /><i>" . $row["added"] . "</i>";
        if ($wait) {
            $elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
            if ($elapsed < $wait) {
                $color = dechex(floor(127 * ($wait - $elapsed) / 48 + 128) * 65536);
                print "<td align=\"center\"><nobr><a href=\"faq.php#dl8\"><font color=\"{$color}\">" . number_format($wait - $elapsed) . " h</font></a></nobr></td>\n";
            } else {
                print "<td align=\"center\"><nobr>" . $tracker_lang['no'] . "</nobr></td>\n";
            }
        }
        print "</td>\n";
        if ($variant == "mytorrents") {
            print "<td align=\"right\">";
            if ($row["visible"] == "no") {
                print "<font color=\"red\"><b>" . $tracker_lang['no'] . "</b></font>";
            } else {
                print "<font color=\"green\">" . $tracker_lang['yes'] . "</font>";
            }
            print "</td>\n";
        }
        if ($row["type"] == "single") {
            print "<td align=\"right\">" . $row["numfiles"] . "</td>\n";
        } else {
            if ($variant == "index") {
                print "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;hit=1&amp;filelist=1\">" . $row["numfiles"] . "</a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;filelist=1#filelist\">" . $row["numfiles"] . "</a></b></td>\n";
            }
        }
        if (!$row["comments"]) {
            print "<td align=\"right\">" . $row["comments"] . "</td>\n";
        } else {
            if ($variant == "index") {
                print "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;hit=1&amp;tocomm=1\">" . $row["comments"] . "</a></b></td>\n";
            } else {
                print "<td align=\"right\"><b><a href=\"details.php?id={$id}&amp;page=0#startcomments\">" . $row["comments"] . "</a></b></td>\n";
            }
        }
        //		print("<td align=center><nobr>" . str_replace(" ", "<br />", $row["added"]) . "</nobr></td>\n");
        $ttl = $ttl_days * 24 - floor((gmtime() - sql_timestamp_to_unix_timestamp($row["added"])) / 3600);
        if ($ttl == 1) {
            $ttl .= " час";
        } else {
            $ttl .= "&nbsp;часов";
        }
        if ($use_ttl) {
            print "<td align=\"center\">{$ttl}</td>\n";
        }
        print "<td align=\"center\">" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n";
        //		print("<td align=\"right\">" . $row["views"] . "</td>\n");
        //		print("<td align=\"right\">" . $row["hits"] . "</td>\n");
        print "<td align=\"center\">";
        if ($row["seeders"]) {
            if ($variant == "index") {
                if ($row["leechers"]) {
                    $ratio = $row["seeders"] / $row["leechers"];
                } else {
                    $ratio = 1;
                }
                print "<b><a href=\"details.php?id={$id}&amp;hit=1&amp;toseeders=1\"><font color=" . get_slr_color($ratio) . ">" . $row["seeders"] . "</font></a></b>\n";
            } else {
                print "<b><a class=\"" . linkcolor($row["seeders"]) . "\" href=\"details.php?id={$id}&amp;dllist=1#seeders\">" . $row["seeders"] . "</a></b>\n";
            }
        } else {
            print "<span class=\"" . linkcolor($row["seeders"]) . "\">" . $row["seeders"] . "</span>";
        }
        print " | ";
        if ($row["leechers"]) {
            if ($variant == "index") {
                print "<b><a href=\"details.php?id={$id}&amp;hit=1&amp;todlers=1\">" . number_format($row["leechers"]) . ($peerlink ? "</a>" : "") . "</b>\n";
            } else {
                print "<b><a class=\"" . linkcolor($row["leechers"]) . "\" href=\"details.php?id={$id}&amp;dllist=1#leechers\">" . $row["leechers"] . "</a></b>\n";
            }
        } else {
            print "0\n";
        }
        print "</td>";
        if ($variant == "index" || $variant == "bookmarks") {
            print "<td align=\"center\">" . (isset($row["username"]) ? "<a href=\"userdetails.php?id=" . $row["owner"] . "\"><b>" . get_user_class_color($row["class"], htmlspecialchars_uni($row["username"])) . "</b></a>" : "<i>(unknown)</i>") . "</td>\n";
        }
        if ($variant == "bookmarks") {
            print "<td align=\"center\"><input type=\"checkbox\" name=\"delbookmark[]\" value=\"" . $row[bookmarkid] . "\" /></td>";
        }
        if (get_user_class() >= UC_MODERATOR && $variant == "index") {
            if ($row["moderated"] == "no") {
                print "<td align=\"center\"><font color=\"red\"><b>Нет</b></font></td>\n";
            } else {
                print "<td align=\"center\"><a href=\"userdetails.php?id={$row['moderatedby']}\"><font color=\"green\"><b>Да</b></font></a></td>\n";
            }
        }
        if (get_user_class() >= UC_MODERATOR && $variant == "index") {
            print "<td align=\"center\"><input type=\"checkbox\" name=\"delete[]\" value=\"" . $id . "\" /></td>\n";
        }
        print "</tr>\n";
    }
    print "</tbody>";
    if ($variant == "index" && $CURUSER) {
        print "<tr><td class=\"colhead\" colspan=\"12\" align=\"center\"><a href=\"markread.php\" class=\"altlink_white\">Все торренты прочитаны</a></td></tr>";
    }
    //print("</table>\n");
    if ($variant == "index") {
        if (get_user_class() >= UC_MODERATOR) {
            print "<tr><td align=\"right\" colspan=\"12\"><input type=\"submit\" value=\"Удалить\"></td></tr>\n";
        }
    }
    if ($variant == "bookmarks") {
        print "<tr><td colspan=\"12\" align=\"right\"><input type=\"submit\" value=\"" . $tracker_lang['delete'] . "\"></td></tr>\n";
    }
    if ($variant == "index" || $variant == "bookmarks") {
        if (get_user_class() >= UC_MODERATOR) {
            print "</form>\n";
        }
    }
    return $rows;
}