View Single Post
  #1  
Old 27th December 2009, 03:32
benjaminbih benjaminbih is offline
Senior Member
 
Join Date: Jul 2008
Bosnia-Herzegovina
Posts: 70
Smile [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` (
  `
bidint(10NOT NULL auto_increment,
  `
bkeyvarchar(15NOT NULL default '',
  `
titlevarchar(80NOT NULL default '',
  `
contentmediumtext NOT NULL,
  `
bpositionchar(1NOT NULL default '',
  `
weightint(10NOT NULL default '1',
  `
activeint(1NOT NULL default '1',
  `
timevarchar(14NOT NULL default '0',
  `
blockfilevarchar(255NOT NULL default '',
  `
viewint(1NOT NULL default '0',
  `
expirevarchar(14NOT NULL default '0',
  `
actionchar(1NOT NULL default '',
  `
whichvarchar(255NOT 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')),
        
) ; 
and below it this:
PHP Code:
    tr"Use the blocks system"select("use_blocks",array("yes" => "Yes","no" => "No"),_value('use_blocks')),
        
) ; 
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:
PHP Code:
    if ($use_blocks) { 
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:
PHP Code:
<?php
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:
PHP Code:
function stdfoot() 
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\">
   &nbsp;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\">
   &nbsp;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\">
   &nbsp;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'41'''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:
PHP Code:
stdhead("Upload"); 
to
PHP Code:
stdhead("Upload""all"); 
and
PHP Code:
stdfoot(); 
to
PHP Code:
stdfoot("all"); 
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.

Last edited by benjaminbih; 31st December 2009 at 23:09.
Reply With Quote
The Following User Says Thank You to benjaminbih For This Useful Post:
yoligim (3rd January 2010)