Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=87)
-   -   BookMark [ADDON] TT-2. (http://www.bvlist.com/showthread.php?t=9054)

Extremlym 7th April 2013 20:17

BookMark [ADDON] TT-2.
 
SQL
PHP Code:

CREATE TABLE `bookmarks` (
`
idint(10unsigned NOT NULL auto_increment,
`
useridint(10unsigned NOT NULL default '0',
`
torrentidint(10unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
TYPE=MyISAM AUTO_INCREMENT=13

account.php find
PHP Code:

<?print("<a href=mailbox.php><b>My Messages</b></a>");?>

add after
PHP Code:

&nbsp;|&nbsp;
<?print("<a href=bookmark.php><b>My Bookmarks</b></a>");?>

torrents-details.php find
PHP Code:

print("<b>" HITS ": </b>" $row["hits"] . "\n"); 

add after
PHP Code:

// Bookmarks mod
$bookt mysql_query("SELECT torrentid FROM bookmarks WHERE torrentid = $row[id] AND userid = $CURUSER[id]");
if (
mysql_num_rows($bookt) > 0)
        print(
"<tr><td  align=left><b>Bookmark:</b></td><td><font  color=red>You already have this torrent <a  href='bookmark.php'>bookmarked.</a></font></td></tr><td>&nbsp;</td><td><a  href='takedelbookmark.php?bookmarkid="$row[id] ."'><img  src='images/delchat.gif' border='0' width='10px' alt='delete'  title='delete' /></a></td></tr>\n");
        else 
print(
"<tr><td  align=left><b>Bookmark:</b></td><td><a  href='bookmarks.php?torrent=$row[id]'>Add this torrent</a> to  <a href='bookmark.php'>My  Bookmarks</a></td></tr>\n");
   
//end bookmarks 

function.php find
PHP Code:

mysql_query("DELETE FROM torrents WHERE id = $id"); 

add after
PHP Code:

mysql_query("DELETE FROM bookmarks WHERE torrentid = $id"); 

find
PHP Code:

mysql_query("DELETE FROM ratings WHERE user = $userid"); 

add after
PHP Code:

 mysql_query("DELETE FROM bookmarks WHERE userid = $userid"); 

find
PHP Code:

 case 'rating':
                                echo 
"<td class=ttable_head>".RATINGS."</td>";
                        break; 

add after
PHP Code:

 case 'bookmark':
                if (
$variant == "bookmarks"
echo 
"<td class=ttable_head>Delete</td>";
                        break; 

find
PHP Code:

 case 'rating':
                                if (!
$row["rating"])
                                        
$rating "--";
                                else
                                        
$rating "<a title='$row[rating]/5'>".ratingpic($row["rating"])."</a>";
                                        
//$rating = ratingpic($row["rating"]);
                                         //$srating .= "$rpic (" .  $row["rating"] . " out of 5) " . $row["numratings"] . " users have rated  this torrent";
                                
print("<td class=ttable_col$x align=center>$rating</td>");
                        break; 
add after
case 'bookmark':
                                if (
$variant == "bookmarks"
echo 
"<td class=ttable_col2 align=center><a  href='takedelbookmark.php?bookmarkid=$id' title='Delete'><img  src='images/delchat.gif' border='0' width='10px' alt='delete'  title='delete' /></a></td>";
                        break; 

config.php
find
PHP Code:

 $site_config["torrenttable_columns"] = "category,name,dl,uploader,comments,size,seeders,leechers,health,external"

change for
PHP Code:

 $site_config["torrenttable_columns"] = "category,name,dl,uploader,comments,size,seeders,leechers,health,external,boo
kmark"


bookmark.php ==>upload it
PHP Code:

 <?
require_once("backend/functions.php");
dbconn(false);

if (!isset(
$_GET[user]))
          
$user $CURUSER[id];
else
          
$user $_GET[user];

$res mysql_query("SELECT username FROM users WHERE id = $user") or sqlerr();
$arr mysql_fetch_array($res);

stdhead("Bookmarks for " $arr[username]);

//print ("<h1>Bookmarks for <a  href=userdetails.php?id=$user><b>$arr[username]<b></a></h2>");

$res mysql_query("SELECT COUNT(id) FROM bookmarks WHERE userid = $user");
$row mysql_fetch_array($res);
$count $row[0];

list(
$pagertop$pagerbottom$limit) = pager(25$count"bookmarks.php?");

$res mysql_query("SELECT bookmarks.id as bookmarkid,  users.username,users.id as owner, torrents.id, torrents.name,  torrents.type, torrents.comments, torrents.leechers, torrents.seeders,  ROUND(torrents.ratingsum / torrents.numratings) AS rating,  categories.name AS cat_name, categories.image AS cat_pic,  torrents.save_as, torrents.numfiles, torrents.added, torrents.filename,  torrents.size, torrents.views, torrents.visible, torrents.hits,  torrents.times_completed, torrents.category FROM bookmarks LEFT JOIN  torrents ON bookmarks.torrentid = torrents.id LEFT JOIN users on  torrents.owner = users.id LEFT JOIN categories ON torrents.category =  categories.id WHERE bookmarks.userid = $user ORDER BY torrents.id DESC  $limit")  or sqlerr();

begin_frame("My Bookmarks");

print(
$pagertop);
torrenttable($res"bookmarks"TRUE);
print(
$pagerbottom);

end_frame();
stdfoot();

?>

bookmarks.php ==> upload it
PHP Code:

<?
require_once("backend/functions.php");
dbconn();

$gottorrent = (int)$_GET["torrent"];

if (!isset(
$gottorrent))
          
show_error_msg("Error"," ... No torrent selected",1);

if ((
get_row_count("bookmarks""WHERE userid=$CURUSER[id] AND torrentid = $gottorrent")) > 0)
          
show_error_msg("Error","Already bookmarked torrent",1);

if ((
get_row_count("torrents""WHERE id = $gottorrent")) > 0) {
mysql_query("INSERT INTO bookmarks (userid, torrentid) VALUES ($CURUSER[id]$gottorrent)") or die(mysql_error());

stdhead("Bookmarks");
begin_frame ("Successfully");
echo 
"Torrent bookmarked";
echo 
"<a href=torrents-details.php?id=$gottorrent>Back To Torrent</a>";
end_frame();
stdfoot();
}
else  
show_error_msg("Error","ID not found",1);

?>

takedelbookmark.php ==>upload it
PHP Code:

 <?
require_once("backend/functions.php");
dbconn(true);
loggedinonly();

$delid = (int)$_GET['bookmarkid'];

$res2 mysql_query ("SELECT id, userid FROM bookmarks WHERE torrentid = $delid AND userid = $CURUSER[id]") or die();

$arr mysql_fetch_assoc($res2);
if (!
$arr)
show_error_msg("Error!","ID not found in your bookmarks list...",1);

mysql_query ("DELETE FROM bookmarks WHERE torrentid = $delid AND userid = $CURUSER[id]") or die();
header("Refresh: 0;url=".$_SERVER['HTTP_REFERER']);
?>


EagleLake 10th October 2013 23:54

Code:

CREATE TABLE `bookmarks` (
`
id` int(10) unsigned NOT NULL auto_increment,
`
userid` int(10) unsigned NOT NULL default '0',
`
torrentid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
)
TYPE=MyISAM AUTO_INCREMENT=13;


change type for ENGINE=MyISAM



All times are GMT +2. The time now is 20:47.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.