09 Sidebar Mod

Started by Mindless, July 27, 2012, 11:00:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mindless

Credits to FreakyNutz ??
side blocks included:
Personal info
Navigation
Seach (torrents and forums)
Torrent categories
Admin
Stats block(adapted from Bigjoos 09 stats on index cached)
Latest torrents with posters

Please note if you have previously installed this mod you will have to undo all the changes previously made in other posts.
As Always BACK UP your FILES!!!

fist off upload the files in the attached .rar file to their respective folders

to include folder
menu.php and blocks.php
to admin folder
adminblocks.php
to lang\en folder
lang_siderbar.php and lang_ad_blocks.php
to scripts folder
scroll.js, jquery.cookie.js and jquery.js

create a new folder and add the contents of the blocks folder from rar file to it

run this sql

ALTER TABLE users ADD `sidebar` enum('yes','no') character set utf8 collate utf8_bin NOT NULL default 'yes';

open my.php and add where ever you want to display it

$HTMLOUT .= tr($lang['my_side'], "<input type='checkbox' name='sidebar'" . ($CURUSER["sidebar"] == "yes" ? " checked='checked'" : "") . " /> {$lang['my_side1']}",1);


open file takeprofileedit.php and find

/////////////// avatar end /////////////////


under it add

$sidebar = (isset($_POST['sidebar']) && $_POST["sidebar"] != "" ? "yes" : "no");
$updateset[] = "sidebar = ".sqlesc($sidebar);



open file lang\en\lang_my.php and add

'my_side' => 'Side Menu',
'my_side1' => '(Check to turn Side Menu on!)',



open file admin.php and add

'adminblocks' => 'adminblocks',


open file admin\index.php and add

<span class='btn'><a href='admin.php?action=adminblocks'>{$lang['index_block']}</a></span>


open file lang\en\lang_ad_index.php and add

'index_block' => 'Blocks Admin',


2 of the blocks require code and sql from other mods

the stats block is based on the 09 stats on index (cached version) converted by Bigjoos Here so big thanks for that code
if you already have this mod installed you need to edit your sql and cleanup code to the same as this
run this sql

CREATE TABLE IF NOT EXISTS `stats` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`regusers` int(10) unsigned NOT NULL DEFAULT '0',
`unconusers` int(10) unsigned NOT NULL DEFAULT '0',
`torrents` int(10) unsigned NOT NULL DEFAULT '0',
`seeders` int(10) unsigned NOT NULL DEFAULT '0',
`leechers` int(10) unsigned NOT NULL DEFAULT '0',
`torrentstoday` int(10) unsigned NOT NULL DEFAULT '0',
`donors` int(10) unsigned NOT NULL DEFAULT '0',
`unconnectables` int(10) unsigned NOT NULL DEFAULT '0',
`forumtopics` int(10) unsigned NOT NULL DEFAULT '0',
`forumposts` int(10) unsigned NOT NULL DEFAULT '0',
`numactive` int(10) unsigned NOT NULL DEFAULT '0',
`users` int(10) unsigned NOT NULL DEFAULT '0',
`pusers` int(10) unsigned NOT NULL DEFAULT '0',
`vips` int(10) unsigned NOT NULL DEFAULT '0',
`uploaders` int(10) unsigned NOT NULL DEFAULT '0',
`mods` int(10) unsigned NOT NULL DEFAULT '0',
`admins` int(10) unsigned NOT NULL DEFAULT '0',
`sysops` int(10) unsigned NOT NULL DEFAULT '0',
`disabled` int(10) unsigned NOT NULL DEFAULT '0',
`warnedu` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;


INSERT INTO `stats` (`id`) VALUES ('1');



open file include/cleanup.php and add

$registered = get_row_count('users');
$unverified = get_row_count('users', "WHERE status='pending'");
$torrents = get_row_count('torrents');
$seeders = get_row_count('peers', "WHERE seeder='yes'");
$leechers = get_row_count('peers', "WHERE seeder='no'");
$torrentstoday = get_row_count('torrents', 'WHERE added > '.time().' - 86400');
$donors = get_row_count('users', "WHERE donor='yes'");
$unconnectables = get_row_count("peers", " WHERE connectable='no'");
$forumposts = get_row_count("posts");
$forumtopics = get_row_count("topics");
$dt = sqlesc(time() - 300); // Active users last 5 minutes
$numactive = get_row_count("users", "WHERE last_access >= $dt");
$users = get_row_count('users', "WHERE class='0'");
$pusers = get_row_count('users', "WHERE class='1'");
$vips = get_row_count('users', "WHERE class='2'");
$uploaders = get_row_count('users', "WHERE class='3'");
$mods = get_row_count('users', "WHERE class='4'");
$admins = get_row_count('users', "WHERE class='5'");
$sysops = get_row_count('users', "WHERE class='6'");
$disabled = get_row_count('users', "WHERE enabled='no'");
$warnedu = get_row_count('users', "WHERE warned='yes'");
$forumtopics = get_row_count("topics");

