Plugin akcja hostera

Założony przez  Nexack.

Witam. Napisałem swój plugin. Oto jego treść:

<?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
Nie ma kolumny "usercp_room"
Tylko gdzie mam niby ją wstawić? usercp_room powinno być jako wartość "tittle" w templates
Poczytaj o metodzie escape_string w klasach DB MyBB.
Dodawałem po zmiennej $query:

$db->escape_string("INSERT INTO ".TABLE_PREFIX."templates (`title`, `template`, `sid`) VALUES (`usercp_room`, `$query`, `-1`);"); 

Błędów już nie ma, piszę, że plik zainstalowano, lecz nadal:

http://screenshooter.net/8885481/06_11_2012__17_09_46

http://screenshooter.net/8885481/06_11_2012__17_09_52
Obecny kod:

<?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->escape_string("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'");
    
$ch2 $db->fetch_array($ch);
    if(
$ch2['title'] != NULL) {
    return 
true;
    }
    else
    {
    return 
false;
    }
}


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'");
                
$ch2 $db->fetch_array($ch);
                
$ch2w $ch2['wartosc'];
                
$ch2k $ch2['kod'];
                
$brak "Brak Hosta";
                if(
$ch2['info'] != NULL) {
                
                    if(
$ch2['info'] == '$brak') {
                    
$db->query("UPDATE".TABLE_PREFIX."room SET info='$info' WHERE id='0'");
                                    
                
$stalosie "Link zostal zaktualizowany";
                }
                else
                {
                
$stalosie 'Kod jest niepoprawny.';
                }
                }
                
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;
        }
        
    }

}
?>

Błąd jest opisany post wyżej - instaluje się, lecz nadal jest niezainstalowany
hello did you do it? If you can you share with us?
Snake_ napisał 19.05.2015, 18:11:
Try not to refresh the old threads.
Rixos napisał(a):hello did you do it? If you can you share with us?

Have you tried it?
Supryk napisał(a):
Rixos napisał(a):hello did you do it? If you can you share with us?
Have you tried it?
yes it is not working can you do it?
in English
Plugin zainstalowany lecz nadal nie zainstalowany - Post #259389



Użytkownicy przeglądający ten wątek:

1 gości