Use compatibility_info() function if at all possible instead of compatibility_version()
[squirrelmail.git] / plugins / bug_report / system_specs.php
index 62a6d658388d9eb2fe45ecabb312ff568cc05e2b..8a46a45e084c5eafb305b87ff3972b0661894d2d 100644 (file)
@@ -1,24 +1,29 @@
 <?php
 /**
- * This gathers system specification details for use with bug reporting
+ * This script gathers system specification details for use with bug reporting
  * and anyone else who needs it.
  *
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
- * This is a standard SquirrelMail 1.2 API for plugins.
- *
+ * @copyright &copy; 1999-2007 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
  * @subpackage bug_report
  */
 
+/**
+ * do not allow to call this file directly
+ */
+if ((isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) ||
+     (isset($HTTP_SERVER_SERVER['SCRIPT_FILENAME']) && $HTTP_SERVER_SERVER['SCRIPT_FILENAME'] == __FILE__) ) {
+    header("Location: ../../src/login.php");
+    die();
+}
+
 /**
  * load required libraries
  */
-include_once(SM_PATH . 'include/validate.php');
-include_once(SM_PATH . 'functions/imap.php');
-global $body, $username;
+include_once(SM_PATH . 'functions/imap_general.php');
+
 
 
 /**
@@ -54,7 +59,15 @@ function br_show_plugins() {
             if ($key != 0 || $value != '') {
                 $str .= "    * $key = $value";
                 // add plugin version
-                if (function_exists($value . '_version')) {
+                $version_found = FALSE;
+                if (function_exists($value . '_info')) {
+                    $info = call_user_func($value . '_info');
+                    if (!empty($info['version'])) {
+                        $str .= ' ' . $info['version'];
+                        $version_found = TRUE;
+                    }
+                }
+                if (!$version_found && function_exists($value . '_version')) {
                     $str.= ' ' . call_user_func($value . '_version');
                 }
                 $str.="\n";
@@ -65,8 +78,16 @@ function br_show_plugins() {
             && ! 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');
+            $version_found = FALSE;
+            if (function_exists('compatibility_info')) {
+                $info = compatibility_info();
+                if (!empty($info['version'])) {
+                    $str .= ' ' . $info['version'];
+                    $version_found = TRUE;
+                }
+            }
+            if (!$version_found && function_exists('compatibility_version')) {
+                $str.= ' ' . compatibility_version();
             }
             $str.="\n";
         }
@@ -155,5 +176,3 @@ if (isset($warning) && $warning) {
 }
 
 $body = htmlspecialchars($body_top . $body);
-
-?>
\ No newline at end of file