From 0344b168276f80189e2254c75a762aff5b517b6b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 06:32:57 -0400
Subject: [PATCH] Fix priority icon(s) position

---
 program/steps/settings/about.inc |  186 +++++++++++++++++++---------------------------
 1 files changed, 78 insertions(+), 108 deletions(-)

diff --git a/program/steps/settings/about.inc b/program/steps/settings/about.inc
index 147b9b8..eac57ca 100644
--- a/program/steps/settings/about.inc
+++ b/program/steps/settings/about.inc
@@ -1,12 +1,12 @@
 <?php
 
-/*
+/**
  +-----------------------------------------------------------------------+
  | program/steps/settings/about.inc                                      |
  |                                                                       |
  | This file is part of the Roundcube Webmail client                     |
- | Copyright (C) 2005-2011, The Roundcube Dev Team                       |
- | Copyright (C) 2011, Kolab Systems AG                                  |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
+ | Copyright (C) 2011-2013, Kolab Systems AG                             |
  |                                                                       |
  | Licensed under the GNU General Public License version 3 or            |
  | any later version with exceptions for skins & plugins.                |
@@ -18,116 +18,86 @@
  +-----------------------------------------------------------------------+
  | Author: Aleksander Machniak <alec@alec.pl>                            |
  +-----------------------------------------------------------------------+
-
- $Id: identities.inc 4410 2011-01-12 18:25:02Z thomasb $
-
 */
 
 
-function rcmail_supportlink($attrib)
-{
-  global $RCMAIL;
-
-  if ($url = $RCMAIL->config->get('support_url')) {
-    $label = $attrib['label'] ? $attrib['label'] : 'support';
-    $attrib['href'] = $url;
-    return html::a($attrib, rcube_label($label));
-  }
-}
-
-function rcmail_plugins_list($attrib)
-{
-  global $RCMAIL;
-
-  if (!$attrib['id'])
-    $attrib['id'] = 'rcmpluginlist';
-
-  $plugins = array_filter((array) $RCMAIL->config->get('plugins'));
-  $plugins = array_flip($plugins);
-
-  foreach ($plugins as $name => $plugin) {
-    rcube_plugin_data($name, $plugins);
-  }
-
-  if (empty($plugins)) {
-    return '';
-  }
-
-  ksort($plugins, SORT_LOCALE_STRING);
-
-  $table = new html_table($attrib);
-
-  // add table header
-  $table->add_header('name', rcube_label('plugin'));
-  $table->add_header('version', rcube_label('version'));
-  $table->add_header('license', rcube_label('license'));
-  $table->add_header('source', rcube_label('source'));
-
-  foreach ($plugins as $name => $data) {
-    $uri = $data['srcuri'] ? $data['srcuri'] : $data['uri'];
-    if ($uri && stripos($uri, 'http') !== 0) {
-      $uri = 'http://' . $uri;
-    }
-
-    $table->add_row();
-    $table->add('name', Q($data['name'] ? $data['name'] : $name));
-    $table->add('version', Q($data['version']));
-    $table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> Q($data['license_uri'])),
-        Q($data['license'])) : $data['license']);
-    $table->add('source', $uri ? html::a(array('target' => '_blank', href=> Q($uri)),
-        Q(rcube_label('download'))) : '');
-  }
-
-  return $table->show();
-}
-
-function rcube_plugin_data($name, &$plugins = array())
-{
-  // XPaths of plugin metadata elements
-  $metadata = array(
-    'name'    => 'string(//rc:package/rc:name)',
-    'version' => 'string(//rc:package/rc:version/rc:release)',
-    'license' => 'string(//rc:package/rc:license)',
-    'license_uri' => 'string(//rc:package/rc:license/@uri)',
-    'srcuri' => 'string(//rc:package/rc:srcuri)',
-    'uri' => 'string(//rc:package/rc:uri)',
-  );
-
-  $package = INSTALL_PATH . "/plugins/$name/package.xml";
-  if (file_exists($package) && ($file = file_get_contents($package))) {
-    $doc = new DOMDocument();
-    $doc->loadXML($file);
-    $xpath = new DOMXPath($doc);
-    $xpath->registerNamespace('rc', "http://pear.php.net/dtd/package-2.0");
-    $data = array();
-
-    foreach ($metadata as $key => $path) {
-      $data[$key] = $xpath->evaluate($path);
-    }
-console($name);
-    $plugins[$name] = $data;
-
-    // dependent required plugins (can be used, but not included in config)
-    $deps = $xpath->evaluate('//rc:package/rc:dependencies/rc:required/rc:package/rc:name');
-    $cnt  = $deps->length;
-
-    for ($i=0; $i<$cnt; $i++) {
-      $dn = $deps->item($i)->nodeValue;
-console($dn);
-      if (!array_key_exists($dn, $plugins)) {
-        rcube_plugin_data($dn, $plugins);
-      }
-    }
-  }
-  else {
-    unset($plugins[$name]);
-  }
-}
-
-
-$OUTPUT->set_pagetitle(rcube_label('about'));
+$OUTPUT->set_pagetitle($RCMAIL->gettext('about'));
 
 $OUTPUT->add_handler('supportlink', 'rcmail_supportlink');
 $OUTPUT->add_handler('pluginlist', 'rcmail_plugins_list');
 
 $OUTPUT->send('about');
