View Single Post
  #4  
Old 8th January 2011, 22:50
daffy's Avatar
daffy daffy is offline
Senior Member
 
Join Date: Mar 2009
United Kingdom
Posts: 550
Default
all credit goes to walker1977
So this one has been in the premium section for about 2 years now so i decided it is time for the normal users to enjoy it and maybe build on it.


Ok I got the idea from the IMDB mod. some torrents have screenshots so this lets your uppers up them with the torrent to display in the torrent details and to display in the torrent tables with the ballon mod.

sql:

Code:
ALTER TABLE `torrents` ADD `screens1` LONGTEXT NOT NULL;
ALTER TABLE `torrents` ADD `screens2` LONGTEXT NOT NULL;
ALTER TABLE `torrents` ADD `screens3` LONGTEXT NOT NULL;
ALTER TABLE `torrents` ADD `screens4` LONGTEXT NOT NULL;
find in torrents-upload.php:

Code:
$descr = unesc($_POST["descr"]);

    if (!$descr)
        $descr = "No description given.";
add above it:

Code:
///screenshot
        $screens1 = unesc($_POST["screens1"]);
        if (!$screens1)
        $screens1 = "";

        $screens2 = unesc($_POST["screens2"]);
        if (!$screens2)
        $screens2 = "";

        $screens3 = unesc($_POST["screens3"]);
        if (!$screens3)
        $screens3 = "";

        $screens4 = unesc($_POST["screens4"]);
        if (!$screens4)
        $screens4 = "";
        ///screenshot
Code:
now find:
Code:
$ret = mysql_query("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang) VALUES (".sqlesc($fname).", '".$uploaderid."', ".sqlesc($name).", ".sqlesc($descr).", '".$inames[0]."', '".$inames[1]."', '".$type."', '" . get_date_time() . "', '".$infohash."', '".$torrentsize."', '".$filecount."', ".sqlesc($fname).", '".$announce."', '".$external."', '".$nfo."', '".$langid."')");
in this query you need to add a few things:

directly after:

Code:
name,
add:

Code:
screens1, screens2, screens3, screens4,
now still in the same query directly after:

Code:
".sqlesc($name).",
add:

Code:
".sqlesc($screens1).", ".sqlesc($screens2).", ".sqlesc($screens3).", ".sqlesc($screens4).",
now find:

Code:
print ("<TR><TD align=right>" . NFO . ": </td><td align=left> <input type=file name=nfo size=50 value=" . $_FILES['nfo']['name'] . "><br />\n</td></tr>");
add after:

Code:
// screenshots //
print ("<TR><TD align=right>Screenshot 1: </td><td align=left><input type=text name=screens1 size=60 value=" . $_POST['screens1'] . "><BR>\n</td></tr>");
print ("<TR><TD align=right>Screenshot 2: </td><td align=left><input type=text name=screens2 size=60 value=" . $_POST['screens2'] . "><BR>\n</td></tr>");
print ("<TR><TD align=right>Screenshot 3: </td><td align=left><input type=text name=screens3 size=60 value=" . $_POST['screens3'] . "><BR>\n</td></tr>");
print ("<TR><TD align=right>Screenshot 4: </td><td align=left><input type=text name=screens4 size=60 value=" . $_POST['screens4'] . "><BR>\n</td></tr>");
//screenshots //
find in torrents-edit.php:

Code:
$updateset[] = "name = " . sqlesc($name);
add after:

Code:
///screenshot
    $updateset[] = "screens1 = " . sqlesc($screens1);
    $updateset[] = "screens2 = " . sqlesc($screens2);
    $updateset[] = "screens3 = " . sqlesc($screens3);
    $updateset[] = "screens4 = " . sqlesc($screens4);
    ///screenshot end
now find:

Code:
echo "<tr><td align=right width=60><B>Name: </b></TD><TD><input type=\"text\" name=\"name\" value=\"" . htmlspecialchars($row["name"]) . "\" size=\"60\" /></TD></TR>";
add after:

Code:
///screenshots
echo "<tr><td align=right width=60><B>Screenshot 1: </b></TD><TD><input type=\"text\" name=\"screens1\" value=\"" . htmlspecialchars($row["screens1"]) . "\" size=\"60\" /></TD></TR>";
echo "<tr><td align=right width=60><B>Screenshot 2: </b></TD><TD><input type=\"text\" name=\"screens2\" value=\"" . htmlspecialchars($row["screens2"]) . "\" size=\"60\" /></TD></TR>";
echo "<tr><td align=right width=60><B>Screenshot 3: </b></TD><TD><input type=\"text\" name=\"screens3\" value=\"" . htmlspecialchars($row["screens3"]) . "\" size=\"60\" /></TD></TR>";
echo "<tr><td align=right width=60><B>Screenshot 4: </b></TD><TD><input type=\"text\" name=\"screens4\" value=\"" . htmlspecialchars($row["screens4"]) . "\" size=\"60\" /></TD></TR>";
///screenshots
no find in torrents-details.php:

