Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=113)
-   -   [FTS 1.1] Integrate the blocks system [beta] (http://www.bvlist.com/showthread.php?t=4066)

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` (
  `
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.

Edgein 27th December 2009 11:05

Nice one m8

i Will test it tonight

happy x mass

grtzz edgein

benjaminbih 27th December 2009 15:04

2 Attachment(s)
@Edgein, take my blocks.php for /include and the /template/html folder with the html files
I have corrected the variables and the path.

At this point its a problem to make the blocks collapsable, if you add
PHP Code:

collapses() 

and
PHP Code:

collapsee() 

to the block files, then the layout of blocks get crashed.
I have spend few hours to get it worked , but it want not work.

Edgein 27th December 2009 17:11

Hey m8 thx it works very good tonight i have more time

to look at THE collapse funcktion

good job

grtzz edgein

yoligim 28th December 2009 01:18

OK, now I can see blocks on the left, I have this:

Search Torrents Offers Users

torrents search works fine, but Users search doesn,t because it gives me a blank page...is anything wrong?


thank you for your great work benjaminbih and Edegein

kind regards

benjaminbih 31st December 2009 23:07

Quote:

Originally Posted by yoligim (Post 18692)
torrents search works fine, but Users search doesn,t because it gives me a blank page...is anything wrong?

here we go.

open /fts-contents/blocks/block-search.php and change:

PHP Code:

   <form method=\"get\" action=\"page.php?type=users&\">
   <input type=\"text\" name=\"search\" size=\"20\" value=\"\" /></td></tr> 

to this

PHP Code:

   <form method=\"get\" action=\"page.php?\">
   <input type=\"hidden\" name=\"type\" value=\"users\">
   <input type=\"text\" name=\"search\" size=\"20\" value=\"\"></td></tr> 




:drink:

By the way:
I get this error in some pages...like admin page

Bump: SearchBlock nepostoji!
yoligim 2nd January 2010 19:51

ok, now works!

putting a slash in front of your code

\"get\" action=\"page.php?\">



All times are GMT +2. The time now is 17:38.

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