From 38b88e48fd00b87764943064821e4a40b1f0b631 Mon Sep 17 00:00:00 2001 From: tokul Date: Sun, 6 Mar 2005 13:02:18 +0000 Subject: [PATCH] added display of plugin versions to bug report. added doctype to independent spec. page. Page needs some security test, that prevents access to it, when bug_report plugin is not enabled. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8958 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/bug_report/show_system_specs.php | 1 + plugins/bug_report/system_specs.php | 38 +++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/plugins/bug_report/show_system_specs.php b/plugins/bug_report/show_system_specs.php index 7184f722..8f856939 100644 --- a/plugins/bug_report/show_system_specs.php +++ b/plugins/bug_report/show_system_specs.php @@ -20,6 +20,7 @@ define('SM_PATH','../../'); include_once(SM_PATH . 'include/validate.php'); ?> +
diff --git a/plugins/bug_report/system_specs.php b/plugins/bug_report/system_specs.php
index 2ca2217c..5783e3e7 100644
--- a/plugins/bug_report/system_specs.php
+++ b/plugins/bug_report/system_specs.php
@@ -40,6 +40,42 @@ function Show_Array($array) {
     return $str;
 }
 
+/**
+ * converts plugin's array to string and adds version numbers
+ * @return string preformated text with installed plugin's information
+ * @access private
+ */
+function br_show_plugins() {
+    global $plugins;
+    $str = '';
+    if (is_array($plugins) && $plugins!=array()) {
+        foreach ($plugins as $key => $value) {
+            if ($key != 0 || $value != '') {
+                $str .= "    * $key = $value";
+                // add plugin version
+                if (function_exists($value . '_version')) {
+                    $str.= ' ' . call_user_func($value . '_version');
+                }
+                $str.="\n";
+            }
+        }
+        // compatibility plugin can be used without need to enable it in sm config
+        if (file_exists(SM_PATH . 'plugins/compatibility/setup.php') 
+            && ! in_array('compatibility',$plugins)) {
+            $str.= '    * compatibility';
+            include_once(SM_PATH . 'plugins/compatibility/setup.php');
+            if (function_exists('compatibility_version')) {
+                $str.= ' ' . call_user_func('compatibility_version');
+            }
+            $str.="\n";
+        }
+    }
+    if ($str == '') {
+        return "    * Nothing listed\n";
+    }
+    return $str;
+}
+
 $browscap = ini_get('browscap');
 if(!empty($browscap)) {
     $browser = get_browser();
@@ -62,7 +98,7 @@ $body_top = "My browser information:\n" .
             "\nSquirrelMail-specific information:\n" .
             "  Version:  $version\n" .
             "  Plugins (List)\n" .
-            Show_Array($plugins);
+            br_show_plugins();
 if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
     $warning = 1;
     $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
-- 
2.25.1