View Single Post
  #1  
Old 17th November 2010, 14:31
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default [2.0.4]Poster/Screenshot mod
Add a poster and Screenshots to your torrents detail's
This Mod was a request From TryHarder at seed-bytes as he prepares
for his Move to PMBT.

First off you well want to make a change to your database By running this SQL
Please remember to alter the prefix If needed
Code:
ALTER TABLE `torrent_torrents` ADD `post_img` TEXT CHARACTER SET utf8 COLLATE utf8_bin NULL AFTER `descr` ,
ADD `screan1` TEXT CHARACTER SET utf8 COLLATE utf8_bin NULL AFTER `post_img` ,
ADD `screan2` TEXT CHARACTER SET utf8 COLLATE utf8_bin NULL AFTER `screan1` ,
ADD `screan3` TEXT CHARACTER SET utf8 COLLATE utf8_bin NULL AFTER `screan2` ,
ADD `screan4` TEXT CHARACTER SET utf8 COLLATE utf8_bin NULL AFTER `screan3` ;
Now We shall start with the File upload/torrent.php
Find
Code:
echo "<tr><td><p>"._bttorrentname."</p></td><td><p><input type=\"text\" name=\"namex\" size=\"80\" /><br />("._btfromtorrent. "<b>"._btdescname."</b>)</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
Add after
Code:
// Poster Modd
echo "<tr><td><p>"._bt_poster."</p></td><td><p><input type=\"text\" name=\"post_img\" size=\"80\" /><br />"._bt_poster_exp."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
// Screen shot Mod
echo "<tr><td><p>"._bt_screensa."</p></td><td><p><input type=\"text\" name=\"screan1\" size=\"80\" /><br />"._bt_screen_expa."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
echo "<tr><td><p>"._bt_screensb."</p></td><td><p><input type=\"text\" name=\"screan2\" size=\"80\" /><br />"._bt_screen_expb."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
echo "<tr><td><p>"._bt_screensc."</p></td><td><p><input type=\"text\" name=\"screan3\" size=\"80\" /><br />"._bt_screen_expc."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
echo "<tr><td><p>"._bt_screensd."</p></td><td><p><input type=\"text\" name=\"screan4\" size=\"80\" /><br />"._bt_screen_expd."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
// End Mods
Now We Do File upload/taketorrent.php
Find
Code:
if(!isset($build)) $build = "no";
and add after
Code:
if(isset($post_img) && $post_img != ''){
        if (!preg_match('#^(https?://).*?\.(gif|jpg|jpeg|png)$#i', $post_img, $match))
        {
             bterror($errors,'The URL you specified For Poster is invalid.');
        }
        if (empty($match[2]))
        {
             bterror($errors,'The URL you specified is not a (gif|jpg|jpeg|png).');
        }
}
else
$post_img = "NULL";
if(isset($screan1) && $screan1 != ''){
        if (!preg_match('#^(https?://).*?\.(gif|jpg|jpeg|png)$#i', $post_img, $match))
        {
             bterror($errors,'The URL you specified For Screenshot1 is invalid.');
        }
        if (empty($match[2]))
        {
             bterror($errors,'The URL you specified is not a (gif|jpg|jpeg|png).');
        }
}
else
$screan1 = "NULL";
if(isset($screan2) && $screan2 != ''){
        if (!preg_match('#^(https?://).*?\.(gif|jpg|jpeg|png)$#i', $post_img, $match))
        {
             bterror($errors,'The URL you specified For Screenshot2 is invalid.');
        }
        if (empty($match[2]))
        {
             bterror($errors,'The URL you specified is not a (gif|jpg|jpeg|png).');
        }
}
else
$screan2 = "NULL";
if(isset($screan3) && $screan3 != ''){
        if (!preg_match('#^(https?://).*?\.(gif|jpg|jpeg|png)$#i', $post_img, $match))
        {
             bterror($errors,'The URL you specified For Screenshot3 is invalid.');
        }
        if (empty($match[2]))
        {
             bterror($errors,'The URL you specified is not a (gif|jpg|jpeg|png).');
        }
}
else
$screan3 = "NULL";
if(isset($screan4) && $screan4 != ''){
        if (!preg_match('#^(https?://).*?\.(gif|jpg|jpeg|png)$#i', $post_img, $match))
        {
             bterror($errors,'The URL you specified For Screenshot4 is invalid.');
        }
        if (empty($match[2]))
        {
             bterror($errors,'The URL you specified is not a (gif|jpg|jpeg|png).');
        }
}
else
$screan4 = "NULL";
Now Find in the same file
Code:
$torrentfields[] = "descr";
$torrentvalues[] = "'".$descr."'";
and add after
Code:
// Poster Modd
$torrentfields[] = "post_img";
$torrentvalues[] = "'".addslashes($post_img)."'";