Code:
torrents.name,
add directly after:

Code:
torrents.screens1, torrents.screens2, torrents.screens3, torrents.screens4,
now find:

Code:
if ($row["image1"] != "" OR $row["image2"] != "") {
  if ($row["image1"] != "")
    $img1 = "<IMG src=".$site_config["SITEURL"]."/uploads/images/$row[image1] width=150 border=0>";
  if ($row["image2"] != "")
    $img2 = "<IMG src=".$site_config["SITEURL"]."/uploads/images/$row[image2] width=150 border=0>";
  print("<CENTER>". $img1 . "&nbsp&nbsp" . $img2."</CENTER><BR>");
}
add after:

Code:
echo "<BR><BR>";
if ($row["screens1"] != "" OR $row["screens2"] != "" OR $row["screens3"] != "" OR $row["screens3"] != "") {
  if ($row["screens1"] != "")
    $screens1 = "<IMG src=".$row['screens1']." width=350 border=0>";
  if ($row["screens2"] != "")
    $screens2 = "<IMG src=".$row['screens2']." width=350 border=0>";
if ($row["screens3"] != "")
    $screens3 = "<IMG src=".$row['screens3']." width=350 border=0>";
  if ($row["screens4"] != "")
    $screens4 = "<IMG src=".$row['screens4']." width=350 border=0>";
  print("<CENTER>". $screens1 . "&nbsp&nbsp" . $screens2 ."</CENTER><BR>");
  print("<CENTER>". $screens3 . "&nbsp&nbsp" . $screens4 ."</CENTER><BR>");
}
now find in functions.php:

Code:
<td class=ttable_head>NFO</td>
add after:

Code:
<td class=ttable_head>Screens</td>
now find:

Code:
if ($row["nfo"]=='yes') {
            print("<td class=ttable_col1 align=center><a href=nfo-view.php?id=$row[id]><img  src=" . $site_config['SITEURL'] . "/images/icon_nfo.gif border=0 alt='View NFO'></a></td>");
        }else{
                print("<td class=ttable_col1 align=center>-</td>");
        }
add after:

Code:
$simg = @mysql_fetch_array(@mysql_query("SELECT screens1, screens2, screens3, screens4 FROM torrents WHERE id=$id"));
                $simg1 = $simg[screens1];
                $simg2 = $simg[screens2];
                $simg3 = $simg[screens3];
                $simg4 = $simg[screens4];
                $screens1 = number_format(get_row_count("torrents", "WHERE id=$row2[id] && screens1!=''"));
                $screens2 = number_format(get_row_count("torrents", "WHERE id=$row2[id] && screens2!=''"));
                $screens3 = number_format(get_row_count("torrents", "WHERE id=$row2[id] && screens3!=''"));
                $screens4 = number_format(get_row_count("torrents", "WHERE id=$row2[id] && screens4!=''"));
                $screenstotal = $screens1 + $screens2 + $screens3 + $screens4;
                if ($simg["screens1"]!=''){
                print("<td class=ttable_col1 align=center><font size=1 face=Verdana><a href=screens.php?id=$id onmouseover=\" return overlib('<center><h1><b>Screen Shots:</b></h1></center><hr><table width=100%><tr><td><img src=$simg1 width=250 border=0></td><td><img src=$simg2 width=250 border=0><img src=$simg3 width=250 border=0><img src=$simg4 width=250 border=0></td></tr></table>', CENTER, HEIGHT, 250, WIDTH, 300);\" onmouseout=\"return nd();\">" . $screenstotal . "</a></td>\n");                 
                }else{
                print("<td class=ttable_col1 align=center><font size=1 face=Verdana><a href=screens.php?id=$id onmouseover=\" return overlib('<center><h1><b>Screen Shots:</b></h1></center><hr><table width=100%><tr><td><br><br><br><br><tr><td><center><font color=red size=4><b>Sorry no screens available</b></font></center></td></tr></table>', CENTER, HEIGHT, 250, WIDTH, 300);\" onmouseout=\"return nd();\">" . $screenstotal . "</a></td>\n");
                }
now if you do not have the overlib already on your site then add this to your header.php for every theme you use it goes between the <head> and </head>:

Code:
<script type="text/javascript" src="/themes/default/overlib.js"></script>
also upload the file below to the default folder in your themes folder

and add the screens.php to your root folder

I hope I did not forget anything enjoy :D

Click the image to open in full size.

Click the image to open in full size.

Click the image to open in full size.
__________________
"FFS PPL READ GOD DAMMIT, WHAT AM I GOOGLE?"
"I Kill You!" simples


http://i.imgur.com/DtcRfH5.gif

I also Setup And Modify Trackers PM For Details
Reply With Quote
The Following 5 Users Say Thank You to daffy For This Useful Post:
aMiGo1972 (12th January 2011), dumorim (9th January 2011), PopcornCat™ (29th April 2011), RIAS (2nd July 2013), vulongvy (11th April 2012)