Witam. Napisałem swój plugin. Oto jego treść:
Niestety, podczas instalacji MyBB wywala błąd:
http://screenshooter.net/6689886/05_11_2012__22_38_51
Może ktoś wie co zrobiłem źle? ;X
Z góry dziękuję za pomoc
<?php
/*
@------------------------------------------@
| Room Link 1.0 PLUGIN |
| BY Nexack |
@------------------------------------------@
*/
if(!defined("IN_MYBB"))
{
die("Nie tak! Plik powinien zostac wlczony za pomoca MyBB!");
}
$plugins->add_hook("usercp_start", "wpanelu1");
function room_info()
{
return array(
"name" => "Room Link",
"description" => "Menu Hostera - Room Link</b>",
"website" => "http://haxball-manager.pl/",
"author" => "Nexack",
"authorsite" => "http://haxball-manager.pl/",
"version" => "1.0",
);
}
function room_install()
{
global $db;
$query2 = " CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."room` (
`id` varchar(15) NOT NULL default '0',
`info` varchar(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
$db->query($query2);
$query = '<html>
<head>
<title>{$lang->user_cp}</title>
{$headerinclude}
</head>
<body>
{$header}
<style type="text/css">
._info {
background-color:#FFFACD;
border: 1px solid #DAA520;
width: 30%;
margin: 2px;
}
</style>
<table width="100%" border="0" align="center">
<tr>
{$usercpnav}
<td valign="top">
<table border="0" cellspacing="{$theme[\\\'borderwidth\\\']}" cellpadding="{$theme[\\\'tablespace\\\']}" class="tborder">
<tr>
<td class="thead" colspan="{$colspan}"><strong>Panel Hostera</strong></td>
</tr>
<tr>
{$avatar}
<td class="trow2">
<center><br />Witaj <strong>{$username}</strong>,<br /><br />
<p>Podaj link room lub zaznacz, ze go nie ma</p>
</center>
</td>
</tr>
<tr>
<td class="trow2">
<center><form action="./usercp.php?action=do_room" method="post">
Wprowadz link:
<input type="radio" name="info" onclick="document.getElementById(\'identyfikator\').style.display = this.checked ? \'block\' : \'none\'; this.form.elements[\'info\'].disabled = !this.checked" />
<div id="identyfikator" style="display: none">
<input type="text" name="info" />
</div>
<br />
Brak Hosta:
<input type="radio" name="info" value="Brak Hosta" onclick="document.getElementById(\'identyfikator\').style.display = this.checked ? \'none\' : \'block\'; this.form.elements[\'info\'].disabled = this.checked" />
<input type="submit" name="poszlo" value="Wyslij!" /></form>{$informacja}</center>
</td>
</tr>
</table>
{$latest_subscribed}
{$latest_threads}
{$latest_warnings}
{$user_notepad}
</td>
</tr>
</table>
{$footer}
</body>
</html>';
$db->query("INSERT INTO ".TABLE_PREFIX."templates (`title`, `template`, `sid`) VALUES (`usercp_room`, `$query`, `-1`)");
}
function room_uninstall()
{
global $db;
$db-->query("DROP TABLE ".TABLE_PREFIX."room RESTRICT");
}
function room_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='usercp_room'");
}
function room_is_installed()
{
global $db;
$ch = $db->query("SELECT * FROM ".TABLE_PREFIX."templates WHERE title='usercp_room'");
}
function wpanelu1($page)
{
global $header, $headerinclude, $usercpnav, $footer, $mybb, $theme, $db, $lang, $templates;
if(THIS_SCRIPT == "usercp.php")
{
if($mybb->input['action'] == "room" || $mybb->input['action'] == "do_room")
{
if($mybb->input['action'] == "room")
{
add_breadcrumb($lang->nav_usercp, "usercp.php");
add_breadcrumb("Host Panel");
$username = $mybb->user['username'];
eval("\$usercp_room = \"".$templates->get("usercp_room")."\";");
output_page($usercp_room);
}
if($mybb->input['action'] == "do_room")
{
add_breadcrumb($lang->nav_usercp, "usercp.php");
add_breadcrumb("Host Panel");
$username = $mybb->user['username'];
$info = $_POST['info'];
$ch = $db->query("UPDATE".TABLE_PREFIX."room SET info='$info' WHERE id='0'");
$stalosie = "Link zosta?zaktualizowany";
output_page('<html><head><script type="text/javascript">
alert("'.$stalosie.'");
document.location="http://haxball-manager.pl/usercp.php?action=room";
</script></head><body>
</body></html>');
}
}
else
{
return;
}
}
}
?>
Niestety, podczas instalacji MyBB wywala błąd:
http://screenshooter.net/6689886/05_11_2012__22_38_51
Może ktoś wie co zrobiłem źle? ;X
Z góry dziękuję za pomoc