<?php
/*
Copyright 2010 Ping Shin Ching (hide@address.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Project Mugatiya: projectmugatiya.blogspot.com
*/
include 'adds.php';
/*
* If true then bypass content filtering - faster response
* Default add will be 'unclassified'
*/
define('STREAMLINE', false);
/*
* Modify the post parameters and values
*/
function imodpostvalues($url, $host, $post){
return $post;
}
/*
* Modify the response data
*/
include 'contentfilter.php';
function imodresponse(&$output){
global $myhost;
$divheight = 92;
$hideheight = 27;
$hidewidth = 50;
$totaldivheight=($divheight+40);
$external=0;
$bgcolor="";
if(STREAMLINE){
$rating = "U";
}
else{
$rating=getContentRating($output);
}
$adpage=getMyAdd($rating);
if($rating=="G")
$ratingicon="<font class=\\\"prxftxt\\\" style=\\\"background-color:green\\\"> G </font>";
else if($rating=="M")
$ratingicon="<font class=\\\"prxftxt\\\" style=\\\"background-color:blue\\\"> M </font>";
else if($rating=="R")
$ratingicon="<font class=\\\"prxftxt\\\" style=\\\"background-color:red\\\"> R </font>";
else
$ratingicon="<font class=\\\"prxftxt\\\" style=\\\"background-color:#cc9900\\\"> U </font>";
/*Header*/
$head = "<div id=\"add_place_dvx\" style=\"height:".$totaldivheight."px;overflow:hidden\"></div><div scrolling=\"no\" style=\"margin:0 0 0 0;z-index:1000;overflow:hidden;position:absolute;top:0px;left:0px;width:100%;\" id=\"add_link_dvx\"></div>".
"<script>".
"if(top.location==self.location){".
"var x=document.getElementById('add_link_dvx');x.style.height=\"".$totaldivheight."px\";x.visibility=\"visible\";".
"x.innerHTML=\"<table class=\\\"prxtbl\\\" style=\\\"border-width:0;border-collapse:collapse;width:100%;".($bgcolor==""?"":"background-color:#$bgcolor")."\\\">".
"<tr><td><table class=\\\"prxtbl\\\" style=\\\"".($bgcolor==""?"":"background-color:#$bgcolor")."\\\"><tr><td><span class=\\\"prxflnk\\\" id=\\\"add_show_dvx\\\"></span></td><td> </td><td> </td><td><span class=\\\"prxftxt\\\">".getMyProxyTitle()."</span></td><td> </td><td>$ratingicon</td><td style=\\\"width:100%\\\"> </td><td><span class=\\\"prxflnk\\\" id=\\\"add_hide_dvx\\\"><a class=\\\"prxflnk\\\" href=\\\"javascript:hidemeplease()\\\">Hide!</a></span></td><td><img style=\\\"text-align:right;width:30px;border:0\\\" src=\\\"$myhost/spr/menu/ico_prxycore.gif\\\"/></td></tr></table></td></tr>".
"<tr><td><iframe id=\\\"add_link_ifrmx\\\" frameborder=\\\"0\\\" scrolling=\\\"no\\\" class=\\\"prxifrm\\\" src=\\\"$adpage\\\"></iframe></td></tr></table>\";".
"document.getElementById('add_link_ifrmx').style.height=\"".$divheight."px\";".
"}else{".
"document.getElementById('add_place_dvx').style.height=\"0px\";}".
"function hidemeplease(){var x=document.getElementById('add_link_dvx');x.style.height=\"".$hideheight."px\";x.style.width=\"".$hidewidth."px\";var y=document.getElementById('add_place_dvx');y.style.height=\"".$hideheight."px\";y.style.width=\"".$hidewidth."px\"; document.getElementById('add_hide_dvx').innerHTML=\"\";document.getElementById('add_show_dvx').innerHTML=\"<left><a class=\\\"prxflnk\\\" href=\\\"javascript:showmeplease()\\\">Show!</a> <br/><br/></left>\"; }".
"function showmeplease(){var x=document.getElementById('add_link_dvx');x.style.height=\"".$totaldivheight."px\";x.style.width=\"100%\";var y=document.getElementById('add_place_dvx');y.style.height=\"".$totaldivheight."px\";y.style.width=\"100%\";document.getElementById('add_show_dvx').innerHTML=\"\";document.getElementById('add_hide_dvx').innerHTML=\"<a class=\\\"prxflnk\\\" href=\\\"javascript:hidemeplease()\\\">Hide!</a>\";}".
"</script>".
"<noscript>".
"<div style=\"position:absolute;top:0px;left:0px;width:100%\"><table class=\"prxtbl\" style=\"border-width:0;border-collapse:collapse;width:100%;".($bgcolor==""?"":"background-color:#$bgcolor")."\">".
"<tr><td><table class=\"prxtbl\" style=\"".($bgcolor==""?"":"background-color:#$bgcolor")."\"><tr><td><span class=\"prxflnk\" id=\"add_show_dvx\"></span></td><td> </td><td> </td><td><span class=\"prxftxt\">".getMyProxyTitle()."</span></td><td> </td><td>$ratingicon</td><td style=\"width:100%\"> </td><td><span class=\"prxflnk\" id=\"add_hide_dvx\"></span></td><td><img style=\"text-align:right;width:30px;border:0\" src=\"$myhost/spr/menu/ico_prxycore.gif\"/></td></tr></table></td></tr>".
"<tr><td><iframe id=\"add_link_ifrmx\" frameborder=\"0\" scrolling=\"no\" class=\\\"prxifrm\\\" style=\"height:".$divheight."px;width:100%\" src=\"$adpage\"></iframe></td></tr></table></div>".
"</noscript>";
$output=preg_replace("/<\s*\/\s*head\s*>/ims", "<link rel=\"stylesheet\" type=\"text/css\" href=\"$myhost/spr/menu/menu.css\" /></head>", $output);
if(preg_match(SRC_REGX_BODYTAG, $output, $matches)){
$pos=strpos($output, $matches[0]);
if($pos === FALSE)
return $output;
else
return substr_replace($output, $matches[0].$head, $pos, strlen($matches[0]));
}
else
return $output;
}
?>