<?php
/*
*-------------------------------phpMyBitTorrent--------------------------------*
*--- The Ultimate BitTorrent Tracker and BMS (Bittorrent Management System) ---*
*--------------   Created By Antonio Anzivino (aka DJ Echelon)   --------------*
*-------------               http://www.p2pmania.it               -------------*
*------------ Based on the Bit Torrent Protocol made by Bram Cohen ------------*
*-------------              http://www.bittorrent.com             -------------*
*------------------------------------------------------------------------------*
*------------------------------------------------------------------------------*
*--   This program is free software; you can redistribute it and/or modify   --*
*--   it under the terms of the GNU General Public License as published by   --*
*--   the Free Software Foundation; either version 2 of the License, or      --*
*--   (at your option) any later version.                                    --*
*--                                                                          --*
*--   This program is distributed in the hope that it will be useful,        --*
*--   but WITHOUT ANY WARRANTY; without even the implied warranty of         --*
*--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          --*
*--   GNU General Public License for more details.                           --*
*--                                                                          --*
*--   You should have received a copy of the GNU General Public License      --*
*--   along with this program; if not, write to the Free Software            --*
*-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA --*
*--                                                                          --*
*------------------------------------------------------------------------------*
*------              ©2005 phpMyBitTorrent Development Team              ------*
*-----------               http://phpmybittorrent.com               -----------*
*------------------------------------------------------------------------------*
*/

if (eregi("rewrite.php",$_SERVER["PHP_SELF"])) die ("You can't access this file directly");
$buffer = ob_get_clean();
global $siteurl,$forumbase;
$oldurl = str_replace('/phpBB.php','',$_SERVER["PHP_SELF"]);
$buffer = preg_replace("(&(?!([a-zA-Z]{2,6}|[0-9\#]{1,6})[\;]))", "&amp;", $buffer);
$buffer = str_replace(array("&amp;&amp;", "&amp;middot", "&amp;nbsp"), array("&&", "·", " ;"), $buffer);
$buffer = str_replace(array("&amp;&amp;", "&amp;middot", "&amp;nbsp"), array("&&", "·", " ;"), $buffer);
        $rewrite_search2[] = $_SERVER['DOCUMENT_ROOT'];
        $rewrite_replace2[] = "";
        $rewrite_search2[] = '.php?';
        $rewrite_replace2[] = ".php&amp;";
        $rewrite_search2[] = $forumbase."/";
        $rewrite_replace2[] = "phpBB.php?page=";
        $rewrite_search2[] = $oldurl.'/phpBB.php?page=styles/';
        $rewrite_replace2[] = $siteurl."/".$forumbase."/styles/";
        $rewrite_search2[] = $oldurl.'/phpBB.php?page=../phpBB.php&amp;';
        $rewrite_replace2[] = $oldurl."/phpBB.php?page=ucp.php&amp;";
        $rewrite_search2[] = 'page=ucp.php&amp;page=mcp.php&amp;=&amp;';
        $rewrite_replace2[] = "page=mcp.php&amp;";
        $rewrite_search2[] = 'ucp.php&amp;page=mcp.php&&';
        $rewrite_replace2[] = "mcp.php&amp;";
        $rewrite_search2[] = 'phpBB.php&page=';
        $rewrite_replace2[] = "phpBB.php?page=";
        $rewrite_search2[] = 'phpBB.php&amp;page=';
        $rewrite_replace2[] = "phpBB.php?page=";
        $rewrite_search2[] = $oldurl.'/phpBB.php?page=style.php&amp;sid=';
        $rewrite_replace2[] = $siteurl."/".$forumbase."/style.php?sid=";
        $rewrite_search2[] = $oldurl.'/phpBB.php?page=images/';
        $rewrite_replace2[] = $oldurl."/".$forumbase."/images/";
        $rewrite_search2[] = 'user.php&amp;';
        $rewrite_replace2[] = "user.php?";
		$buffer = str_replace($rewrite_search2,$rewrite_replace2,$buffer);
//Restart Output Buffering again
ob_start("ob_gzhandler");
ob_implicit_flush(0);
echo $buffer;
?>