benjaminbih |
27th December 2009 03:32 |
[FTS 1.1] Integrate the blocks system [beta]
The FTS source includes the file /include/blocks.php wich is not integrated.
So let us make the blocks system working, but backup your files for security and read all carefully.
Add to your database:
PHP Code:
CREATE TABLE IF NOT EXISTS `orbital_blocks` ( `bid` int(10) NOT NULL auto_increment, `bkey` varchar(15) NOT NULL default '', `title` varchar(80) NOT NULL default '', `content` mediumtext NOT NULL, `bposition` char(1) NOT NULL default '', `weight` int(10) NOT NULL default '1', `active` int(1) NOT NULL default '1', `time` varchar(14) NOT NULL default '0', `blockfile` varchar(255) NOT NULL default '', `view` int(1) NOT NULL default '0', `expire` varchar(14) NOT NULL default '0', `action` char(1) NOT NULL default '', `which` varchar(255) NOT NULL default '', PRIMARY KEY (`bid`), KEY `active` (`active`,`bposition`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=109 ;
Open /include/core.php and add :
PHP Code:
require_once ( $rootpath . 'include/blocks.php');
Add to /include/libs/config/main.php this:
PHP Code:
$use_blocks = FFactory::configoption($MAIN['use_blocks'],'yes');
after this line:
PHP Code:
$invite_timeout = FFactory::configoption($MAIN['invite_timeout'],'1');
Open /administrator/options.php and search for this:
PHP Code:
tr( "Show Disclaimer Box (on index page)?", help('You can choose to show or to hide the Disclaimer box on index page').select('discindex',array("yes" => "Yes","no" => "No"),_value('discindex')), 1 ) ;
and below it this:
PHP Code:
tr( "Use the blocks system", select("use_blocks",array("yes" => "Yes","no" => "No"),_value('use_blocks')), 1 ) ;
in the same file find:
PHP Code:
GetVar( array('site_online', 'max_torrent_size', 'announce_interval', 'signup_timeout', 'minvotes', 'max_dead_torrent_time', 'maxusers', 'torrent_dir', 'announce_urls', 'BASEURL', 'DEFAULTBASEURL', 'MEMBERSONLY', 'PEERLIMIT', 'SITEEMAIL', 'SITENAME', 'autoclean_interval', 'pic_base_url', 'table_cat', 'reportemail', 'invitesystem', 'registration', 'showpolls', 'showstats', 'showlastxforumposts', 'howmuchforum', 'showlastxtorrents', 'howmuchtorrents', 'thowshow', 'showtrackerload', 'showwhatsgoinon', 'showshoutbox', 'waitsystem', 'maxdlsystem', 'newsindex', 'showgoindex', 'pollindex', 'lastxfo', 'lastxto', 'statsindex', 'discindex', 'bitbucket', 'cache', 'showforumstats', 'verification', 'invite_count', 'invite_timeout', 'clegend') ) ;
and change to:
PHP Code:
GetVar( array('site_online', 'max_torrent_size', 'announce_interval', 'signup_timeout', 'minvotes', 'max_dead_torrent_time', 'maxusers', 'torrent_dir', 'announce_urls', 'BASEURL', 'DEFAULTBASEURL', 'MEMBERSONLY', 'PEERLIMIT', 'SITEEMAIL', 'SITENAME', 'autoclean_interval', 'pic_base_url', 'table_cat', 'reportemail', 'invitesystem', 'registration', 'showpolls', 'showstats', 'showlastxforumposts', 'howmuchforum', 'showlastxtorrents', 'howmuchtorrents', 'thowshow', 'showtrackerload', 'showwhatsgoinon', 'showshoutbox', 'waitsystem', 'maxdlsystem', 'newsindex', 'showgoindex', 'pollindex', 'lastxfo', 'lastxto', 'statsindex', 'discindex', 'use_blocks', 'bitbucket', 'cache', 'showforumstats', 'verification', 'invite_count', 'invite_timeout', 'clegend') ) ;
and the last in same file, find:
PHP Code:
$MAIN['discindex'] = $discindex;
below it add:
PHP Code:
$MAIN['use_blocks'] = $use_blocks;
in /include/blocks.php replace:
PHP Code:
if (file_exists ("blocks/".$blockfile."")) { define( 'BLOCK_FILE', 1); require ("blocks/".$blockfile.""); } else { $content = "<center>Block nepostoji!</center>"; }
by this:
PHP Code:
if (file_exists ("fts-contents/blocks/".$blockfile."")) { define( 'BLOCK_FILE', 1); require ("fts-contents/blocks/".$blockfile.""); } else { $content = "<center>Block nepostoji!</center>"; }
still in same file replace:
by this:
PHP Code:
if ($use_blocks == 'yes') {
open /fts-contents/templates/ANDiTKO/head.php and find:
PHP Code:
<?php $fn = substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/") + 1);?>
and replace by:
PHP Code:
<?php $fn = substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/") + 1); if ($blockhide!='left' && $blockhide!='all'){ print("<td valign=\"top\" width=\"155px\">"); show_blocks('l'); print("</td>"); } ?>
in same file find:
PHP Code:
<td align="center" valign="top" class="outer" style="padding-top: 5px; padding-bottom: 5px" width=100%> <?php
below it add:
PHP Code:
if ($blockhide!='center' && $blockhide!='all') show_blocks('c');
open foot.php and below:
add this:
PHP Code:
if ($blockhide!='bottom' && $blockhide!='all') show_blocks('d'); if ($blockhide!='right' && $blockhide!='all'){ print("<td valign=\"top\" width=\"155px\">"); show_blocks('r'); print("</td>"); }
open /include/functions.php find
PHP Code:
function stdhead($title = "", $msgalert = true, $script = "")
change it to:
PHP Code:
function stdhead($title = "", $blockhide = none, $msgalert = true, $script = "")
also change in same file:
to
PHP Code:
function stdfoot($blockhide = none)
If i have not forget somthing, the block system now have to be integrated.
The next thing is we have to create a folder named blocks as subfolder inthe folder fts-content. So please create in /fts-content the folder blocks.
Now we need a file for blocks, so create in /fts-content/blocks/ the file named block-search.php:
PHP Code:
<?php gzip(); if (!defined('BLOCK_FILE')) { Header("Location: ../index.php"); exit; } $blocktitle = "Search"; $content = " <table width=\"100%\"> <tr><td class=\"embedded\"> Torrents <form method=\"get\" action=\"browse.php\"> <input type=\"text\" name=\"search\" size=\"20\" value=\"\" /></td></tr> <tr><td class=\"embedded\" style=\"padding-top: 3px;\"> <input type=\"submit\" value=\"Search\" /></td></tr> </form></table>
<table width=\"100%\"> <tr><td class=\"embedded\"> Offers <form method=\"get\" action=\"viewoffers.php\"> <input type=\"text\" name=\"search\" size=\"20\" value=\"\" /></td></tr> <tr><td class=\"embedded\" style=\"padding-top: 3px;\"> <input type=\"submit\" value=\"Search\" /></form></td></tr> </table>
<table width=\"100%\"> <tr><td class=\"embedded\"> Users <form method="get\" action=\"page.php?\"> <input type=\"hidden\" name=\"type\" value=\"users\"> <input type=\"text\" name=\"search\" size=\"20\" value=\"\"></td></tr> <tr><td class=\"embedded\" style=\"padding-top: 3px;\"> <input type=\"submit\" value=\"Search\" /></form></td></tr> </table>"; ?>
At this point we do not have a function to administrate the blocks, i will post it later when i have finished that.
Therefore add to the database table orbital_blocks:
PHP Code:
INSERT INTO `orbital_blocks` (`bid`, `bkey`, `title`, `content`, `bposition`, `weight`, `active`, `time`, `blockfile`, `view`, `expire`, `action`, `which`) VALUES (102, '', 'Search', '', 'l', 4, 1, '', 'block-search.php', 1, '0', 'd', 'ihome,admincp,staff,upload,my,userdetails,viewrequests,viewoffers,log,faq,rules,message,recover,signup,login,mybonus,invite,bookmarks,');
Congratulations, now you have success added the first block and he will be displayed on the most of your tracker sites.
The next thing I have is to explain you how to disable blocks on selected pages.
Let's imagine we want to turn off the blocks in upload.php. Then you have to change:
to
PHP Code:
stdhead("Upload", "all");
and
to
Which is usable as follows: - "left" = will disable left blocks. which are discribed with a "l", in the column bposition in the table orbital blocks of your database.
- "center" = will disable center blocks. which are discribed with a "c", in the column bposition in the table orbital blocks of your database.
- "right" = will disable right blocks. which are discribed with a "r", in the column bposition in the table orbital blocks of your database.
- "Bottom" = will disable bottom blocks. which are discribed with a "d", in the column bposition in the table orbital blocks of your database.
- "all" = will disable all blocks. it does not mether how they are described, in the column bposition in the table orbital blocks of your database.
At least i thank kp380lv for the explaintation of how to disable blocks on selected sites, YunaScatari which have allready included the blocks system in his source and maybe it is coded by him or his team.
P.S.: It will take a few days before i post the administration script for blocks with FTS, because im very busy at this days.
|