//ScreenShot Modd
$torrentfields[] = "screan1";
$torrentvalues[] = "'".addslashes($screan1)."'";

$torrentfields[] = "screan2";
$torrentvalues[] = "'".addslashes($screan2)."'";

$torrentfields[] = "screan3";
$torrentvalues[] = "'".addslashes($screan3)."'";

$torrentfields[] = "screan4";
$torrentvalues[] = "'".addslashes($screan4)."'";

//End mods
Now we well do ajax.php
find
Code:
        $sql = "SELECT A.id as id, A.exeem, A.seeders, A.leechers, A.tot_peer, A.speed, A.info_hash, A.filename, A.banned, A.nuked, A.nukereason, A.password, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(A.last_action) AS lastseed, A.numratings, A.name, IF(A.numratings < '".$minvotes."', NULL, ROUND(A.ratingsum / A.numratings, 1)) AS rating, A.save_as, A.banned, A.descr, A.visible, A.size, A.plen, A.added, A.views, A.downloaded, A.completed, A.type, A.private, A.min_ratio, A.numfiles, A.owner, A.ownertype, A.complaints, A.evidence, A.tracker, A.tracker_list, A.dht as dht, A.md5sum as md5sum, A.uploader_host as user_host, B.name AS cat_name, IF(C.name IS NULL, C.username, C.name) as ownername, A.tracker_update, COUNT(S.status) as auths FROM ".$db_prefix."_torrents A LEFT JOIN ".$db_prefix."_categories B ON A.category = B.id LEFT JOIN ".$db_prefix."_users C ON A.owner = C.id LEFT JOIN ".$db_prefix."_privacy_file S ON S.torrent = A.id AND S.status = 'pending' WHERE A.id = '".$_GET['torrent']."' GROUP BY A.id LIMIT 1;";
and make it
Code:
        $sql = "SELECT A.id as id,A.post_img,A.screan1,A.screan2,A.screan3,A.screan4, A.exeem, A.seeders, A.leechers, A.tot_peer, A.speed, A.info_hash, A.filename, A.banned, A.nuked, A.nukereason, A.password, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(A.last_action) AS lastseed, A.numratings, A.name, IF(A.numratings < '".$minvotes."', NULL, ROUND(A.ratingsum / A.numratings, 1)) AS rating, A.save_as, A.descr, A.visible, A.size, A.plen, A.added, A.views, A.downloaded, A.completed, A.type, A.private, A.min_ratio, A.numfiles, A.owner, A.ownertype, A.complaints, A.evidence, A.tracker, A.tracker_list, A.dht as dht, A.md5sum as md5sum, A.uploader_host as user_host, B.name AS cat_name, IF(C.name IS NULL, C.username, C.name) as ownername, A.tracker_update, COUNT(S.status) as auths FROM ".$db_prefix."_torrents A LEFT JOIN ".$db_prefix."_categories B ON A.category = B.id LEFT JOIN ".$db_prefix."_users C ON A.owner = C.id LEFT JOIN ".$db_prefix."_privacy_file S ON S.torrent = A.id AND S.status = 'pending' WHERE A.id = '".$_GET['torrent']."' GROUP BY A.id LIMIT 1;";
