firefly007 |
16th June 2013 18:47 |
Quote:
Originally Posted by las7h0p3
(Post 40962)
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...
|
You could do this.. If I understand you correctly
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);
Some where after this
PHP Code:
$res = mysql_query("SELECT torrents.seeders, torrents.smalld, torrents.banned, torrents.bgsubs, torrents.url, torrents.bgaudio, torrents.free, torrents.genre, torrents.genre1, torrents.genre2, torrents.leechers, torrents.poster, torrents.recommended, torrents.imdb_poster, torrents.nzb_link, torrents.info_hash, torrents.filename, LENGTH(torrents.nfo) AS nfosz, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(torrents.last_action) AS lastseed, torrents.numratings, torrents.name, IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.poster, torrents.pretime, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, categories.name AS cat_name, users.username FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id") or sqlerr(); $row = mysql_fetch_assoc($res);
$owned = $moderator = 0; if (get_user_class() >= UC_MODERATOR) $owned = $moderator = 1; elseif ($CURUSER["id"] == $row["owner"]) $owned = 1;
Then replace
this
PHP Code:
tr("Name", "<b>$s</b>", 1);
with
PHP Code:
tr("Name", "<b>$name_clean</b>", 1);
|