MyBB Community Forums

Full Version: plugin error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
<?php
/**
* Author: Shahaab
* Copyright: © 2010 Shahaab
* Website: http://www.mybbz.net
* License: http://www.mybbz.net/license.php
**/

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Plugin info
function tsp_info()
{
	return array(
		"name"			=> "Timed Splash Page",
		"description"	=> "This plugin will add a splash page with an auto timer.",
		"website"		=> "http://www.mybbz.net",
		"author"		=> "Shahaab",
		"authorsite"	=> "http://www.mybbz.net",
		"version"		=> "1.0",
		"compatibility" => "16*"
	);

}

// Activate plugin
function tsp_activate()
{
	global $db, $mybb;

// Editing Template
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("header", "#".preg_quote('<navigation>')."#i", '<navigation>
<style type="text/css">
#sponsorAdDiv {position:absolute; height:1; width:1px; top:0; left:0;}
</style>
<script type="text/javascript">
adTime={$mybb->settings[\'tsp_timer\']};
chanceAd=1;
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
var calunit=ns? "" : "px"
adCount=0;
function initAd(){
	if(!ns && !ie && !w3) return;
	if(ie)		adDiv=eval(\'document.all.sponsorAdDiv.style\');
	else if(ns)	adDiv=eval(\'document.layers["sponsorAdDiv"]\');
	else if(w3)	adDiv=eval(\'document.getElementById("sponsorAdDiv").style\');
	randAd=Math.ceil(Math.random()*chanceAd);
        if (ie||w3)
        adDiv.visibility="visible";
        else
        adDiv.visibility ="show";
	if(randAd==1) showAd();
}
function showAd(){
if(adCount<adTime*10){adCount+=1;
	if (ie){documentWidth  =truebody().offsetWidth/2+truebody().scrollLeft-20;
	documentHeight =truebody().offsetHeight/2+truebody().scrollTop-20;}	
	else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
	documentHeight=window.innerHeight/2+window.pageYOffset-20;} 
	else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
	documentHeight=self.innerHeight/2+window.pageYOffset-20;} 
	adDiv.left=documentWidth-200+calunit;adDiv.top =documentHeight-200+calunit;
	setTimeout("showAd()",100);}else closeAd();
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
onload=initAd;
</script>
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="450px" height="350px" bgcolor="#1CCCFF">
<tr>
<td>
<table width="445px" height="345px" bgcolor="#E8FAFF">
<tr>
<td align="center" valign="middle">
{$mybb->settings[\'tsp_content\']}
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>');

	$tsp_group = array(
		"gid"			=> "NULL",
		"name"			=> "tsp",
		"title" 		=> "Timed Splash Page",
		"description"	=> "Here you can manage T.S.P. extensively.",
		"disporder"		=> "1",
		"isdefault"		=> "no",
	);
	$db->insert_query("settinggroups", $tsp_group);
	$gid = $db->insert_id();
	
	$tsp_setting_1 = array(
		"sid"			=> "NULL",
		"name"			=> "tsp_timer",
		"title"			=> "T.S.P. Timer Countdown",
		"description"	=> "Please enter a value for Auto Close Splash Page. (in seconds)",
		"optionscode"	=> "text",
		"value"			=> "5",
		"disporder"		=> "1",
		"gid"			=> intval($gid),
	);

	$db->insert_query("settings", $tsp_setting_1);

	$tsp_setting_2 = array(
		"sid"			=> "NULL",
		"name"			=> "tsp_content",
		"title"			=> "T.S.P. Content",
		"description"	=> "Please enter content you would like to show in splash page. (HTML Enabled)",
		"optionscode"	=> "textarea",
		"value"			=> "",
		"disporder"		=> "2",
		"gid"			=> intval($gid),
	);
	
	$db->insert_query("settings", $tsp_setting_2);
	
	// Rebuilding settings
    rebuildsettings();
}

// Deactivate plugin
function tsp_deactivate()
{
	global $db, $mybb;

include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("header", "#".preg_quote('<style type="text/css">
#sponsorAdDiv {position:absolute; height:1; width:1px; top:0; left:0;}
</style>
<script type="text/javascript">
adTime={$mybb->settings[\'tsp_timer\']};
chanceAd=1;
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
var calunit=ns? "" : "px"
adCount=0;
function initAd(){
	if(!ns && !ie && !w3) return;
	if(ie)		adDiv=eval(\'document.all.sponsorAdDiv.style\');
	else if(ns)	adDiv=eval(\'document.layers["sponsorAdDiv"]\');
	else if(w3)	adDiv=eval(\'document.getElementById("sponsorAdDiv").style\');
	randAd=Math.ceil(Math.random()*chanceAd);
        if (ie||w3)
        adDiv.visibility="visible";
        else
        adDiv.visibility ="show";
	if(randAd==1) showAd();
}
function showAd(){
if(adCount<adTime*10){adCount+=1;
	if (ie){documentWidth  =truebody().offsetWidth/2+truebody().scrollLeft-20;
	documentHeight =truebody().offsetHeight/2+truebody().scrollTop-20;}	
	else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
	documentHeight=window.innerHeight/2+window.pageYOffset-20;} 
	else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
	documentHeight=self.innerHeight/2+window.pageYOffset-20;} 
	adDiv.left=documentWidth-200+calunit;adDiv.top =documentHeight-200+calunit;
	setTimeout("showAd()",100);}else closeAd();
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}
function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
onload=initAd;
</script>
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="450px" height="350px" bgcolor="#1CCCFF">
<tr>
<td>
<table width="445px" height="345px" bgcolor="#E8FAFF">
<tr>
<td align="center" valign="middle">
{$mybb->settings[\'tsp_content\']}
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>')."#i", '', 0);

	$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='tsp'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tsp_timer'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='tsp_content'");
	
	// Rebuilding settings
    rebuildsettings();
}

?>


i install this plugin,worked ok. but when deactivate shows this error.

header tamplates damaged and forum goes in centre
" Powered By medicinari.com MyBB, © 2002-2011 MyBB Group. " <--
can you please remove that other site & put it somewhere else ...

AND that plugin is not correctly coded ; it is from an external site - support should be sought there !!
yes i download from here...

http://forum.mybbz.net/showthread.php?tid=459&page=1


i post and requeast for help but no reply, even myybb used for forum.

please help ,its a request.
thanks
one should have a local installation / test board to test plug-ins !!
should install, activate, test, de-activate, check forums, again re-activate ...

AND also one should not blindly install all the fancy plug-ins. first see what others
are saying about it ( either at plug-in release thread OR at comments / reviews ) ..


i will take care in future.
(2011-08-16, 08:06 AM)musabhaiji Wrote: [ -> ]i will take care in future.

why have u added a random address in the copyright ok its allowed but i mean atleast add it some where pretty like under neith it not in middle of the copyright Big Grin

+1 on test forum though thats what i do i got dev.xxx.co.uk and xxx.co.uk where xxx is not for you to knowBig Grin

your site has way to many ads and makes it ugly no1 is gonna wanna visit that site for long Big Grin

^ thank you for expressing your feelings Smile
You should be informed that Shahaab, Ghazal, Imran Omer and few other usernames have been banned from MyBB.com and many other forums for good reasons! Mostly because they are the same person with multiple usernames and doing illegal actions and bad coding. I would not be surprised to know that Omer Khan was another username for that person...

mybbz.net was created by that person from Pakistan(Imran Omer Shahab ubaide), I would strongly recommend to search MyBB.com for details about this and stay away from that person and its plugins!

Like the other members wrote, it is always prudent to search for reviews or comments about an author before installing their scripts... Wink
(2011-08-18, 07:13 PM)ranjani Wrote: [ -> ]^ thank you for expressing your feelings Smile

sorry but i had to i visited that site and waw like :@ i wish my was adblock enabled Big Grin