Hello mates!
After some fiddling around with the torrent-details.php and nfo-view.php i have made an nice (i think so atleast) mod that lets you show the .NFO file in a lightbox window, this mod requires that you already have [url="
http://www.torrenttrader.org/index.php?showtopic=9731"]this mod[/url] installed and working. Also visit [url="
http://orangoo.com/labs/GreyBox/Download/"]this[/url] page and download the latest graybox, just overwrite the old files and your ready to go.
First open torrent-details.php and find and remove:
//DISPLAY NFO BLOCK
function my_nfo_translate($nfo){
$trans = array(
"\x80" => "Ç", "\x81" => "ü", "\x82" => "é", "\x83" => "â", "\x84" => "ä", "\x85" => "à", "\x86" => "å", "\x87" => "ç", "\x88" => "ê", "\x89" => "ë", "\x8a" => "è", "\x8b" => "ï", "\x8c" => "î", "\x8d" => "ì", "\x8e" => "Ä", "\x8f" => "Å", "\x90" => "É",
"\x91" => "æ", "\x92" => "Æ", "\x93" => "ô", "\x94" => "ö", "\x95" => "ò", "\x96" => "û", "\x97" => "ù", "\x98" => "ÿ", "\x99" => "Ö", "\x9a" => "Ü", "\x9b" => "¢", "\x9c" => "£", "\x9d" => "¥", "\x9e" => "?", "\x9f" => "ƒ", "\xa0" => "á", "\xa1" => "í",
"\xa2" => "ó", "\xa3" => "ú", "\xa4" => "ñ", "\xa5" => "Ñ", "\xa6" => "ª", "\xa7" => "º", "\xa8" => "¿", "\xa9" => "?", "\xaa" => "¬", "\xab" => "½", "\xac" => "¼", "\xad" => "¡", "\xae" => "«", "\xaf" => "»", "\xb0" => "?", "\xb1" => "?", "\xb2" => "?",
"\xb3" => "?", "\xb4" => "?", "\xb5" => "?", "\xb6" => "?", "\xb7" => "?", "\xb8" => "?", "\xb9" => "?", "\xba" => "?", "\xbb" => "?", "\xbc" => "?", "\xbd" => "?", "\xbe" => "?", "\xbf" => "?", "\xc0" => "?", "\xc1" => "?", "\xc2" => "?", "\xc3" => "?",
"\xc4" => "?", "\xc5" => "?", "\xc6" => "?", "\xc7" => "?", "\xc8" => "?", "\xc9" => "?", "\xca" => "?", "\xcb" => "?", "\xcc" => "?", "\xcd" => "?", "\xce" => "?", "\xcf" => "?", "\xd0" => "?", "\xd1" => "?", "\xd2" => "?", "\xd3" => "?", "\xd4" => "?",
"\xd5" => "?", "\xd6" => "?", "\xd7" => "?", "\xd8" => "?", "\xd9" => "?", "\xda" => "?", "\xdb" => "?", "\xdc" => "?", "\xdd" => "?", "\xde" => "?", "\xdf" => "?", "\xe0" => "?", "\xe1" => "ß", "\xe2" => "?", "\xe3" => "?", "\xe4" => "?", "\xe5" => "?",
"\xe6" => "µ", "\xe7" => "?", "\xe8" => "?", "\xe9" => "?", "\xea" => "?", "\xeb" => "?", "\xec" => "?", "\xed" => "?", "\xee" => "?", "\xef" => "?", "\xf0" => "?", "\xf1" => "±", "\xf2" => "?", "\xf3" => "?", "\xf4" => "?", "\xf5" => "?", "\xf6" => "÷",
"\xf7" => "?", "\xf8" => "°", "\xf9" => "?", "\xfa" => "·", "\xfb" => "?", "\xfc" => "?", "\xfd" => "²", "\xfe" => "?", "\xff" => " ",
);
$trans2 = array("\xe4" => "ä", "\xF6" => "ö", "\xFC" => "ü", "\xC4" => "Ä", "\xD6" => "Ö", "\xDC" => "Ü", "\xDF" => "ß");
$all_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$last_was_ascii = False;
$tmp = "";
$nfo = $nfo . "\00";
for ($i = 0; $i < (strlen($nfo) - 1); $i++)
{
$char = $nfo[$i];
if (isset($trans2[$char]) and ($last_was_ascii or strpos($all_chars, ($nfo[$i + 1]))))
{
$tmp = $tmp . $trans2[$char];
$last_was_ascii = True;
}
else
{
if (isset($trans[$char]))
{
$tmp = $tmp . $trans[$char];
}
else
{
$tmp = $tmp . $char;
}
$last_was_ascii = strpos($all_chars, $char);
}
}
return $tmp;
}
//-----------------------------------------------
//DISPLAY NFO BLOCK
if($row["nfo"]== "yes"){
$nfofilelocation = "$nfo_dir/$row[id].nfo";
$filegetcontents = file_get_contents($nfofilelocation);
$nfo = htmlspecialchars($filegetcontents);
if ($nfo) {
$nfo = my_nfo_translate($nfo);
echo "<BR><BR><B>NFO:</B><BR>";
begin_table();
print("<tr><td>\n");
print("<textarea style=\"font-size:8pt;width:100%;height:100%;\" wrap=\"off\" rows=20 and cols=20 READONLY>".stripslashes($nfo)."</textarea>");
end_table();
}else{
print("Error reading .nfo file!");
}
}
end_frame();
Then insert this line where you want the link to show:
print("<tr><td align=left><b>NFO:</b></td><td align=left><a href=".$site_config["SITEURL"]."/nfo-view.php?id=$id rel='gb_page_center[670, 800]' title=" . $shortname . ">View .NFO</a></td></tr>\n");
Then open nfo-view.php and replace the entire file with:
<?
//
// TorrentTrader v2.x
// This file was last updated: 25/June/2007
//
// http://www.torrenttrader.org
//
//
require_once("backend/functions.php");
dbconn();
$site_config["LEFTNAV"] = $site_config["MIDDLENAV"] = $site_config["RIGHTNAV"] = false;
// check access and rights
if ($site_config["MEMBERSONLY"]){
loggedinonly();
if($CURUSER["view_torrents"]=="no")
show_error_msg("Error","You do not have permission to view nfo's",1);
}
function my_nfo_translate($nfo)
{
$trans = array(
"\x80" => "Ç", "\x81" => "ü", "\x82" => "é", "\x83" => "â", "\x84" => "ä", "\x85" => "à", "\x86" => "å", "\x87" => "ç", "\x88" => "ê", "\x89" => "ë", "\x8a" => "è", "\x8b" => "ï", "\x8c" => "î", "\x8d" => "ì", "\x8e" => "Ä", "\x8f" => "Å", "\x90" => "É",
"\x91" => "æ", "\x92" => "Æ", "\x93" => "ô", "\x94" => "ö", "\x95" => "ò", "\x96" => "û", "\x97" => "ù", "\x98" => "ÿ", "\x99" => "Ö", "\x9a" => "Ü", "\x9b" => "¢", "\x9c" => "£", "\x9d" => "¥", "\x9e" => "?", "\x9f" => "ƒ", "\xa0" => "á", "\xa1" => "í",
"\xa2" => "ó", "\xa3" => "ú", "\xa4" => "ñ", "\xa5" => "Ñ", "\xa6" => "ª", "\xa7" => "º", "\xa8" => "¿", "\xa9" => "?", "\xaa" => "¬", "\xab" => "½", "\xac" => "¼", "\xad" => "¡", "\xae" => "«", "\xaf" => "»", "\xb0" => "?", "\xb1" => "?", "\xb2" => "?",
"\xb3" => "?", "\xb4" => "?", "\xb5" => "?", "\xb6" => "?", "\xb7" => "?", "\xb8" => "?", "\xb9" => "?", "\xba" => "?", "\xbb" => "?", "\xbc" => "?", "\xbd" => "?", "\xbe" => "?", "\xbf" => "?", "\xc0" => "?", "\xc1" => "?", "\xc2" => "?", "\xc3" => "?",
"\xc4" => "?", "\xc5" => "?", "\xc6" => "?", "\xc7" => "?", "\xc8" => "?", "\xc9" => "?", "\xca" => "?", "\xcb" => "?", "\xcc" => "?", "\xcd" => "?", "\xce" => "?", "\xcf" => "?", "\xd0" => "?", "\xd1" => "?", "\xd2" => "?", "\xd3" => "?", "\xd4" => "?",
"\xd5" => "?", "\xd6" => "?", "\xd7" => "?", "\xd8" => "?", "\xd9" => "?", "\xda" => "?", "\xdb" => "?", "\xdc" => "?", "\xdd" => "?", "\xde" => "?", "\xdf" => "?", "\xe0" => "?", "\xe1" => "ß", "\xe2" => "?", "\xe3" => "?", "\xe4" => "?", "\xe5" => "?",
"\xe6" => "µ", "\xe7" => "?", "\xe8" => "?", "\xe9" => "?", "\xea" => "?", "\xeb" => "?", "\xec" => "?", "\xed" => "?", "\xee" => "?", "\xef" => "?", "\xf0" => "?", "\xf1" => "±", "\xf2" => "?", "\xf3" => "?", "\xf4" => "?", "\xf5" => "?", "\xf6" => "÷",
"\xf7" => "?", "\xf8" => "°", "\xf9" => "?", "\xfa" => "·", "\xfb" => "?", "\xfc" => "?", "\xfd" => "²", "\xfe" => "?", "\xff" => " ",
);
$trans2 = array("\xe4" => "ä", "\xF6" => "ö", "\xFC" => "ü", "\xC4" => "Ä", "\xD6" => "Ö", "\xDC" => "Ü", "\xDF" => "ß");
$all_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$last_was_ascii = False;
$tmp = "";
$nfo = $nfo . "\00";
for ($i = 0; $i < (strlen($nfo) - 1); $i++)
{
$char = $nfo[$i];
if (isset($trans2[$char]) and ($last_was_ascii or strpos($all_chars, ($nfo[$i + 1]))))
{
$tmp = $tmp . $trans2[$char];
$last_was_ascii = True;
}
else
{
if (isset($trans[$char]))
{
$tmp = $tmp . $trans[$char];
}
else
{
$tmp = $tmp . $char;
}
$last_was_ascii = strpos($all_chars, $char);
}
}
return $tmp;
}//end nfo func
$id = (int)$_GET["id"];
if (!$id)
show_error_msg("ID not found", "You can't view, if you don't tell me what you want!",1);
//stdhead("View NFO");
$query = mysql_query("SELECT name, nfo FROM torrents WHERE id=$id") or sqlerr();
$res = mysql_fetch_assoc($query);
if ($res["nfo"] != "yes")
show_error_msg("Not Found", "This torrent does not have a NFO");
if($res["nfo"] == "yes"){
$char1 = 55; //cut length (cutname func is in header.php)
$shortname = CutName(htmlspecialchars($res["name"]), $char1);
$nfo_dir = $site_config["nfo_dir"];
$nfofilelocation = "$nfo_dir/$id.nfo";
$filegetcontents = file_get_contents($nfofilelocation);
$nfo = htmlspecialchars($filegetcontents);
if ($nfo) {
$nfo = my_nfo_translate($nfo);
//if($CURUSER["edit_torrents"]=="yes")
//begin_frame("NFO File For: <a href=".$site_config["SITEURL"]."/torrents-details.php?id=$id>$shortname</a> - <a href=nfo-edit.php?id=$id>[Edit NFO]</a>");
//else
//begin_frame("NFO File For: $shortname<a name=nfo></a>");
//begin_table();
//print("<tr><td>\n");
print("<textarea style=\"font-size:8pt;width:100%;height:99%;border:0px;\" wrap=\"off\" rows=50 and cols=20 READONLY>".stripslashes($nfo)."</textarea>");
//end_table();
//end_frame();
}
}//has nfo
//stdfoot();
?>
THE END!
Hope it works for you, it works perfectly for me and here you have a screenshot of the opened .nfo: [url="
http://data.fuskbugg.se/skalman01/arselaer.png"]http://data.fuskbugg.se/skalman01/arselaer.png[/url]
Things i would like to see is that the .NFO centers itself on the lightbox window and to be able to change background color and text color, maybe someone here can make it?
Regards,
TorrentFriend