Kod php:
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="ej_vb_2" active="1">
<title>Thread Stencil</title>
<description>This hack will let you predefine messages for creating new threads in the forums of your choice.</description>
<version>1.3</version>
<codes>
<code version="1.2">
<installcode><![CDATA[$db->hide_errors();
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD (stencilon varchar(10) NOT NULL DEFAULT '')");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD (stenciltitle varchar(50) NOT NULL DEFAULT '')");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD (stencilmsg TEXT NOT NULL DEFAULT '')");
$db->show_errors();]]></installcode>
<uninstallcode><![CDATA[$db->hide_errors();
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum DROP stencilon");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum DROP stenciltitle");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum DROP stencilmsg");
$db->show_errors();
]]></uninstallcode>
</code>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1">
<title>Thread Stencil</title>
<hookname>forumadmin_edit_form</hookname>
<phpcode><![CDATA[print_table_header($vbphrase['forumstencil_title']);
print_yes_no_row($vbphrase['stencilon'], 'forum[stencilon]', $forum['stencilon']);
print_input_row($vbphrase['stenciltitle'], 'forum[stenciltitle]', $forum['stenciltitle']);
print_textarea_row($vbphrase['stencilmsg'], 'forum[stencilmsg]', $forum['stencilmsg']);]]></phpcode>
</plugin>
<plugin active="1">
<title>Thread Stencil</title>
<hookname>forumdata_start</hookname>
<phpcode><![CDATA[$this->validfields['stencilon'] = array(TYPE_BOOL, REQ_NO);
$this->validfields['stenciltitle'] = array(TYPE_STR, REQ_NO);
$this->validfields['stencilmsg'] = array(TYPE_STR, REQ_NO);]]></phpcode>
</plugin>
<plugin active="1">
<title>Thread Stencil</title>
<hookname>newthread_start</hookname>
<phpcode><![CDATA[//check if forums is supposed to have stencil or not
if ($foruminfo['stencilon'])
{
// Write stencil
// Replace [username]
$foruminfo['stenciltitle'] = str_replace("[username]",$vbulletin->userinfo['username'],$foruminfo['stenciltitle']);
$foruminfo['stencilmsg'] = str_replace("[username]",$vbulletin->userinfo['username'],$foruminfo['stencilmsg']);
// Replace [date]
$foruminfo['stenciltitle'] = str_replace("[date]",date("d.m.Y"),$foruminfo['stenciltitle']);
$foruminfo['stencilmsg'] = str_replace("[date]",date("d.m.Y"),$foruminfo['stencilmsg']);
// Replace [ip]
$foruminfo['stenciltitle'] = str_replace("[ip]",$vbulletin->userinfo['ipaddress'],$foruminfo['stenciltitle']);
$foruminfo['stencilmsg'] = str_replace("[ip]",$vbulletin->userinfo['ipaddress'],$foruminfo['stencilmsg']);
$newpost['title'] = $foruminfo['stenciltitle'];
$newpost['message'] = $foruminfo['stencilmsg'];
}]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="Forum-Related" fieldname="forum">
<phrase name="forumstencil_title"><![CDATA[Thread Stencil]]></phrase>
<phrase name="stencilmsg"><![CDATA[<b>Predefined Message</b><br />Output info: [username], [date], [ip].<br /><br />You may apply BB Code.]]></phrase>
<phrase name="stencilon"><![CDATA[<b>Turn On / Off</b><br />Set this to 'yes' to enable the stencil in this forum.]]></phrase>
<phrase name="stenciltitle"><![CDATA[<b>Predefined Title</b><br />Output info: [username], [date].]]></phrase>
</phrasetype>
</phrases>
<options>
</options>
</product>