fix path disclose problem in functions.php
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 17 Jul 2005 15:40:49 +0000 (15:40 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 17 Jul 2005 15:40:49 +0000 (15:40 +0000)
don't display system information, if plugin is disabled.
use squirrelmail option widgets instead of own functions. Option saving is
handled by sm.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9785 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/bug_report/bug_report.php
plugins/bug_report/index.php
plugins/bug_report/setup.php
plugins/bug_report/show_system_specs.php
plugins/bug_report/system_specs.php

index a30f7e1b07e029fee62e0ff4b80313f40c85c5e3..35192b98efa15549de046c80bdbf7f9961053626 100644 (file)
@@ -25,8 +25,15 @@ define('SM_PATH','../../');
 
 require_once(SM_PATH . 'include/validate.php');
 
 
 require_once(SM_PATH . 'include/validate.php');
 
+/** is bug_report plugin disabled */
+if (! is_plugin_enabled('bug_report')) {
+    error_box(_("Plugin is disabled."),$color);
+    echo "\n</body></html>\n";
+    exit();
+}
+
 // loading form functions
 // loading form functions
-require_once(SM_PATH . 'functions/forms.php');
+include_once(SM_PATH . 'functions/forms.php');
 
 displayPageHeader($color, 'None');
 
 
 displayPageHeader($color, 'None');
 
index 26b23537d34b1143495359046186781b86e3b21b..bffb85f53b184e0f47258175c0ce28e6bc3f6b54 100644 (file)
@@ -1,19 +1,15 @@
 <?php
 <?php
-
-   /**
-    **  index.php -- Displays the main frameset
-    **
-    **  Copyright (c) 1999-2005 The SquirrelMail Project Team
-    **  Licensed under the GNU GPL. For full terms see the file COPYING.
-    **
-    **  Redirects to the login page.
-    **
-    * @version $Id$
-    * @package plugins
-    * @subpackage bug_report
-    **/
-
-   header("Location:../../src/login.php\n\n");
-   exit();
-
+/**
+ * index.php -- Displays the main frameset
+ *
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Redirects to the login page.
+ * @version $Id$
+ * @package plugins
+ * @subpackage bug_report
+ */
+header("Location:../../index.php\n\n");
+exit();
 ?>
\ No newline at end of file
 ?>
\ No newline at end of file
index f4797fdcaffc05abd108117b499b0b7dc73df7c9..0fa28f2262fd3169d9e4fce63474a91ba4f1db27 100644 (file)
  * @subpackage bug_report
  */
 
  * @subpackage bug_report
  */
 
-/* This button fills out a form with your setup information already
-   gathered -- all you have to do is type. */
-
-
 /**
  * Initialize the bug report plugin
  * @return void
 /**
  * Initialize the bug report plugin
  * @return void
@@ -26,9 +22,8 @@ function squirrelmail_plugin_init_bug_report() {
     global $squirrelmail_plugin_hooks;
 
     $squirrelmail_plugin_hooks['menuline']['bug_report'] = 'bug_report_button';
     global $squirrelmail_plugin_hooks;
 
     $squirrelmail_plugin_hooks['menuline']['bug_report'] = 'bug_report_button';
-    $squirrelmail_plugin_hooks['options_display_inside']['bug_report'] = 'bug_report_options';
-    $squirrelmail_plugin_hooks['options_display_save']['bug_report'] = 'bug_report_save';
     $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load';
     $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load';
+    $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report'] = 'bug_report_block';
 }
 
 
 }
 
 
@@ -47,20 +42,6 @@ function bug_report_button() {
     echo "&nbsp;&nbsp;\n";
 }
 
     echo "&nbsp;&nbsp;\n";
 }
 
-/**
- * Saves bug report options
- * @access private
- */
-function bug_report_save() {
-    global $username,$data_dir;
-
-    if( sqgetGlobalVar('bug_report_bug_report_visible', $vis, SQ_POST) ) {
-        setPref($data_dir, $username, 'bug_report_visible', '1');
-    } else {
-        setPref($data_dir, $username, 'bug_report_visible', '');
-    }
-}
-
 /**
  * Loads bug report options
  * @access private
 /**
  * Loads bug report options
  * @access private
@@ -69,22 +50,28 @@ function bug_report_load() {
     global $username, $data_dir;
     global $bug_report_visible;
 
     global $username, $data_dir;
     global $bug_report_visible;
 
-    $bug_report_visible = getPref($data_dir, $username, 'bug_report_visible');
+    $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false);
 }
 
 /**
 }
 
 /**
- * Adds bug report options to display page
+ * Register bug report option block
+ * @since 1.5.1
  * @access private
  */
  * @access private
  */
-function bug_report_options() {
-    global $bug_report_visible;
-
-    echo '<tr>' . html_tag('td',_("Bug Reports:"),'right','','style="white-space: nowrap;"') . "\n" .
-         '<td><input name="bug_report_bug_report_visible" type="checkbox"';
-    if ($bug_report_visible) {
-        echo ' checked="checked"';
-    }
-    echo ' /> ' . _("Show button in toolbar") . "</td></tr>\n";
+function bug_report_block() {
+    global $optpage_data;
+    $optpage_data['grps']['bug_report'] = _("Bug Reports");
+    $optionValues = array();
+    // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT 
+    // (menulink is processed before options are saved/loaded)
+    $optionValues[] = array(
+        'name'    => 'bug_report_visible',
+        'caption' => _("Show button in toolbar"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_ALL,
+        'initial_value' => false
+        );
+    $optpage_data['vals']['bug_report'] = $optionValues;
 }
 
 ?>
\ No newline at end of file
 }
 
 ?>
\ No newline at end of file
index 8f856939a47b1dffea1ba7613370bb4a2f36d9ce..41a38f463d17fb8303d4aa2c72b4d1bb8b5d0111 100644 (file)
 define('SM_PATH','../../');
 include_once(SM_PATH . 'include/validate.php');
 
 define('SM_PATH','../../');
 include_once(SM_PATH . 'include/validate.php');
 
+/** is bug_report plugin disabled */
+if (! is_plugin_enabled('bug_report')) {
+    error_box(_("Plugin is disabled."),$color);
+    echo "\n</body></html>\n";
+    exit();
+}
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
index 62a6d658388d9eb2fe45ecabb312ff568cc05e2b..e40999f80ae59ce98bc783c5fde8e25696dff403 100644 (file)
@@ -13,6 +13,9 @@
  * @subpackage bug_report
  */
 
  * @subpackage bug_report
  */
 
+/** @ignore */
+if (!defined('SM_PATH')) define('SM_PATH','../../');
+
 /**
  * load required libraries
  */
 /**
  * load required libraries
  */