View Single Post
  #1  
Old 15th October 2008, 05:24
al_ltoticmat al_ltoticmat is offline
Senior Member
 
Join Date: Oct 2008
Posts: 44
Default Screenshot Request
I found it: posted by Rich here Board Message !


This will allow you to add a link to your upload to display an image in details.php

Adapted to work with TBdev DR SourceCode 0.25 upwards.

In upload.php FIND
Code:
 print("<table align=center cellpadding=5><tr>");
  print("<td class=embedded>Torrent name </td><td class=embedded><input type=\"text\" name=\"name\" size=\"80\" /><br>(Taken from filename if not specified. <b>Please use descriptive names.</b>)</td>");
  print("</tr></table><br>");
ADD AFTER
Code:
 print("<table align=center cellpadding=5><tr>");
  print("<td class=embedded>Poster CD name </td><td class=embedded><input type=\"text\" name=\"poster\" size=\"80\" /><br>(Upload to <a href=bitbucket.php>BitBucket</a> link for a poster image to be shown on the details page)</td>");
  print("</tr></table><br>");


In takeupload.php

FIND
Code:
$nfofile = $_FILES['nfo'];
ADD BEFORE
Code:
if (!empty($_POST['poster']))
$poster = unesc($_POST['poster']);
Edit the Query to look like this
Code:
$torrent_insert_sql = sprintf("INSERT INTO torrents
                                                             (search_text, filename, owner, visible, info_hash, name, size, numfiles, type, descr, ori_descr, description, descr_parsed, category, save_as, added, last_action, nfo, inverted_timestamp, poster)
                                                             VALUES
                                                             ('%s', '%s', %u, '%s', '%s', '%s', %u, %u, '%s', '%s', '%s', '%s', '%s', %u, '%s', NOW(), NOW(), '%s', 4294967295-UNIX_TIMESTAMP(NOW()), '%s' )
                                                             ",
                                                             mysql_escape_string( searchfield($shortfname." ".$dname." ".$torrent) ),
                                                             mysql_escape_string( $fname ),
                                                             $CURUSER['id'],
                                                             'no',
                                                             mysql_escape_string($infohash),
                                                             mysql_escape_string($torrent),
                                                             $totallen,
                                                             count($filelist),
                                                             $type,
                                                             mysql_escape_string(strip_tags($descr)),
                                                             mysql_escape_string(strip_tags($descr)),
                                                             mysql_escape_string($smalldescr),
                                                             mysql_escape_string($descr_parsed),
                                                             (int) $_POST['type'],
                                                             mysql_escape_string($dname),
                                                             mysql_escape_string($nfo),
                                                             mysql_escape_string($poster)
                                                             );

In details.php
Edit the Query to look like this

Code:
$res = do_mysql_query("SELECT
                        UNIX_TIMESTAMP(torrents.added) AS ts,
                        torrents.descr_parsed,
                        torrents.completed_by,
                        torrents.seeders,
                        torrents.banned,
                        torrents.leechers,
                        torrents.info_hash,
                        torrents.filename,
                        torrents.description,
                        torrents.comments,
                        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.times_completed,
                        torrents.id,
                        torrents.type,
                        torrents.numfiles,
                        torrents.poster,
                        categories.name AS cat_name,
                        users.username,
                        users.anonymous
                        FROM torrents
                        LEFT JOIN categories ON torrents.category = categories.id
                        LEFT JOIN users ON torrents.owner = users.id
                        WHERE torrents.id = ".$id)    or sqlerr();
FIND
Code:
if (!empty($row["descr_parsed"]))
ADD AFTER
Code:
if (!empty($row["poster"]))
tr("Poster CD", "<img src='".$row["poster"]."'>", 1);
In edit.php
FIND
Code:
    tr( _("Torrent name"), "<input type=\"text\" name=\"name\" value=\"" . htmlspecialchars($row["name"]) . "\" size=\"80\" />", 1);
ADD AFTER
Code:
    tr( _("Poster CD"), "<input type=\"text\" name=\"poster\" value=\"" . htmlspecialchars($row["poster"]) . "\" size=\"80\" />", 1);
In takeedit.php
FIND
Code:
$dname = $row["save_as"];
ADD AFTER
Code:
if (!empty($_POST['poster']))
$poster = unesc($_POST['poster']);
FIND
Code:
$updateset[] = "visible = '" . ($_POST["visible"] ? "yes" : "no") . "'";
ADD BEFORE
Code:
$updateset[] = "poster = " . sqlesc($poster);
Run this quiery on your database
Code:
ALTER TABLE torrents ADD poster VARCHAR(255) NOT NULL
Click image for larger version

Name:	plakatdemo3us.jpg
Views:	608
Size:	117.7 KB
ID:	425

Last edited by al_ltoticmat; 15th October 2008 at 08:24.
Reply With Quote