function rex_generatePlugins($plugins)
{
    global $REX;
    natsort($plugins);
    $content = "";
    foreach ($plugins as $cur) {
        if (!OOPlugin::isInstalled($cur)) {
            OOPlugin::setProperty($cur, 'install', 0);
        }
        if (!OOPlugin::isActivated($cur)) {
            OOPlugin::setProperty($cur, 'status', 0);
        }
        $content .= sprintf("%s = %d;\n%s = %d;\n\n", OOPlugin::getAsPropertyString($cur, 'install'), OOPlugin::getProperty($cur, 'install'), OOPlugin::getAsPropertyString($cur, 'status'), OOPlugin::getProperty($cur, 'status'));
    }
    $content .= sprintf("\$REX['ADDON']['pluginlist']['community'] = \"%s\";", implode(',', OOPlugin::getRegisteredPlugins()));
    // Da dieser Funktion öfter pro request aufgerufen werden kann,
    // hier die caches löschen
    clearstatcache();
    $file = rex_plugins_file();
    if (!rex_replace_dynamic_contents($file, $content)) {
        return 'Datei "' . $file . '" hat keine Schreibrechte';
    }
    return true;
}
/**
 * Schreibt Plugineigenschaften in die Datei include/plugins.inc.php
 *
 * @param array Array mit den Namen der Plugins aus dem Verzeichnis addons/plugins
 *
 * @return TRUE bei Erfolg, sonst eine Fehlermeldung
 */
function rex_generatePlugins($PLUGINS)
{
    global $REX;
    $content = '';
    foreach ($PLUGINS as $addon => $_plugins) {
        foreach ($_plugins as $plugin) {
            if (!OOPlugin::isInstalled($addon, $plugin)) {
                OOPlugin::setProperty($addon, $plugin, 'install', 0);
            }
            if (!OOPlugin::isActivated($addon, $plugin)) {
                OOPlugin::setProperty($addon, $plugin, 'status', 0);
            }
            foreach (array('install', 'status') as $prop) {
                $content .= sprintf("\$REX['ADDON']['plugins']['%s']['%s']['%s'] = '%d';\n", $addon, $prop, $plugin, OOPlugin::getProperty($addon, $plugin, $prop));
            }
            $content .= "\n";
        }
    }
    // Da dieser Funktion öfter pro request aufgerufen werden kann,
    // hier die caches löschen
    clearstatcache();
    $file = $REX['INCLUDE_PATH'] . '/plugins.inc.php';
    if (rex_replace_dynamic_contents($file, $content) === false) {
        return 'Datei "' . $file . '" hat keine Schreibrechte';
    }
    return true;
}
Esempio n. 3
0
    $REX['ADDON']['navigation'][$mypage] = array('activateCondition' => array('page' => $mypage, 'subpage' => 'manager'), 'hidden' => false);
    if ($REX['USER'] && !$REX['USER']->isAdmin()) {
        $REX['ADDON']['navigation'][$mypage]['hidden'] = true;
    }
    $REX['ADDON']['xform']['SUBPAGES'][] = array('manager', $I18N->msg('xform_table_manager'));
    rex_register_extension('OOMEDIA_IS_IN_USE', 'rex_xform_manager::checkMediaInUse');
    rex_register_extension('ADDONS_INCLUDED', function () {
        global $REX, $I18N;
        $tables = rex_xform_manager_table::getAll();
        $subpages = array();
        foreach ($tables as $table) {
            $table_perm = 'xform[table:' . $table['table_name'] . ']';
            $REX['EXTPERM'][] = $table_perm;
            if ($table['status'] == 1 && $table['hidden'] != 1 && $REX['USER'] && ($REX['USER']->isAdmin() || $REX['USER']->hasPerm($table_perm))) {
                $table_name = rex_translate($table['name']);
                if ($I18N) {
                    $I18N->addMsg($table['table_name'], $table_name);
                }
                $be_page = new rex_be_page($table_name, array('page' => 'xform', 'subpage' => 'manager', 'tripage' => 'data_edit', 'table_name' => $table['table_name']));
                $be_page->setHref('index.php?page=xform&subpage=manager&tripage=data_edit&table_name=' . $table['table_name']);
                $subpages[] = new rex_be_main_page('manager', $be_page);
            }
        }
        $subpages = rex_register_extension_point('XFORM_MANAGER_SUBPAGES_TABLES', $subpages);
        OOPlugin::setProperty('xform', 'manager', 'pages', $subpages);
    });
    // hack - if data edit, then deactivate xform navigation
    if (rex_request('tripage', 'string') == 'data_edit') {
        $REX['ADDON']['navigation']['xform'] = array('activateCondition' => array('page' => 'xformmm'), 'hidden' => false);
    }
}