Thomas Bruederli
2014-12-27 b737021a905a33c8eb4331692475cca7791e533c
Improve plugin selection in installer; check already selected plugins
2 files modified
16 ■■■■■ changed files
installer/config.php 9 ●●●●● patch | view | raw | blame | history
program/include/rcmail_install.php 7 ●●●●● patch | view | raw | blame | history
installer/config.php
@@ -680,10 +680,11 @@
$plugins = $RCI->list_plugins();
foreach($plugins as $p) 
{
    $p_check = new html_checkbox(array('name' => '_plugins_'.$p['name'], 'id' => 'cfgplugin_'.$p['name']));
    echo '<dt class="propname">'.$p['name'].'</dt><dd>';
    echo $p_check->show(0, array('value' => $p['name']));
    echo '<label for="cfgplugin_'.$p['name'].'">'.$p['desc'].'</label><br/></dd>';
    $p_check = new html_checkbox(array('name' => '_plugins_'.$p['name'], 'id' => 'cfgplugin_'.$p['name'], 'value' => $p['name']));
    echo '<dt class="propname"><label>';
    echo $p_check->show($p['enabled'] ? $p['name'] : 0);
    echo '&nbsp;' . $p['name'] . '</label></dt><dd>';
    echo '<label for="cfgplugin_'.$p['name'].'" class="hint">' . $p['desc'] . '</label><br/></dd>';
}
?>
program/include/rcmail_install.php
@@ -578,17 +578,18 @@
    foreach (glob($plugin_dir . '*') as $path) 
    {
      if (is_dir($path) && file_exists($path.'/composer.json'))
      if (is_dir($path) && is_readable($path.'/composer.json'))
      {
        $file_json = json_decode(file_get_contents($path.'/composer.json'));
        $plugin_desc = $file_json->description;
        $plugin_desc = $file_json->description ?: 'N/A';
      }
      else
      {
        $plugin_desc = 'N/A';
      }
      $plugins[] = array('name' => substr($path, strlen($plugin_dir)), 'desc' => $plugin_desc);
      $name = substr($path, strlen($plugin_dir));
      $plugins[] = array('name' => $name, 'desc' => $plugin_desc, 'enabled' => in_array($name, $this->config['plugins']));
    }
    return $plugins;