__('Plugins'),
'url' => 'server_plugins.php'
),
array(
'name' => __('Modules'),
'url' => 'server_modules.php'
)
);
$retval = '
';
$retval .= '';
return $retval;
}
/**
* Returns the common SQL used to retrieve plugin and modules data
*
* @return string SQL
*/
function PMA_getServerPluginModuleSQL()
{
return "SELECT p.plugin_name, p.plugin_type, p.is_active, m.module_name,
m.module_library, m.module_version, m.module_author,
m.module_description, m.module_license
FROM data_dictionary.plugins p
JOIN data_dictionary.modules m USING (module_name)
ORDER BY m.module_name, p.plugin_type, p.plugin_name";
}
/**
* Returns details about server plugins
*
* @return array server plugins data
*/
function PMA_getServerPlugins()
{
$sql = PMA_getServerPluginModuleSQL();
$res = $GLOBALS['dbi']->query($sql);
$plugins = array();
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
$plugins[$row['plugin_type']][] = $row;
}
$GLOBALS['dbi']->freeResult($res);
ksort($plugins);
return $plugins;
}
/**
* Returns details about server modules
*
* @return array server modules data
*/
function PMA_getServerModules()
{
$sql = PMA_getServerPluginModuleSQL();
$res = $GLOBALS['dbi']->query($sql);
$modules = array();
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
$modules[$row['module_name']]['info'] = $row;
$modules[$row['module_name']]['plugins'][$row['plugin_type']][] = $row;
}
$GLOBALS['dbi']->freeResult($res);
return $modules;
}
/**
* Returns the html for plugin Tab.
*
* @param Array $plugins list
*
* @return string
*/
function PMA_getPluginTab($plugins)
{
$html = '';
$html .= '
';
foreach ($plugins as $plugin_type => $plugin_list) {
$key = 'plugins-'
. preg_replace('/[^a-z]/', '', /*overload*/mb_strtolower($plugin_type));
$html .= '
'
. htmlspecialchars($plugin_type) . '' . "\n";
}
$html .= '
';
$html .= '
';
foreach ($plugins as $plugin_type => $plugin_list) {
$key = 'plugins-'
. preg_replace('/[^a-z]/', '', /*overload*/mb_strtolower($plugin_type));
sort($plugin_list);
$html .= '
';
$html .= '';
$html .= '';
$html .= '';
$html .= '' . __('Plugin') . ' | ';
$html .= '' . __('Module') . ' | ';
$html .= '' . __('Library') . ' | ';
$html .= '' . __('Version') . ' | ';
$html .= '' . __('Author') . ' | ';
$html .= '' . __('License') . ' | ';
$html .= '
';
$html .= '';
$html .= '';
$html .= PMA_getPluginList($plugin_list);
$html .= '';
$html .= '
';
}
$html .= '
';
return $html;
}
/**
* Returns the html for plugin List.
*
* @param Array $plugin_list list
*
* @return string
*/
function PMA_getPluginList($plugin_list)
{
$html = "";
$odd_row = false;
foreach ($plugin_list as $plugin) {
$odd_row = !$odd_row;
$html .= '';
$html .= '' . htmlspecialchars($plugin['plugin_name']) . ' | ';
$html .= '' . htmlspecialchars($plugin['module_name']) . ' | ';
$html .= '' . htmlspecialchars($plugin['module_library']) . ' | ';
$html .= '' . htmlspecialchars($plugin['module_version']) . ' | ';
$html .= '' . htmlspecialchars($plugin['module_author']) . ' | ';
$html .= '' . htmlspecialchars($plugin['module_license']) . ' | ';
$html .= '
';
}
return $html;
}
/**
* Returns the html for Module Tab.
*
* @param Array $modules list
*
* @return string
*/
function PMA_getModuleTab($modules)
{
$html = '';
$html .= '
';
$html .= '';
$html .= '';
$html .= '' . __('Module') . ' | ';
$html .= '' . __('Description') . ' | ';
$html .= '' . __('Library') . ' | ';
$html .= '' . __('Version') . ' | ';
$html .= '' . __('Author') . ' | ';
$html .= '' . __('License') . ' | ';
$html .= '
';
$html .= '';
$html .= '';
$html .= PMA_getModuleList($modules);
$html .= '';
$html .= '
';
$html .= '
';
return $html;
}
/**
* Returns the html for module List.
*
* @param Array $modules list
*
* @return string
*/
function PMA_getModuleList($modules)
{
$html = "";
$odd_row = false;
foreach ($modules as $module_name => $module) {
$odd_row = !$odd_row;
$html .= '';
$html .= '' . htmlspecialchars($module_name) . ' | ';
$html .= '' . htmlspecialchars($module['info']['module_description'])
. ' | ';
$html .= '' . htmlspecialchars($module['info']['module_library'])
. ' | ';
$html .= '' . htmlspecialchars($module['info']['module_version'])
. ' | ';
$html .= '' . htmlspecialchars($module['info']['module_author'])
. ' | ';
$html .= '' . htmlspecialchars($module['info']['module_license'])
. ' | ';
$html .= '
';
$html .= '';
$html .= '';
$html .= '';
$html .= '';
foreach ($module['plugins'] as $plugin_type => $plugin_list) {
$html .= '';
$html .= ''
. htmlspecialchars($plugin_type) . ' | ';
$html .= '';
for ($i = 0, $nb = count($plugin_list); $i < $nb; $i++) {
$html .= ($i != 0 ? ' ' : '')
. htmlspecialchars($plugin_list[$i]['plugin_name']);
if (!$plugin_list[$i]['is_active']) {
$html .= ' ' . __('disabled')
. '';
}
}
$html .= ' | ';
$html .= ' ';
}
$html .= '';
$html .= ' ';
$html .= ' | ';
$html .= '
';
}
return $html;
}