Find at or about line 1605
Code:
if ($torrent_global_privacy AND $user->user AND !$user->premium AND $torrent_global_privacy AND $download_level=="user" AND $torrent["owner"] != $user->id AND $torrent["private"] == "true" AND $torrent["owner"] != 0) {
        echo "<tr><td><p>"._btauthstatus."</p></td>";
        switch ($flag) {
                case AUTH_PENDING: {
                        echo "<td><p class=\"pending\">"._btdwauthpending."</p></td>";
                        break;
                }
                case AUTH_GRANTED: {
                        echo "<td><p class =\"granted\">"._btdwauthgranted."</p></td>";
                        break;
                }
                case AUTH_DENIED: {
                        echo "<td><p class =\"denied\">"._btdwauthdenied."<p></td>";
                        break;
                }
                case AUTH_NONE: {
                        echo "<td><p class =\"pending\">"._btdwauthnorequest."<p></td>";
                        break;
                }
        }
        echo "</tr>\n";
}
and add after
Code:
#Poster
if($torrent["post_img"] !=''){
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
echo "<tr><td><p>"._bt_poster."</p></td><td><img src=\"".$torrent["post_img"]."\" border=\"0\"></td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
}
Now fined
Code:
if (!empty($torrent["descr"])) {//Sometimes massive upload Torrents do not have description
        echo "<tr><td><p>"._btdescription."</p></td><td id=\"descrTD".$torrent['id']."\">".($user->admin ? "<a ondblclick=\"sndReq('op=edit_torrent_descr&torrent=".$torrent['id']."', 'descrTD".$torrent['id']."')\">" . pic("edit.gif","",_btalt_edit) ."</a>" : "");
        if ($descript != strip_tags($descript)) //Means it is written in HTML
                echo $descript;
        else
                echo "<p>".str_replace("\n","<br>",$descript)."</p>";
        echo "</td></tr>\n";
}
and add after
Code:
#Sceenshot
if($torrent["screan1"] !=''){
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
echo "<tr><td><p>"._bt_screensa."</p></td><td><a href=\"".stripslashes($torrent["screan1"])."\" title=\"Click For Full Size\"><img src=\"".stripslashes($torrent["screan1"])."\" width=\"300\" border=\"0\"><br>Click Here For Full Size</a></td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
}
if($torrent["screan2"] !=''){
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
echo "<tr><td><p>"._bt_screensb."</p></td><td><a href=\"".stripslashes($torrent["screan2"])."\" title=\"Click For Full Size\"><img src=\"".stripslashes($torrent["screan2"])."\" width=\"300\" border=\"0\"><br>Click Here For Full Size</a></td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
}
if($torrent["screan3"] !=''){
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
echo "<tr><td><p>"._bt_screensc."</p></td><td><a href=\"".stripslashes($torrent["screan3"])."\" title=\"Click For Full Size\"><img src=\"".stripslashes($torrent["screan3"])."\" width=\"300\" border=\"0\"><br>Click Here For Full Size</a></td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
}
if($torrent["screan4"] !=''){
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
echo "<tr><td><p>"._bt_screensd."</p></td><td><a href=\"".stripslashes($torrent["screan4"])."\" title=\"Click For Full Size\"><img src=\"".stripslashes($torrent["screan4"])."\" width=\"300\" border=\"0\"><br>Click Here For Full Size</a></td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td><HR SIZE=1 NOSHADE></td></tr>\n";
}
Now for language file this is only english so open language/english.php
and find the last row not commented out and add
Code:
define("_bt_poster","Poster"); 
define("_bt_screensa","Screenshot 1"); 
define("_bt_screensb","Screenshot 2"); 
define("_bt_screensc","Screenshot 3"); 
define("_bt_screensd","Screenshot 4"); 
define("_bt_poster_exp","(Direct link for a poster,Poster Upload " . $siteurl . ")"); 
define("_bt_screen_expa","(Direct link for a Screenshot 1)"); 
define("_bt_screen_expb","(Direct link for a Screenshot 2)"); 
define("_bt_screen_expc","(Direct link for a Screenshot 3)"); 
define("_bt_screen_expd","(Direct link for a Screenshot 4)");
__________________
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/

Last edited by joeroberts; 17th November 2010 at 19:19.
Reply With Quote
The Following User Says Thank You to joeroberts For This Useful Post:
Phogo (13th February 2012)