When adding code to a plugin, you should bear in mind that your code will have access to all variables and classes that are exposed at the point where the hook is placed.
For example, let us consider this hypothetical hook in a hypothetical script:
<?php
require_once('./global.php');
$foo = 1;
$bar = 2;
($hook = vBulletinHook::fetch_hook('hypothetical_hook')) ? eval($hook) : false;
eval('print_output("' . fetch_template('hypothetical_template') . '");');
?>
We will now add a plugin to the hypothetical_hook hook, using this code:
if ($_SERVER['REMOTE_ADDR'] == '192.168.0.1')
{
$foo = 10;
$bar = 20;
}
<?php require_once('./global.php'); $foo = 1; $bar = 2; if ($_SERVER['REMOTE_ADDR'] == '192.168.0.1') { $foo = 10; $bar = 20; } eval('print_output("' . fetch_template('hypothetical_template') . '");'); ?>
eval('print_output("' . fetch_template('hypothetical_template) . '");');
Should it be:
eval('print_output("' . fetch_template('hypothetical_template') . '");');