'.html_print_image(
$img,
true
);
$msg .= '
'.__(
'Warning, you are accessing the database directly. You can leave the system inoperative if you run an inappropriate SQL statement'
).'
';
$warning_message = '';
if (empty($sql) === true) {
echo $warning_message;
}
echo "';
// Processing SQL Code.
if ($sql == '') {
return;
}
echo '
';
echo '
';
echo '
';
try {
if (\is_metaconsole() === true && $node_id !== -1) {
$node = new Node($node_id);
$dbconnection = @get_dbconnection(
[
'dbhost' => $node->dbhost(),
'dbport' => $node->dbport(),
'dbname' => $node->dbname(),
'dbuser' => $node->dbuser(),
'dbpass' => $node->dbpass(),
]
);
$error = '';
$result = dbmanager_query($sql, $error, $dbconnection);
} else {
$dbconnection = $config['dbconnection'];
$error = '';
$result = dbmanager_query($sql, $error, $dbconnection);
}
} catch (\Exception $e) {
$error = __('Error querying database node');
$result = false;
}
if ($result === false) {
echo 'An error has occured when querying the database.
';
echo $error;
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. Error in SQL',
false,
false,
$sql
);
return;
}
if (is_array($result) === false) {
echo 'Output: '.$result;
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. SQL',
false,
false,
$sql
);
return;
}
echo "";
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->head = array_keys($result[0]);
$table->data = $result;
html_print_table($table);
echo '
';
if (is_metaconsole()) {
close_meta_frame();
}
}
if (is_metaconsole() === true) {
// This adds a option in the operation menu.
extensions_add_meta_menu_option(
'DB interface',
'PM',
'gextensions',
'database.png',
'v1r1',
'gdbman'
);
extensions_add_meta_function('dbmgr_extension_main');
}
// This adds a option in the operation menu.
extensions_add_godmode_menu_option(__('DB interface'), 'PM', 'gextensions', 'dbmanager/icon.png', 'v1r1', 'gdbman');
// This sets the function to be called when the extension is selected in the operation menu.
extensions_add_godmode_function('dbmgr_extension_main');