|
#1
|
|||
|
|||
How to shorten torrent names
Hey guys,
I tried shortening the torrent names in browse.php but no luck so far. I wanted to ask if someone knows how to do it. My goal is to make the maximum amount of chars allowed around 20. If someone uploads a torrent name with more than 20 chars to shorten it using "..." For example: Those Magnificent Men in Their Flying Machines or How I Flew from London to Paris in 25 hours 11 minutes to Those Magnificent Me... |
#2
|
||||
|
||||
Quote:
edit details.php and add this Code:
function replace($data) { $originals = array(".", "-", "DVDRip", "XviD", "RedBlade", "TWiST", "MAGNiTUDE", "WEBRip", "FTP", "TWiST", "HDNORDiC", "BLURAY", "COMPLETE", "Fi", "LIMITED", "HDTV", "x264", "TLA", "NOSCREENS", "1080p", "FiHTV", "HTV", "C4TV", "2HD", "EVOLVE", "KILLERS", "BALLS", "720p", "PDTV", "FQM", "BWB", "_", "FoV", "INNOCENCE", "iGNiTiON", "DVDR", "2012", "ViDERE", "SPANiSH", "SCARED", "2011", "NTSC", "WTF", "SHOCKWAVE", "KYR", "SKGTV", "CRiMSON", "TARGET", "PSYCHD", "ANGELiC", "CAM", "HP", "FooKaS", "R6", "DIMENSION", "X264", "HDTV", "720p"," AQOS","HDRip","CHD","DTS","REAL","AFG","AC3","R5","BAJSKORV","INTERNAL","S01","S02","S03","S04","S05","S06","S07","S08","S09", "S10","S11","S12","S13","S14","S15","S16","S16","S17","S18","S19","S20","S21","S22","S23","S24","S25","S26","S27","S28","S29","S30", "E02","E02","E03","E04","S05","E06","S07","S08","S09","S10","S11","E12","S13","E14","E15","E16","E17","E18","E19","E20","E21","E22","E23","E24","E25","E26","E27","E28","E29","E30"); $replacements = array(" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "); $data = str_ireplace($originals, $replacements, $data); return $data; } $myData = $row["name"]; $name_clean = replace($myData); PHP Code:
this PHP Code:
PHP Code:
__________________
Please Support Majority Report You can contact me on Skype live:phesadent.elect but please let me know first. If you are ever need me desperately then please email me at dan.oak44@gmail.com and I will contact u within a week. Due to free time I'm able to help interested member's with their tracker. Please Note! Depending on your requests I will charge you for my assistance for Tracker installs and mods. All my mods are custom and prices will very depending on the request. I'm able to install any tracker and mods including themes. Please PM me Last edited by firefly007; 17th June 2013 at 13:41. |
#3
|
|||
|
|||
Thanks but it is not working. Also I need it in browse.php not in details.php
Code:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' |
#4
|
||||
|
||||
Quote:
and I will do it Edit: I forgot a few " in the function Ive corrected it and it should work....
__________________
Please Support Majority Report You can contact me on Skype live:phesadent.elect but please let me know first. If you are ever need me desperately then please email me at dan.oak44@gmail.com and I will contact u within a week. Due to free time I'm able to help interested member's with their tracker. Please Note! Depending on your requests I will charge you for my assistance for Tracker installs and mods. All my mods are custom and prices will very depending on the request. I'm able to install any tracker and mods including themes. Please PM me |
#5
|
|||
|
|||
bittorrent.php
Code:
<? function local_user() { return $_SERVER["SERVER_ADDR"] == $_SERVER["REMOTE_ADDR"]; } // PHP5 with register_long_arrays off? if (!isset($HTTP_POST_VARS) && isset($_POST)) { $HTTP_POST_VARS = $_POST; $HTTP_GET_VARS = $_GET; $HTTP_SERVER_VARS = $_SERVER; $HTTP_COOKIE_VARS = $_COOKIE; $HTTP_ENV_VARS = $_ENV; $HTTP_POST_FILES = $_FILES; } function strip_magic_quotes($arr) { foreach ($arr as $k => $v) { if (is_array($v)) { $arr[$k] = strip_magic_quotes($v); } else { $arr[$k] = stripslashes($v); } } return $arr; } if (get_magic_quotes_gpc()) { if (!empty($_GET)) { $_GET = strip_magic_quotes($_GET); } if (!empty($_POST)) { $_POST = strip_magic_quotes($_POST); } if (!empty($_COOKIE)) { $_COOKIE = strip_magic_quotes($_COOKIE); } } //Directory for subs $SUBSPATH = "subs"; # local path to subs dir, chmod 777 // addslashes to vars if magic_quotes_gpc is off // this is a security precaution to prevent someone // trying to break out of a SQL statement. // if( !get_magic_quotes_gpc() ) { if( is_array($HTTP_GET_VARS) ) { while( list($k, $v) = each($HTTP_GET_VARS) ) { if( is_array($HTTP_GET_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) { $HTTP_GET_VARS[$k][$k2] = addslashes($v2); } @reset($HTTP_GET_VARS[$k]); } else { $HTTP_GET_VARS[$k] = addslashes($v); } } @reset($HTTP_GET_VARS); } if( is_array($HTTP_POST_VARS) ) { while( list($k, $v) = each($HTTP_POST_VARS) ) { if( is_array($HTTP_POST_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) { $HTTP_POST_VARS[$k][$k2] = addslashes($v2); } @reset($HTTP_POST_VARS[$k]); } else { $HTTP_POST_VARS[$k] = addslashes($v); } } @reset($HTTP_POST_VARS); } if( is_array($HTTP_COOKIE_VARS) ) { while( list($k, $v) = each($HTTP_COOKIE_VARS) ) { if( is_array($HTTP_COOKIE_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) ) { $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2); } @reset($HTTP_COOKIE_VARS[$k]); } else { $HTTP_COOKIE_VARS[$k] = addslashes($v); } } @reset($HTTP_COOKIE_VARS); } } $FUNDS = "$0"; $SITE_ONLINE = true; //$SITE_ONLINE = local_user(); //$SITE_ONLINE = false; $max_torrent_size = 1000000; $announce_interval = 60 * 30; $signup_timeout = 86400 * 3; $minvotes = 1; $max_dead_torrent_time = 6 * 3600; // Max users on site $maxusers = 5000; // ONLY USE ONE OF THE FOLLOWING DEPENDING ON YOUR O/S!!! $torrent_dir = "torrents"; # FOR UNIX ONLY - must be writable for httpd user //$torrent_dir = "torrents"; # FOR WINDOWS ONLY - must be writable for httpd user # the first one will be displayed on the pages $announce_urls = array(); $announce_urls[] = "http://localhost/announce.php"; if ($_SERVER["HTTP_HOST"] == "") $_SERVER["HTTP_HOST"] = $_SERVER["SERVER_NAME"]; $BASEURL = "http://localhost"; // Set this to your site URL... No ending slash! (/) $DEFAULTBASEURL = "http://localhost"; //set this to true to make this a tracker that only registered users may use $MEMBERSONLY = true; //maximum number of peers (seeders+leechers) allowed before torrents starts to be deleted to make room... //set this to something high if you don't require this feature $PEERLIMIT = 50000; // Email for sender/return path. $SITEEMAIL = "noreply@127.0.0.1"; $SITENAME = "TEST"; $autoclean_interval = 900; $pic_base_url = "/pic/"; require_once("secrets.php"); require_once("cleanup.php"); function maxsysop () { global $CURUSER; $lmaxclass = 10; $lsysopnames = array("Admin", "admin", "test", "Test"); // Case sensitive. if ($CURUSER["class"] >= $lmaxclass) if (!in_array($CURUSER["username"], $lsysopnames)) stderr("Sorry","We come to believe you are using a fake account, therefore we've logged this action!"); } //Do not modify -- versioning system //This will help identify code for support issues at tbdev.net define ('TBVERSION','TBDEV.NET-12-09-05'); /**** validip/getip courtesy of manolete <manolete@myway.com> ****/ // IP Validation function validip($ip) { if (!empty($ip) && $ip == long2ip(ip2long($ip))) { // reserved IANA IPv4 addresses // http://www.iana.org/assignments/ipv4-address-space $reserved_ips = array ( array('0.0.0.0','2.255.255.255'), array('10.0.0.0','10.255.255.255'), array('127.0.0.0','127.255.255.255'), array('169.254.0.0','169.254.255.255'), array('172.16.0.0','172.31.255.255'), array('192.0.2.0','192.0.2.255'), array('192.168.0.0','192.168.255.255'), array('255.255.255.0','255.255.255.255') ); foreach ($reserved_ips as $r) { $min = ip2long($r[0]); $max = ip2long($r[1]); if ((ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false; } return true; } else return false; } // Patched function to detect REAL IP address if it's valid function getip() { if (isset($_SERVER)) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && validip($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_CLIENT_IP']) && validip($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = $_SERVER['REMOTE_ADDR']; } } else { if (getenv('HTTP_X_FORWARDED_FOR') && validip(getenv('HTTP_X_FORWARDED_FOR'))) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_CLIENT_IP') && validip(getenv('HTTP_CLIENT_IP'))) { $ip = getenv('HTTP_CLIENT_IP'); } else { $ip = getenv('REMOTE_ADDR'); } } return $ip; } function dbconn($autoclean = false) { global $mysql_host, $mysql_user, $mysql_pass, $mysql_db; if (!@mysql_connect($mysql_host, $mysql_user, $mysql_pass)) { switch (mysql_errno()) { case 1040: case 2002: if ($_SERVER[REQUEST_METHOD] == "GET") die("<html><head><meta http-equiv=refresh content=\"5 $_SERVER[REQUEST_URI]\"></head><body><table border=0 width=100% height=100%><tr><td><h3 align=center>The server load is very high at the moment. Retrying, please wait...</h3></td></tr></table></body></html>"); else die("Too many users. Please press the Refresh button in your browser to retry."); default: die("[" . mysql_errno() . "] dbconn: mysql_connect: " . mysql_error()); } } mysql_select_db($mysql_db) or die('dbconn: mysql_select_db: ' + mysql_error()); userlogin(); if ($autoclean) register_shutdown_function("autoclean"); } function userlogin() { global $SITE_ONLINE; unset($GLOBALS["CURUSER"]); $ip = getip(); $nip = ip2long($ip); $res = mysql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) > 0) { header("HTTP/1.0 403 Forbidden"); print("<html><body><h1>403 Forbidden</h1>Unauthorized IP address.</body></html>\n"); die; } if (!$SITE_ONLINE || empty($_COOKIE["uid"]) || empty($_COOKIE["pass"])) return; $id = 0 + $_COOKIE["uid"]; if (!$id || strlen($_COOKIE["pass"]) != 32) return; $res = mysql_query("SELECT * FROM users WHERE id = $id AND enabled='yes' AND status = 'confirmed'");// or die(mysql_error()); $row = mysql_fetch_array($res); if (!$row) return; $sec = hash_pad($row["secret"]); if ($_COOKIE["pass"] !== md5($row["passhash"].$_SERVER["REMOTE_ADDR"])) return; mysql_query("UPDATE users SET last_access='" . get_date_time() . "', ip=".sqlesc($ip)." WHERE id=" . $row["id"]);// or die(mysql_error()); $row['ip'] = $ip; $GLOBALS["CURUSER"] = $row; } function autoclean() { global $autoclean_interval; $now = time(); $docleanup = 0; $res = mysql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime'"); $row = mysql_fetch_array($res); if (!$row) { mysql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime',$now)"); return; } $ts = $row[0]; if ($ts + $autoclean_interval > $now) return; mysql_query("UPDATE avps SET value_u=$now WHERE arg='lastcleantime' AND value_u = $ts"); if (!mysql_affected_rows()) return; docleanup(); } function unesc($x) { if (get_magic_quotes_gpc()) return stripslashes($x); return $x; } function mksize($bytes) { if ($bytes < 1000 * 1024) return number_format($bytes / 1024, 2) . " kB"; elseif ($bytes < 1000 * 1048576) return number_format($bytes / 1048576, 2) . " MB"; elseif ($bytes < 1000 * 1073741824) return number_format($bytes / 1073741824, 2) . " GB"; else return number_format($bytes / 1099511627776, 2) . " TB"; } function mksizeint($bytes) { $bytes = max(0, $bytes); if ($bytes < 1000) return floor($bytes) . " B"; elseif ($bytes < 1000 * 1024) return floor($bytes / 1024) . " kB"; elseif ($bytes < 1000 * 1048576) return floor($bytes / 1048576) . " MB"; elseif ($bytes < 1000 * 1073741824) return floor($bytes / 1073741824) . " GB"; else return floor($bytes / 1099511627776) . " TB"; } function deadtime() { global $announce_interval; return time() - floor($announce_interval * 1.3); } function mkprettytime($s) { if ($s < 0) $s = 0; $t = array(); foreach (array("60:sec","60:min","24:hour","0:day") as $x) { $y = explode(":", $x); if ($y[0] > 1) { $v = $s % $y[0]; $s = floor($s / $y[0]); } else $v = $s; $t[$y[1]] = $v; } if ($t["day"]) return $t["day"] . "d " . sprintf("%02d:%02d:%02d", $t["hour"], $t["min"], $t["sec"]); if ($t["hour"]) return sprintf("%d:%02d:%02d", $t["hour"], $t["min"], $t["sec"]); // if ($t["min"]) return sprintf("%d:%02d", $t["min"], $t["sec"]); // return $t["sec"] . " secs"; } function mkglobal($vars) { if (!is_array($vars)) $vars = explode(":", $vars); foreach ($vars as $v) { if (isset($_GET[$v])) $GLOBALS[$v] = unesc($_GET[$v]); elseif (isset($_POST[$v])) $GLOBALS[$v] = unesc($_POST[$v]); else return 0; } return 1; } function tr($x,$y,$noesc=0) { if ($noesc) $a = $y; else { $a = htmlspecialchars($y); $a = str_replace("\n", "<br />\n", $a); } print("<tr><td class=\"heading\" valign=\"top\" align=\"right\">$x</td><td valign=\"top\" align=left>$a</td></tr>\n"); } function validfilename($name) { return preg_match('/^[^\0-\x1f:\\\\\/?*\xff#<>|]+$/si', $name); } function validemail($email) { return preg_match('/^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/is', $email); } function sqlesc($x) { return "'".mysql_real_escape_string($x)."'"; } function sqlwildcardesc($x) { return str_replace(array("%","_"), array("\\%","\\_"), mysql_real_escape_string($x)); } function urlparse($m) { $t = $m[0]; if (preg_match(',^\w+://,', $t)) return "<a href=\"$t\">$t</a>"; return "<a href=\"http://$t\">$t</a>"; } function parsedescr($d, $html) { if (!$html) { $d = htmlspecialchars($d); $d = str_replace("\n", "\n<br>", $d); } return $d; } function stdhead($title = "", $msgalert = true) { global $CURUSER, $SITE_ONLINE, $FUNDS, $SITENAME; if (!$SITE_ONLINE) die("Site is down for maintenance, please check back again later... thanks<br>"); header("Content-Type: text/html; charset=windows-1251"); //header("Pragma: No-cache"); if ($title == "") $title = $SITENAME .(isset($_GET['tbv'])?" (".TBVERSION.")":''); else $title = $SITENAME .(isset($_GET['tbv'])?" (".TBVERSION.")":''). " :: " . htmlspecialchars($title); if ($CURUSER) { $ss_a = @mysql_fetch_array(@mysql_query("select uri from stylesheets where id=" . $CURUSER["stylesheet"])); if ($ss_a) $ss_uri = $ss_a["uri"]; } if (!$ss_uri) { ($r = mysql_query("SELECT uri FROM stylesheets WHERE id=1")) or die(mysql_error()); ($a = mysql_fetch_array($r)) or die(mysql_error()); $ss_uri = $a["uri"]; } if ($msgalert && $CURUSER) { $res = mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " && unread='yes'") or die("OopppsY!"); $arr = mysql_fetch_row($res); $unread = $arr[0]; } ?> <html><head> <script type="text/javascript" src="../popup.js"></script> <script type="text/javascript" src="java_klappe.js"></script> <title><?= $title ?></title> <link rel="stylesheet" href="/<?=$ss_uri?>" type="text/css"> <script LANGUAGE="JavaScript"> <!-- Begin var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } } // End --> </script> <script type="text/javascript" src="overlib.js"></script> </head> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> <body> <table width=100% cellspacing=0 cellpadding=0 style='background: transparent'> <tr> <td class=clear width=49%> <!-- <table border=0 cellspacing=0 cellpadding=0 style='background: transparent'> <tr> --> </td> <td class=clear> <div align=center> <a href=/index.php><img style=border:none alt=Home title=Home src=pic/logo.gif></a> </div> </td> <td class=clear width=100% align=right> </td> </tr></table> <!-- /////// some vars for the statusbar;o) //////// --> <? if ($CURUSER) { ?> <? $datum = getdate(); $datum[hours] = sprintf("%02.0f", $datum[hours]); $datum[minutes] = sprintf("%02.0f", $datum[minutes]); $uped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); if ($CURUSER["downloaded"] > 0) { $ratio = $CURUSER['uploaded'] / $CURUSER['downloaded']; $ratio = number_format($ratio, 3); $color = get_ratio_color($ratio); if ($color) $ratio = "<font color=$color>$ratio</font>"; } else if ($CURUSER["uploaded"] > 0) $ratio = "Inf."; else $ratio = "---"; if ($CURUSER['donor'] == "yes") $medaldon = "<img src=pic/star.gif alt=donor title=donor>"; if ($CURUSER['warned'] == "yes") $warn = "<img src=pic/warned.gif alt=warned title=warned>"; //// check for messages ////////////////// $res1 = mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND location>0") or print(mysql_error()); $arr1 = mysql_fetch_row($res1); $messages = $arr1[0]; $res1 = mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND location=1 AND unread='yes'") or print(mysql_error()); $arr1 = mysql_fetch_row($res1); $unread = $arr1[0]; $res1 = mysql_query("SELECT COUNT(*) FROM messages WHERE sender=" . $CURUSER["id"] . " AND saved='yes'") or print(mysql_error()); $arr1 = mysql_fetch_row($res1); $outmessages = $arr1[0]; if ($unread) $inboxpic = "<img height=11px style=border:none alt=inbox title='inbox (new messages)' src=pic/pn_inboxnew.gif>"; else $inboxpic = "<img height=11px style=border:none alt=inbox title='inbox (no new messages)' src=pic/pn_inbox.gif>"; //// check active torrents /////////////////////// $res2 = mysql_query("SELECT COUNT(*) FROM peers WHERE userid=" . $CURUSER["id"] . " AND seeder='yes'") or print(mysql_error()); $row = mysql_fetch_row($res2); $activeseed = $row[0]; $res2 = mysql_query("SELECT COUNT(*) FROM peers WHERE userid=" . $CURUSER["id"] . " AND seeder='no'") or print(mysql_error()); $row = mysql_fetch_row($res2); $activeleech = $row[0]; //// end // check if user is connectable or not $res3 = mysql_query("SELECT connectable FROM peers WHERE userid=" . sqlesc($CURUSER["id"]) . " LIMIT 1") or print(mysql_error()); if($row = mysql_fetch_row($res3)){ $connect = $row[0]; if($connect == "yes"){ $connectable = "<b><font color=green><a title='Connectable = Great!'>Yes</a></font></b>"; }else{ $connectable = "<b><font color=red><a title='Connectable = Oh no.'>No</a></font></b>"; } }else{ $connectable ="<b><a title='no detected'>no detected</a></b>"; } // end ?> <!-- //////// start the statusbar ///////////// --> <table cellpadding="5" cellspacing="0" border="0" style="width: 100%; padding:2px;" class="bottom"> <tr> <td class="tablea"><table align="center" style="width:99%" cellspacing="0" cellpadding="0" border="0"> <tr> <td class="bottom" align="left"><span class="smallfont"><b>Добре дошъл</b>, <b><a href="userdetails.php?id=<?=$CURUSER['id']?>"><?=$CURUSER['username']?></a></b><?=$medaldon?><?=$warn?> [<a href="logout.php">излез</a>] <a href=invite.php?id=<?=$CURUSER['id']?>></a><br/> Коефициент: <?=$ratio?> Качено: <span class="smallfont1"><?=$uped?></span></font> Свалено: <span class="smallfont1"><?=$downed?></span> (обновява се на 24ч.) </td> </td> <td class="bottom" align="right"><span class="smallfont">Часът в момента е <b><?echo "$datum[hours]:$datum[minutes]:$datum[seconds]";?></b><br/> <? if ($messages){ print("<b><span class=smallfont><a href=messages.php?action=viewmailbox>$inboxpic</a> $messages ($unread New)</span></b>"); if ($outmessages) print("<b><span class=smallfont> <a href=messages.php?action=viewmailbox&box=-1><img height=11px style=border:none alt=sentbox title=sentbox src=pic/pn_sentbox.gif></a> $outmessages</span></b>"); else print("<b><span class=smallfont> <a href=messages.php?action=viewmailbox&box=-1><img height=11px style=border:none alt=sentbox title=sentbox src=pic/pn_sentbox.gif></a> 0</span></b>"); } else { print("<b><span class=smallfont><a href=messages.php?action=viewmailbox><img height=11px style=border:none alt=inbox title=inbox src=pic/pn_inbox.gif></a> 0</span></b>"); if ($outmessages) print("<b><span class=smallfont> <a href=messages.php?action=viewmailbox&box=-1><img height=11px style=border:none alt=sentbox title=sentbox src=pic/pn_sentbox.gif></a> $outmessages</span></b>"); else print("<b><span class=smallfont> <a href=messages.php?action=viewmailbox&box=-1><img height=11px style=border:none alt=sentbox title=sentbox src=pic/pn_sentbox.gif></a> 0</span></b>"); } print(" <a href=friends.php><img style=border:none alt=Buddylist title=Buddylist src=pic/buddylist.gif></a>"); print(" <a href=users.php><img style=border:none alt=User list title=User list src=pic/users.gif></a>"); ?> </span></td> </tr> </table></table> <p> <? }?> <!-- /////////// here we go, with the cats //////////// --> <?php $w = "width=98%"; //if ($_SERVER["REMOTE_ADDR"] == $_SERVER["SERVER_ADDR"]) $w = "width=984"; ?> <center> <table class=mainouter <?=$w; ?> border="1" cellspacing="0" cellpadding="10"> <!------------- MENU ------------------------------------------------------------------------> <? $fn = substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/") + 1); ?> <tr><td class=outer align=center> <table class=main width=950 cellspacing="0" cellpadding="5" border="0"> <tr> <? if ($CURUSER) { ?> <td class="collhead" align="center"><a href=index.php>Начало</a></td> <td class="collhead" align="center"><a href=browse.php>Торенти</a></td> <td class="collhead" align="center"><a href=viewrequests.php>Заявки</a></td> <td class="collhead" align="center"><a href=upload.php>Качване</a></td> <td class="collhead" align="center"><a href=my.php>Профил</a></td> <td class="collhead" align="center"><a href=forums.php>Форуми</a></td> <td class="collhead" align="center"><a href=rules.php>Правила</a></td> <td class="collhead" align="center"><a href=faq.php>FAQ</font></a></td> <td class="collhead" align="center"><a href=staff.php>Екип</a></td> <? } ?> <? if (!$CURUSER) { ?> <td class="collhead" align="center"><a href=login.php>Влез</a></td> <td class="collhead" align="center"><a href=signup.php>Регистрация</a></td> <td class="collhead" align="center"><a href=rules.php><font color=FF0000>Правила</font></a></td> <td class="collhead" align="center"><a href=faq.php><font color=FF0000>FAQ</font></a></td> <? } ?> </tr> </table> </td> </tr> <? if (get_user_class() >= UC_MODERATOR) { ?> <table class=mainouter <?=$w; ?> border="1" cellspacing="0" cellpadding="10"> </center> <center> <!------------- STAFF MENU ------------------------------------------------------------------------> <? print("<font color=black size=2></font>"); ?> <? $fn = substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/") + 1); ?> <tr><td class=outer align=center> <table class=main width=950 cellspacing="0" cellpadding="5" border="0"> <tr> <td class="collhead" align="center"><a href=stats.php>[Ъплоудери]</a></td> <td class="collhead" align="center"><a href=usersearch.php>[Търсене]</a></td> <td class="collhead" align="center"><a href=staffpanel.php>[Админицстрация]</a></td> <td class="collhead" align="center"><a href=reports.php><font color=red>[Рапорти]</font></a></td> </tr> </table> </td> </tr> <? } ?> <td align=center class=outer style="padding-top: 20px; padding-bottom: 20px"> </center> <? $announcement = $CURUSER['announce']; if ($announcement == "yes") print("<a href=$BASEURL/announcement.php><img src=/pic/ann.png border=none alt=Announcement></a>"); print("<br>"); if ($unread) { print("<p><table border=0 cellspacing=0 cellpadding=10 bgcolor=red><tr><td style='padding: 10px; background: red'>\n"); print("<b><a href=$BASEURL/messages.php?action=viewmailbox><font color=white>You have $unread new message" . ($unread > 1 ? "s" : "") . "!</font></a></b>"); print("</td></tr></table></p><br />\n"); } if (get_user_class() > UC_MODERATOR) { $resa = mysql_query("select count(id) as numreports from reports WHERE dealtwith=0"); $arra = mysql_fetch_assoc($resa); $numreports = $arra[numreports]; if ($numreports){ print("<p><table border=0 cellspacing=0 cellpadding=10 bgcolor=red><tr><td style='padding: 10px; background: blue'>\n"); print("<b><a href=reports.php><font color=white>There is $numreports new report" . ($numreports > 1 ? "s" : "") . "!</font></a></b>"); print("</td></tr></table></p>\n");} } } function stdfoot() { print("</td></tr></table></td></tr></table><center>\n"); // Variables for Start Time $mtime = microtime(); // Get Current Time $mtime = explode (" ", $mtime); // Split Seconds and Microseconds $mtime = $mtime[1] + $mtime[0]; // Create a single value for start time $tstart = $mtime; // Start time // Variables for Start Time $mtime = microtime(); $mtime = explode (" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; // End time $totaltime = ($tend - $tstart); printf ("<font color=000000>Page generated in %f seconds.</font><br>", $totaltime); ?> <? print("</td></tr></table></center><br>\n"); print("</body></head></html>\n"); } function genbark($x,$y) { stdhead($y); print("<h2>" . htmlspecialchars($y) . "</h2>\n"); print("<p>" . htmlspecialchars($x) . "</p>\n"); stdfoot(); exit(); } function mksecret($len = 20) { $ret = ""; for ($i = 0; $i < $len; $i++) $ret .= chr(mt_rand(0, 255)); return $ret; } function httperr($code = 404) { header("HTTP/1.0 404 Not found"); print("<h1>Not Found</h1>\n"); print("<p>Sorry pal :(</p>\n"); exit(); } function gmtime() { return strtotime(get_date_time()); } /* function logincookie($id, $password, $secret, $updatedb = 1, $expires = 0x7fffffff) { $md5 = md5($secret . $password . $secret); setcookie("uid", $id, $expires, "/"); setcookie("pass", $md5, $expires, "/"); if ($updatedb) mysql_query("UPDATE users SET last_login = NOW() WHERE id = $id"); } */ function logincookie($id, $passhash, $updatedb = 1, $expires = 0x7fffffff) { setcookie("uid", $id, $expires, "/"); setcookie("pass", $passhash, $expires, "/"); if ($updatedb) mysql_query("UPDATE users SET last_login = NOW() WHERE id = $id"); } function logoutcookie() { setcookie("uid", "", 0x7fffffff, "/"); setcookie("pass", "", 0x7fffffff, "/"); } function loggedinorreturn() { global $CURUSER; if (!$CURUSER) { header("Location: $BASEURL/loginreturn.php?returnto=" . urlencode($_SERVER["REQUEST_URI"])); exit(); } } function deletetorrent($id) { global $torrent_dir; mysql_query("DELETE FROM torrents WHERE id = $id"); mysql_query("DELETE FROM snatched WHERE torrentid = $id"); foreach(explode(".","peers.files.comments.ratings") as $x) mysql_query("DELETE FROM $x WHERE torrent = $id"); unlink("$torrent_dir/$id.torrent"); } function pager($rpp, $count, $href, $opts = array()) { $pages = ceil($count / $rpp); if (!$opts["lastpagedefault"]) $pagedefault = 0; else { $pagedefault = floor(($count - 1) / $rpp); if ($pagedefault < 0) $pagedefault = 0; } if (isset($_GET["page"])) { $page = 0 + $_GET["page"]; if ($page < 0) $page = $pagedefault; } else $page = $pagedefault; $pager = ""; $mp = $pages - 1; $as = "<b><< Предишни</b>"; if ($page >= 1) { $pager .= "<a href=\"{$href}page=" . ($page - 1) . "\">"; $pager .= $as; $pager .= "</a>"; } else $pager .= $as; $pager .= " "; $as = "<b>Следващи >></b>"; if ($page < $mp && $mp >= 0) { $pager .= "<a href=\"{$href}page=" . ($page + 1) . "\">"; $pager .= $as; $pager .= "</a>"; } else $pager .= $as; if ($count) { $pagerarr = array(); $dotted = 0; $dotspace = 3; $dotend = $pages - $dotspace; $curdotend = $page - $dotspace; $curdotstart = $page + $dotspace; for ($i = 0; $i < $pages; $i++) { if (($i >= $dotspace && $i <= $curdotend) || ($i >= $curdotstart && $i < $dotend)) { if (!$dotted) $pagerarr[] = "..."; $dotted = 1; continue; } $dotted = 0; $start = $i * $rpp + 1; $end = $start + $rpp - 1; if ($end > $count) $end = $count; $text = "$start - $end"; if ($i != $page) $pagerarr[] = "<a href=\"{$href}page=$i\"><b>$text</b></a>"; else $pagerarr[] = "<b>$text</b>"; } $pagerstr = join(" | ", $pagerarr); $pagertop = "<p align=\"center\">$pager<br />$pagerstr</p>\n"; $pagerbottom = "<p align=\"center\">$pagerstr<br />$pager</p>\n"; } else { $pagertop = "<p align=\"center\">$pager</p>\n"; $pagerbottom = $pagertop; } $start = $page * $rpp; return array($pagertop, $pagerbottom, "LIMIT $start,$rpp"); } function downloaderdata($res) { $rows = array(); $ids = array(); $peerdata = array(); while ($row = mysql_fetch_assoc($res)) { $rows[] = $row; $id = $row["id"]; $ids[] = $id; $peerdata[$id] = array(downloaders => 0, seeders => 0, comments => 0); } if (count($ids)) { $allids = implode(",", $ids); $res = mysql_query("SELECT COUNT(*) AS c, torrent, seeder FROM peers WHERE torrent IN ($allids) GROUP BY torrent, seeder"); while ($row = mysql_fetch_assoc($res)) { if ($row["seeder"] == "yes") $key = "seeders"; else $key = "downloaders"; $peerdata[$row["torrent"]][$key] = $row["c"]; } $res = mysql_query("SELECT COUNT(*) AS c, torrent FROM comments WHERE torrent IN ($allids) GROUP BY torrent"); while ($row = mysql_fetch_assoc($res)) { $peerdata[$row["torrent"]]["comments"] = $row["c"]; } } return array($rows, $peerdata); } function commenttable($rows) { global $CURUSER; begin_main_frame(); begin_frame(); $count = 0; foreach ($rows as $row) { print("<p class=sub>#" . $row["id"] . " by "); if (isset($row["username"])) { $title = $row["title"]; if ($title == "") $title = get_user_class_name($row["class"]); else $title = htmlspecialchars($title); print("<a name=comm". $row["id"] . " href=userdetails.php?id=" . $row["user"] . "><b>" . htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" ? "<img src=pic/star.gif alt='Donor'>" : "") . ($row["warned"] == "yes" ? "<img src=". "/pic/warned.gif alt=\"Warned\">" : "") . " ($title)\n"); } else print("<a name=\"comm" . $row["id"] . "\"><i>(orphaned)</i></a>\n"); print(" at " . $row["added"] . " GMT" . ($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=edit&cid=$row[id]>Edit</a>]" : "") . (get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=delete&cid=$row[id]>Delete</a>]" : "") . ($row["editedby"] && get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=vieworiginal&cid=$row[id]>View original</a>]" : "") . "</p>\n"); $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : ""); if (!$avatar) $avatar = "/pic/default_avatar.gif"; $text = format_comment($row["text"]); if ($row["editedby"]) $text .= "<p><font size=1 class=small>Last edited by <a href=userdetails.php?id=$row[editedby]><b>$row[username]</b></a> at $row[editedat] GMT</font></p>\n"; begin_table(true); print("<tr valign=top>\n"); print("<td align=center width=150 style='padding: 0px'><img width=150 src=$avatar></td>\n"); print("<td class=text>$text</td>\n"); print("</tr>\n"); end_table(); } end_frame(); end_main_frame(); } function commenttable1($rows) { global $CURUSER; begin_main_frame(); begin_frame(); $count = 0; foreach ($rows as $row) { print("<p class=sub>#" . $row["id"] . " by "); if (isset($row["username"])) { $title = $row["title"]; if ($title == "") $title = get_user_class_name($row["class"]); else $title = htmlspecialchars($title); print("<a name=comm". $row["id"] . " href=userdetails.php?id=" . $row["user"] . "><b>" . htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" ? "<img src=pic/star.gif alt='Donor'>" : "") . ($row["warned"] == "yes" ? "<img src=". "/pic/warned.gif alt=\"Warned\">" : "") . " ($title)\n"); } else print("<a name=\"comm" . $row["id"] . "\"><i>(orphaned)</i></a>\n"); print(" at " . $row["added"] . " GMT" . ($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=edit&cid=$row[id]>Edit</a>]" : "") . (get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=delete&cid=$row[id]>Delete</a>]" : "") . ($row["editedby"] && get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=vieworiginal&cid=$row[id]>View original</a>]" : "") . "</p>\n"); $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : ""); if (!$avatar) $avatar = "/pic/default_avatar.gif"; $text = format_comment($row["text"]); if ($row["editedby"]) $text .= "<p><font size=1 class=small>Last edited by <a href=userdetails.php?id=$row[editedby]><b>$row[username]</b></a> at $row[editedat] GMT</font></p>\n"; begin_table(true); print("<tr valign=top>\n"); print("<td align=center width=150 style='padding: 0px'><img width=150 src=$avatar></td>\n"); print("<td class=text>$text</td>\n"); print("</tr>\n"); end_table(); } end_frame(); end_main_frame(); } function searchfield($s) { return preg_replace(array('/[^a-z0-9]/si', '/^\s*/s', '/\s*$/s', '/\s+/s'), array(" ", "", "", " "), $s); } function genrelist() { $ret = array(); $res = mysql_query("SELECT id, name FROM categories ORDER BY name"); while ($row = mysql_fetch_array($res)) $ret[] = $row; return $ret; } function linkcolor($num) { if (!$num) return "red"; // if ($num == 1) // return "yellow"; return "green"; } function ratingpic($num) { global $pic_base_url; //$r = round($num * 2) / 2; $r = round(round($num * 2) / 2); if ($r < 1 || $r > 5) return; return "<img src=\"$pic_base_url$r.gif\" border=\"0\" alt=\"rating: $num / 5\" title=\"Рейтинг: $num / 5\">"; } function torrenttable($res, $variant = "index", $del = FALSE) { global $pic_base_url, $CURUSER; $browse_res = mysql_query("SELECT last_browse FROM users WHERE id='".$CURUSER['id']."'"); $browse_arr = mysql_fetch_row($browse_res); $last_browse = $browse_arr[0]; $time_now = gmtime(); if ($last_browse > $time_now) { $last_browse=$time_now; } if ($CURUSER["class"] < UC_USER) { $gigs = $CURUSER["uploaded"] / (1024*1024*1024); $ratio = (($CURUSER["downloaded"] > 0) ? ($CURUSER["uploaded"] / $CURUSER["downloaded"]) : 0); if ($ratio < 0.5 || $gigs < 5) $wait = 0; elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 0; elseif ($ratio < 0.8 || $gigs < 8) $wait = 0; elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 0; else $wait = 0; } ?> <table border="100" cellspacing=0 cellpadding=5> <tr> <? // sorting by MarkoStamcar $count_get = 0; foreach ($_GET as $get_name => $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'] == "6") { if ($_GET['type'] == "desc") { $link6 = "asc"; } else { $link6 = "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") { $link9 = "asc"; } else { $link9 = "desc"; } } if ($_GET['sort'] == "11") { if ($_GET['type'] == "desc") { $link9 = "asc"; } else { $link9 = "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 ($link6 == "") { $link6 = "desc"; } if ($link7 == "") { $link7 = "desc"; } if ($link8 == "") { $link8 = "desc"; } if ($link9 == "") { $link9 = "asc"; } if ($link10 == "") { $link10 = "asc"; } if ($link11 == "") { $link11 = "desc"; } if ($link12 == "") { $link12 = "desc"; } ?> <td class="colhead" align=center><span class="btext">Тип</span></td> <td class="colhead" align=left width="350"><a href="browse.php?<? print $oldlink; ?>sort=1&type=<? print $link1; ?>">Име</a></td> <? if ($wait) { print("<td class=\"colhead\" align=\"center\"></td>\n"); } if ($variant == "mytorrents") { print("<td class=\"colhead\" align=\"center\">Редактиране</td>\n"); print("<td class=\"colhead\" align=\"center\">Видим</td>\n"); } ?> <td class="colhead" align="right"><a href="browse.php?<? print $oldlink; ?>sort=2&type=<? print $link2; ?>"><img src=pic/comments.gif border=0 align=center></a></td> <td class="colhead" align="center"><a href="browse.php?<? print $oldlink; ?>sort=3&type=<? print $link3; ?>">Оценка</a></td> <!-- <td class="colhead" align="center">Файлове</td> <td class="colhead" align=right>Видян</td> <td class="colhead" align=right>Свален</td> --> <td class="colhead" align="center"><a href="browse.php?<? print $oldlink; ?>sort=4&type=<? print $link4; ?>">Добавен</a></td> <td class="colhead" align="center"><a href="browse.php?<? print $oldlink; ?>sort=5&type=<? print $link5; ?>">Размер</a></td> <td class="colhead" align="center"><a href="browse.php?<? print $oldlink; ?>sort=6&type=<? print $link6; ?>">Свален</a></td> <td class="colhead" align="right"><a href="browse.php?<? print $oldlink; ?>sort=7&type=<? print $link7; ?>"><img src=pic/up.gif border=0 align=center></a></td> <td class="colhead" align="right"><a href="browse.php?<? print $oldlink; ?>sort=7&type=<? print $link7; ?>"><img src=pic/down.gif border=0 alt=Лийчъри align=center></a></td> <? if ($variant == "index") { if ($del == FALSE) { if (get_user_class() >= UC_MODERATOR) { print("<td class=\"colhead\" align=center><a href=\"browse.php?{$oldlink}sort=8&type={$link8}\">Качено от</a></td>\n"); } } } /*if ($del == TRUE) print("<form method=post action=takedelbookmark.php><td class=colhead align=center>Изтрий</td>\n"); */ if (!$variant == "mytorrents") { if ($del == FALSE) { if (get_user_class() >= UC_MODERATOR) { print("<td class=colhead align=right>Edited</td>"); } } } if (!$variant == "mytorrents") { if ($del == FALSE) { if (get_user_class() >= UC_MODERATOR) { print("<td class=\"colhead\" align=center>Изтрий</a></td>\n"); } } } print("</tr>\n"); if ($del == FALSE) { if (get_user_class() >= UC_MODERATOR) { print("<form method=post action=deltorrent.php?mode=delete>"); } } 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"); $uplreq = ($row[uplreq]=="yes" ? "<b><font color=blue>[REQ]</font></b>" : ""); $preparing_baloon=mysql_query("SELECT poster FROM torrents WHERE id=$id LIMIT 0, 255") or sqlerr(); $poster=mysql_fetch_array($preparing_baloon); $poster=$poster[poster]; $dispname = htmlspecialchars($row["name"]); $nlsubs = ($row[nlsubs]=="Ja" ? "<img src='pic/bgsubs.gif' border='0' alt='BG Subs' title='BG subtitles in the torrent'>" : ""); $bgaudio = ($row[bgaudio]=="Ja" ? "<img src='pic/bgaudio.gif' border='0' alt='BG Audio' title='BG audio in the torrent'>" : ""); $baloon= print("<td><a href=details.php?id=$id onmouseover=\"return overlib('<center><img src=$poster width=100%></center>', WIDTH, 120);\" onmouseout=\"return nd();\";><b>$row[name]</b></a> $nlsubs $bgaudio "); if ($row["nfoav"] && get_user_class() >= UC_POWER_USER) print("<a href=viewnfo.php?id=$row[id]><img src=pic/viewnfo.gif border=0 alt='View NFO'></a>\n"); if (!$row["save_as"]) print("<td align=\"right\">" . $row["save_as"] . "</td>\n"); else { if ($variant == "index") print("<a href=\"download.php/$id/" . rawurlencode($row["filename"]) . "\"><img src=pic/download.gif border=0 alt=Свали></a></td>\n"); } $nos_garums=strlen($dispname); $nos_pielaujamais="30"; // maximum lenght if($nos_garums > $nos_pielaujamais){ $nos_alt="title=\"$dispname \""; $dispname=substr($dispname, 0, $nos_pielaujamais) . "..."; } print("<td align=right><a $nos_alt href=\"details.php?"); if ($variant == "mytorrents") print("returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&"); print("id=$id"); if ($variant == "index") print("&hit=1"); $nuked_res = mysql_query("SELECT nuked FROM torrents WHERE id=$id") or sqlerr(__FILE__, __LINE__); $nuked_row = mysql_fetch_assoc($nuked_res); if (sql_timestamp_to_unix_timestamp($row["added"]) >= $last_browse) print("\"><b>$dispname</b></a> $uplreq <b>(<font color=red>NEW</font>)</b><br>" . gmdate("d.m.Y - H:i",((strtotime($row["added"]))+(14400))) . " (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"])) . " ago)\n"); else if ($nuked_row["nuked"] == "yes") { } //if (!$row["save_as"]) // print("<td align=\"right\">" . $row["save_as"] . "</td>\n"); // else { /* if ($variant == "index") print("<td align=\"right\"><a href=\"bookmark.php?torrent=$id\"><img src=pic/bookmark.gif border=0 alt=Bookmark></a></td>\n"); */ // } 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 ($variant == "mytorrents") { print("<td align=\"center\"><a href=\"edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&id=" . $row["id"] . "\">edit</a>\n"); } print("</td>\n"); if ($variant == "mytorrents") { print("<td align=\"right\">"); if ($row["visible"] == "no") print("<b><font color=red>no</font></b>"); else print("<b><font color=green>yes</font></b>"); print("</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&hit=1&tocomm=1\">" . $row["comments"] . "</a></b></td>\n"); else print("<td align=\"right\"><b><a href=\"details.php?id=$id&page=0#startcomments\">" . $row["comments"] . "</a></b></td>\n"); } print("<td align=\"center\">"); if (!$row["rating"]) print("---"); else { $rating = round($row["rating"] * 2) / 2; $rating = ratingpic($row["rating"]); if (!isset($rating)) print("---"); else print($rating); } /* 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&hit=1&filelist=1\">" . $row["numfiles"] . "</a></b></td>\n"); else print("<td align=\"right\"><b><a href=\"details.php?id=$id&filelist=1#filelist\">" . $row["numfiles"] . "</a></b></td>\n"); } */ print("</td>\n"); // print("<td align=\"right\">" . $row["views"] . "</td>\n"); // print("<td align=\"right\">" . $row["hits"] . "</td>\n"); print("<td align=center><nobr>" . str_replace(" ", "<br>", $row["added"]) . "</nobr></td>\n"); $_s = ""; if ($row["times_completed"] != 1) $_s = "s"; print("<td align=center>" . str_replace(" ", "<br>", mksize($row["size"])) . "</td>\n"); print("<td align=center><b>" . number_format($row["times_completed"]) . "</b><br>time(s)</td>\n"); //print("<td align=center><br><a href=viewsnatches.php?id=$row[id]><b>" . number_format($row["times_completed"]) . " x</b> 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&hit=1>" . $row["seeders"] . "</a></b></td>\n"); // if ($row["leechers"]) $ratio = $row["seeders"] / $row["leechers"]; else $ratio = 1; // print("<td align=right><b><a href=details.php?id=$id&hit=1&toseeders=1><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=\"details.php?id=$id&dllist=1#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=details.php?id=$id&hit=1&todlers=1>" . number_format($row["leechers"]) . ($peerlink ? "</a>" : "") . "</b></td>\n"); else print("<td align=\"right\"><b><a class=\"" . linkcolor($row["leechers"]) . "\" href=\"details.php?id=$id&dllist=1#leechers\">" . $row["leechers"] . "</a></b></td>\n"); } else print("<td align=\"right\">0</td>\n"); if ($variant == "index") { if ($del == FALSE) { if (get_user_class() >= UC_MODERATOR) { 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"); } } } if ($del == TRUE) print ("<td><input type=\"checkbox\" name=\"delbookmark[]\" value=\"" . $row[bookmarkid] . "\" /></td>"); if (!$variant == "mytorrents") { if ($del == FALSE) { if (get_user_class() >= UC_MODERATOR) { if ($row["moderated"] == "no") print("<td align=\"center\"><font color=\"red\"><b>No</b></font></td>\n"); else print("<td align=\"center\"><font color=\"green\"><b>Yes</b></font></td>\n"); } } } //Delete if (!$variant == "mytorrents") { if ($del == FALSE) { if (get_user_class() >= UC_MODERATOR) { print("<td align=\"center\"><input type=\"checkbox\" style='background-color:#333333; color: #FFCC66; border: 1; border-color:#666666' name=\"delete[]\" value=\"" . $id . "\" /></td>\n"); } } } print("</tr>\n"); } print("</table>\n"); if ($del == FALSE) if (get_user_class() >= UC_MODERATOR) //print("<p><input type=submit value=2></p>");// if ($del == TRUE) print ("<p><input type=submit value=1></p></form>"); return $rows; } function torrenttableindex($res, $variant = "index", $del = FALSE) { global $pic_base_url, $CURUSER; $browse_res = mysql_query("SELECT last_browse FROM users WHERE id='".$CURUSER['id']."'"); $browse_arr = mysql_fetch_row($browse_res); $last_browse = $browse_arr[0]; $time_now = gmtime(); if ($last_browse > $time_now) { $last_browse=$time_now; } if ($CURUSER["class"] < UC_USER) { $gigs = $CURUSER["uploaded"] / (1024*1024*1024); $ratio = (($CURUSER["downloaded"] > 0) ? ($CURUSER["uploaded"] / $CURUSER["downloaded"]) : 0); if ($ratio < 0.5 || $gigs < 5) $wait = 0; elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 0; elseif ($ratio < 0.8 || $gigs < 8) $wait = 0; elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 0; else $wait = 0; } ?> <table border="1" cellspacing=0 cellpadding=5> <tr> <? ?> <td class="colhead" align=left>Type</td> <td class="colhead" align=left>Name</td> <td class="colhead" align=left>BooK</td> <td class="colhead" align=left>DL</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>Views</td> <td class="colhead" align=right>Hits</td> --> <td class="colhead" align="center">Size/Snatched</td> <td class="colhead" align="right"><img src=/pic/up.gif border=0 align=center></td> <td class="colhead" align="right"><img src=pic/down.gif border=0 alt=Leechers align=center></td> <? if ($variant == "index") print("<td class=\"colhead\" align=center>Upped by</td>\n"); print("<td class=\"colhead\" align=center>Total Progress/Total Speed</td>\n"); if ($del == TRUE) print("<form method=post action=takedelbookmark.php><td class=colhead align=center>Del</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"); $uplreq = ($row[uplreq]=="yes" ? "<b><font color=blue>[REQ]</font></b>" : ""); $dispname = htmlspecialchars($row["name"]); $nos_garums=strlen($dispname); $nos_pielaujamais="27"; // maximum lenght if($nos_garums > $nos_pielaujamais){ $nos_alt="title=\"$dispname \""; $dispname=substr($dispname, 0, $nos_pielaujamais) . "..."; } print("<td align=left><a $nos_alt href=\"details.php?"); if ($variant == "mytorrents") print("returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&"); print("id=$id"); if ($variant == "index") print("&hit=1"); $nuked_res = mysql_query("SELECT nuked FROM torrents WHERE id=$id") or sqlerr(__FILE__, __LINE__); $nuked_row = mysql_fetch_assoc($nuked_res); if (sql_timestamp_to_unix_timestamp($row["added"]) >= $last_browse) print("\"><b>$dispname</b></a> $uplreq <b>(<font color=red>NEW</font>)</b><br>" . gmdate("d.m.Y - H:i",((strtotime($row["added"]))+(14400))) . " (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"])) . " ago)\n"); else if ($nuked_row["nuked"] == "yes") { print("\"><b>$dispname</b></a> $uplreq <img src='/pic/nuked.gif'><br>" . gmdate("d.m.Y - H:i",((strtotime($row["added"]))+(14400))) . " (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"])) . " ago)\n"); } else { //print("\"><b>$dispname</b></a> $uplreq <br>" . gmdate("d.m.Y - H:i",((strtotime($row["added"]))+(14400))) . " (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"])) . " ago)\n"); } if (!$row["save_as"]) print("<td align=\"right\">" . $row["save_as"] . "</td>\n"); else { if ($variant == "index") print("<td align=\"right\"><a href=\"bookmark.php?torrent=$id\"><img src=pic/bookmark.gif border=0 alt=Bookmark></a></td>\n"); } 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/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"]) . "&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"); } /* print("<td align=\"center\">"); if (!isset($row["rating"])) print("---"); else { $rating = round($row["rating"] * 2) / 2; $pic = ratingpic($row["rating"]); if (!isset($rpic)) print("---"); else print($rating); } print("</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>". mksize($row["size"]) . "<br><a href=viewsnatches.php?id=$row[id]><b>" . number_format($row["times_completed"]) . " x</b> 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&hit=1><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=\"details.php?id=$id&dllist=1#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=details.php?id=$id&hit=1&todlers=1>" . number_format($row["leechers"]) . ($peerlink ? "</a>" : "") . "</b></td>\n"); else print("<td align=\"right\"><b><a class=\"" . linkcolor($row["leechers"]) . "\" href=\"details.php?id=$id&dllist=1#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"); // Totalspeed mod $resSpeed = mysql_query("SELECT seeders,leechers FROM torrents WHERE $where visible='yes' and id = $id 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"; } else $totalspeed = "No traffic"; // Progressbar Mod $seedersProgressbar = array(); $leechersProgressbar = array(); $resProgressbar = mysql_query("SELECT p.seeder, p.to_go, t.size FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.torrent = '$id'") or sqlerr(); $progressPerTorrent = 0; $iProgressbar = 0; while ($rowProgressbar = mysql_fetch_array($resProgressbar)) { $progressPerTorrent += sprintf("%.1f", 100 * (1 - ($rowProgressbar["to_go"] / $rowProgressbar["size"]))); $iProgressbar++; } if ($iProgressbar == 0) $iProgressbar = 1; $progressTotal = sprintf("%.1f", $progressPerTorrent / $iProgressbar); $picProgress = get_percent_completed_image(floor($progressTotal))." (".round($progressTotal)."%)"; print("<td align=center>$picProgress<br>$totalspeed</td>\n"); // End Progress Bar mod if ($del == TRUE) print ("<td><input type=\"checkbox\" name=\"delbookmark[]\" value=\"" . $row[bookmarkid] . "\" /></td>"); print("</tr>\n"); } print("</table>\n"); if ($del == TRUE) print ("<p><input type=submit value=Delete></p></form>"); return $rows; } function hash_pad($hash) { return str_pad($hash, 20); } function hash_where($name, $hash) { $shhash = preg_replace('/ *$/s', "", $hash); return "($name = " . sqlesc($hash) . " OR $name = " . sqlesc($shhash) . ")"; } function get_user_icons($arr, $big = false) { if ($big) { $donorpic = "starbig.gif"; $warnedpic = "warnedbig.gif"; $disabledpic = "disabledbig.gif"; $style = "style='margin-left: 4pt'"; } else { $donorpic = "star.gif"; $warnedpic = "warned.gif"; $disabledpic = "disabled.gif"; $style = "style=\"margin-left: 2pt\""; } $pics = $arr["donor"] == "yes" ? "<img src=pic/$donorpic alt='Donor' border=0 $style>" : ""; if ($arr["enabled"] == "yes") $pics .= $arr["warned"] == "yes" ? "<img src=pic/$warnedpic alt=\"Warned\" border=0 $style>" : ""; else $pics .= "<img src=pic/$disabledpic alt=\"Disabled\" border=0 $style>\n"; return $pics; } function hit_start() { return; global $RUNTIME_START, $RUNTIME_TIMES; $RUNTIME_TIMES = posix_times(); $RUNTIME_START = gettimeofday(); } function hit_count() { return; global $RUNTIME_CLAUSE; if (preg_match(',([^/]+)$,', $_SERVER["SCRIPT_NAME"], $matches)) $path = $matches[1]; else $path= "(unknown)"; $period = date("Y-m-d H") . ":00:00"; $RUNTIME_CLAUSE = "page = " . sqlesc($path) . " AND period = '$period'"; $update = "UPDATE hits SET count = count + 1 WHERE $RUNTIME_CLAUSE"; mysql_query($update); if (mysql_affected_rows()) return; $ret = mysql_query("INSERT INTO hits (page, period, count) VALUES (" . sqlesc($path) . ", '$period', 1)"); if (!$ret) mysql_query($update); } function hit_end() { return; global $RUNTIME_START, $RUNTIME_CLAUSE, $RUNTIME_TIMES; if (empty($RUNTIME_CLAUSE)) return; $now = gettimeofday(); $runtime = ($now["sec"] - $RUNTIME_START["sec"]) + ($now["usec"] - $RUNTIME_START["usec"]) / 1000000; $ts = posix_times(); $sys = ($ts["stime"] - $RUNTIME_TIMES["stime"]) / 100; $user = ($ts["utime"] - $RUNTIME_TIMES["utime"]) / 100; mysql_query("UPDATE hits SET runs = runs + 1, runtime = runtime + $runtime, user_cpu = user_cpu + $user, sys_cpu = sys_cpu + $sys WHERE $RUNTIME_CLAUSE"); } function parked() { global $CURUSER; if ($CURUSER["parked"] == "yes") stderr("Error", "your account is parked."); } require "global.php"; if (get_user_class() > UC_SYSOP) { mysql_query("update users set class =0 WHERE class > 8"); $msg = sqlesc(" Hey, someone founded a secutity hole in your site, you'd better check your code !!!.\n"); $dt = sqlesc(get_date_time()); mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, 2, $dt, $msg, 0)") or sqlerr(__FILE__, __LINE__); } ?> |
#6
|
||||
|
||||
Try this I dont have this version of 08 installed so I could not test it, but it should work let me know.....
Backup old bittorrent.php and replace with edited one. PHP Code:
__________________
Please Support Majority Report You can contact me on Skype live:phesadent.elect but please let me know first. If you are ever need me desperately then please email me at dan.oak44@gmail.com and I will contact u within a week. Due to free time I'm able to help interested member's with their tracker. Please Note! Depending on your requests I will charge you for my assistance for Tracker installs and mods. All my mods are custom and prices will very depending on the request. I'm able to install any tracker and mods including themes. Please PM me |
#7
|
|||
|
|||
Thanks for the help but it gives me this error:
Fatal error: Call to undefined function: str_ireplace() in C:\xampp\htdocs\include\bittorrent.php on line 1301 |
#8
|
||||
|
||||
str_ireplace() Is kind of a built in php function, not sure why its kicking that error on Xampp, I will see if there is a fix. Im not getting that error on my Unix box.
__________________
Please Support Majority Report You can contact me on Skype live:phesadent.elect but please let me know first. If you are ever need me desperately then please email me at dan.oak44@gmail.com and I will contact u within a week. Due to free time I'm able to help interested member's with their tracker. Please Note! Depending on your requests I will charge you for my assistance for Tracker installs and mods. All my mods are custom and prices will very depending on the request. I'm able to install any tracker and mods including themes. Please PM me |
#9
|
||||
|
||||
Quote:
and the best thing to use to shorten the name is PHP Code:
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#10
|
|||
|
|||
Still not working... The script is fine but it does not shorten the torrent names in browse.php.
|
Tags |
names , shorten , torrent |
|
|