+
+
+
+function rcmail_supportlink($attrib)
+{
+    global $RCMAIL;
+
+    if ($url = $RCMAIL->config->get('support_url')) {
+        $label = $attrib['label'] ?: 'support';
+        $attrib['href'] = $url;
+
+        return html::a($attrib, $RCMAIL->gettext($label));
+    }
+}
+
+function rcmail_plugins_list($attrib)
+{
+    global $RCMAIL;
+
+    if (!$attrib['id']) {
+        $attrib['id'] = 'rcmpluginlist';
+    }
+
+    $plugins     = array_filter($RCMAIL->plugins->active_plugins);
+    $plugin_info = array();
+
+    foreach ($plugins as $name) {
+        if ($info = $RCMAIL->plugins->get_info($name)) {
+            $plugin_info[$name] = $info;
+        }
+    }
+
+    // load info from required plugins, too
+    foreach ($plugin_info as $name => $info) {
+        if (is_array($info['require']) && !empty($info['require'])) {
+            foreach ($info['require'] as $req_name) {
+                if (!isset($plugin_info[$req_name]) && ($req_info = $RCMAIL->plugins->get_info($req_name))) {
+                    $plugin_info[$req_name] = $req_info;
+                }
+            }
+        }
+    }
+
+    if (empty($plugin_info)) {
+        return '';
+    }
+
+    ksort($plugin_info, SORT_LOCALE_STRING);
+
+    $table = new html_table($attrib);
+
+    // add table header
+    $table->add_header('name', $RCMAIL->gettext('plugin'));
+    $table->add_header('version', $RCMAIL->gettext('version'));
+    $table->add_header('license', $RCMAIL->gettext('license'));
+    $table->add_header('source', $RCMAIL->gettext('source'));
+
+    foreach ($plugin_info as $name => $data) {
+        $uri = $data['src_uri'] ?: $data['uri'];
+        if ($uri && stripos($uri, 'http') !== 0) {
+            $uri = 'http://' . $uri;
+        }
+
+        $table->add_row();
+        $table->add('name', rcube::Q($data['name'] ?: $name));
+        $table->add('version', rcube::Q($data['version']));
+        $table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> rcube::Q($data['license_uri'])),
+            rcube::Q($data['license'])) : $data['license']);
+        $table->add('source', $uri ? html::a(array('target' => '_blank', href=> rcube::Q($uri)),
+            rcube::Q($RCMAIL->gettext('download'))) : '');
+    }
+
+    return $table->show();
+}

--
Gitblit v1.9.1