diff --git a/lib/config.php b/lib/config.php index ee7a326..d6c1130 100644 --- a/lib/config.php +++ b/lib/config.php @@ -67,9 +67,9 @@ function config_write() { $items = $root->createChild("items"); foreach ($_CONFIG['items'] as $item) { - $opts = array_map(function ($opt) { return $opt->name; }, $_MODULES[$item[0]]->opts); - $conf = $items->createChild($item[0]); - $conf->setValue($item[1]); + $opts = array_map(function ($opt) { return $opt->name; }, $_MODULES[$item[1]]->opts); + $conf = $items->createChild($item[1]); + $conf->setValue($item[0]); foreach ($item[2] as $k=>$v) { if (in_array($k,$opts)) { $conf->setAttribute($k,$v); @@ -99,7 +99,7 @@ function config_item_edit($name, array $attr) { global $_CONFIG; $filtered = []; foreach ($_CONFIG['items'] as $item) { - if ($item[1]==$name) { + if ($item[0]==$name) { $item[2] = array_merge($item[2],$attr); } $filtered[] = $item; diff --git a/modules/command.php b/modules/command.php new file mode 100644 index 0000000..0f1d104 --- /dev/null +++ b/modules/command.php @@ -0,0 +1,19 @@ + $opts[COMMAND_CLASS] + ]; + if (($exec = $opts[COMMAND_EXEC])) { + $output = trim(exec($exec)); + } else { + $output = null; + } + return panel($output, $attr, 'command'); +} +module("command", "Execute a command and display the output"); +option("exec",COMMAND_EXEC,OPT_TYPE_STRING,"Command to execute",""); +option("class",COMMAND_CLASS,OPT_TYPE_STRING,"The class to use","system"); \ No newline at end of file