New get_plugin_version() function, and a couple places to use it.
[squirrelmail.git] / plugins / bug_report / system_specs.php
index e40999f80ae59ce98bc783c5fde8e25696dff403..d3fbe13563f9f6fe8b20d32feaec22c653263edf 100644 (file)
@@ -1,27 +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
  */
 
-/** @ignore */
-if (!defined('SM_PATH')) define('SM_PATH','../../');
+/**
+ * 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');
+
 
 
 /**
@@ -55,23 +57,13 @@ function br_show_plugins() {
     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";
+                $str .= "    * $key = $value " . get_plugin_version($value, TRUE) . "\n";
             }
         }
-        // compatibility plugin can be used without need to enable it in sm config
+        // compatibility plugin can be used without needing 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";
+            $str.= '    * compatibility ' . get_plugin_version('compatibility', TRUE) . "\n";
         }
     }
     if ($str == '') {
@@ -158,5 +150,3 @@ if (isset($warning) && $warning) {
 }
 
 $body = htmlspecialchars($body_top . $body);
-
-?>
\ No newline at end of file