Release diogenes-0.9.22
[diogenes.git] / htdocs / toplevel / plugins.php
CommitLineData
6855525e
JL
1<?php
2require_once 'diogenes.common.inc.php';
3require_once 'diogenes.toplevel.inc.php';
4require_once 'Plugin/Editor.php';
5
6$page = new $globals->toplevel(true);
7$page->assign('post',$page->script_self());
8
9$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
10$barrel = isset($_REQUEST['plug_barrel']) ? $_REQUEST['plug_barrel'] : '';
11
12if ($action == "clean")
13{
14 $globals->plugins->clean_database($page);
15}
16
17if ($barrel)
18{
19 $page->assign('greeting',__("Barrel plugins") . " - $barrel");
20} else {
21 $page->assign('greeting',__("Global plugin settings"));
22}
23
24/* plugin editor */
25$editor = new Diogenes_Plugin_Editor($barrel, 0);
26$editor->hide_params(1);
27$editor->run($page,'editor_content');
28
29// if necessary, rebuild site plugin caches
30if ($action == "update" && !$barrel)
31{
32 $res = $globals->db->query("select alias,flags from diogenes_site");
33 while (list($p_alias, $p_flags) = mysql_fetch_row($res))
34 {
35 $flags = new flagset($p_flags);
36 if ($p_alias && $flags->hasFlag('plug'))
37 {
38 $page->info(sprintf( __("Rebuilding plugin cache for barrel '%s'"), $p_alias));
39 $cachefile = $globals->plugins->cacheFile($p_alias);
40 $globals->plugins->compileCache($cachefile, $p_alias);
41 }
42 }
43 mysql_free_result($res);
44}
45
46// translations
47$page->assign('msg_clean_database', __('Clean plugins database'));
48$page->assign('msg_clean_database_text', __("If you are having problems with references to plugins that no longer exist, you can have Diogenes remove such entries from the database."));
49$page->assign('msg_clean', __("Clean"));
50
51$page->assign('msg_enable_disable', __('Enable or disable plugins'));
52if ($barrel)
53{
54 $page->assign('msg_enable_disable_text', __("You can select the plugins you want to enable for this barrel."));
55} else {
56 $page->assign('msg_enable_disable_text', __("You can select the plugins you want to enable or disable globally, that is the plugins that can be used in the different barrels. Please note that for a plugin to be accessible from a barrel, you will need to activate that plugin for the barrel. To do this, from the <i>List of sites</i> click on 'plugins' next to the barrel of your choice."));
57}
58$page->display('toplevel-plugins.tpl');
59
60?>