// Vergleiche plugins aus dem Verzeichnis plugins/ mit den Eintraegen in include/plugins.inc.php
// Wenn ein plugin in der Datei fehlt oder nicht mehr vorhanden ist, aendere den Dateiinhalt.
if (count(array_diff($plugins, OOPlugin::getRegisteredPlugins())) > 0 || count(array_diff(OOPlugin::getRegisteredPlugins(), $plugins)) > 0) {
    if (($state = rex_generateplugins($plugins)) !== true) {
        $warning = $state;
    }
}
if ($info != '') {
    echo rex_info($info);
}
if ($warning != '' && $warning !== true) {
    echo rex_warning($warning);
}
// ----------------- HELPPAGE
if ($function == 'help' && $pluginname != '') {
    $helpfile = rex_plugins_dir($pluginname) . 'help.inc.php';
    echo '<p class="rex-hdl">' . $I18N_COM->msg("plugin_help") . ' ' . $pluginname . '</p>
      <div class="rex-adn-hlp">';
    if (!is_file($helpfile)) {
        echo $I18N_COM->msg("plugin_no_help_file");
    } else {
        include $helpfile;
    }
    echo '</div>
      <p class="rex-hdl"><a href="index.php?page=community&subpage=plugin_manager">' . $I18N_COM->msg("plugin_back") . '</a></p>';
} else {
    echo '
      <table class="rex-table" summary="' . $I18N_COM->msg("plugin_summary") . '">
      <caption class="rex-hide">' . $I18N_COM->msg("plugin_caption") . '</caption>
      <colgroup>
        <col width="40" />
function rex_read_plugins_folder($folder = '')
{
    global $REX;
    if ($folder == '') {
        $folder = rex_plugins_dir();
    }
    $plugins = array();
    $hdl = opendir($folder);
    while (($file = readdir($hdl)) !== false) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        if (is_dir($folder . $file)) {
            $plugins[] = $file;
        }
    }
    closedir($hdl);
    // Sortiere Array
    natsort($plugins);
    return $plugins;
}