mysql_query("UPDATE stats SET regusers = '$registered', unconusers = '$unverified', torrents = '$torrents', seeders = '$seeders', leechers = '$leechers', unconnectables = '$unconnectables', torrentstoday = '$torrentstoday', donors = '$donors', forumposts = '$forumposts', forumtopics = '$forumtopics', numactive = '$numactive', users = '$users', pusers = '$pusers', vips = '$vips', uploaders = '$uploaders', mods = '$mods', admins = '$admins', sysops = '$sysops', disabled = '$disabled', warnedu ='$warnedu' WHERE id = '1' LIMIT 1");




if you have custom userclasses the please edit the sql and cleanup code accordingly

Latest Torrents with posters
you need to have the 09 poster mod installed for this one again a big thanks to Bigjoos on this conversion also:drinks: Here
please ensure you have the poster mod added or it will error on page
you also need to have the css part for the scrolling display added to your style sheets

all the other blocks should work ok with no extra code or sql

ok for the side blocks to display

run this sql

CREATE TABLE IF NOT EXISTS `sidebar` (
`blockid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`position` char(1) NOT NULL DEFAULT '',
`sortid` int(11) unsigned NOT NULL DEFAULT '0',
`status` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`blockid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;

INSERT INTO `sidebar` (`blockid`, `name`, `position`, `sortid`, `status`) VALUES
(3, 'search', 'l', 3, 1),
(2, 'menu', 'l', 2, 1),
(1, 'personal', 'l', 1, 1),
(4, 'categories', 'l', 4, 1),
(5, 'admin', 'r', 5, 1),
(6, 'stats', 'r', 6, 1),
(7, 'latest', 'r', 7, 1);




next we need to edit your stdhead and stdfoot functions
open bittorrent.php (or where ever you have those functions) and find within your stdhead function

$htmlout .= "</div>
</td>
</tr>
<tr><td align='center' class='outer' style='padding-top: 20px; padding-bottom: 20px'>";



replace with

  $htmlout .= "</div></td></tr></table>";
  $htmlout .= "<table class='main' width='100%' cellspacing='0' cellpadding='0' border='0'><tr>";
if ($CURUSER && $CURUSER['sidebar'] === "yes"){
$htmlout .="<td valign='top' class='clear' width='180' style='padding-top: 20px; '>";
  require_once("include/blocks.php");
  $htmlout .= left_menu();
$htmlout .="</td>";
  }
$htmlout .="<td valign='top' align='center' class='clear' style='padding-top: 20px; padding-bottom: 20px'>";




now we need to replace the stdfoot fuction with this one to allow blocks swapping between left and right

    if ($CURUSER && $CURUSER['sidebar'] === "yes"){
    $htmlfoot .= "<td class='clear' valign='top' width='180' style='padding-top: 20px; '>";
    require_once("include/blocks.php");
    $htmlfoot .= right_menu();
    $htmlfoot .= "</td>";
    }
    $htmlfoot .="</tr></table>\n";



function stdfoot() {
global $CURUSER, $TBDEV, $lang;
$htmlout = "";
$htmlout .= "<p align='center'>Remember, if you see any specific instance of this software running publicly, it's within your rights under gpl to garner a copy of that derivative from the person responsible for that webserver.
<a href='http://www.tbdev.net'><img src='{$TBDEV['pic_base_url']}tbdev_btn_red.png' border='0' alt='Powered By TBDev &copy;2010' title='Powered By TBDev &copy;2010' /></a></p>
</td>
";
if ($CURUSER && $CURUSER['sidebar'] === "yes"){
$htmlout .= "<td class='clear' valign='top' width='180' style='padding-top: 20px; '>";
require_once("include/blocks.php");
$htmlout .= right_menu();

$htmlout .= "</td>";
}
$htmlout .= "</tr></table>\n
</body></html>\n";


return $htmlout;

}



and thats it any problems i will try my best to rectify as soon as possible

[attachment deleted by admin]