Improve HTML escaping
[squirrelmail.git] / plugins / info / options.php
index 0e8ca49dcec6c270814531592cd117f8b139a16a..fc78d8d066040471d951d92d4731c731b77908e1 100644 (file)
@@ -1,27 +1,51 @@
 <?PHP
 
-/* options page for IMAP info plugin 
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+/**
+ * options page for IMAP info plugin 
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *   
  * This is where it all happens :)
  *
  * Written by: Jason Munro 
  * jason@stdbev.com
+ * 
+ * $Id$
+ * @package plugins
+ * @subpackage info
  */
-chdir('..');
-define('SM_PATH','../');
+
+/** @ignore */
+define('SM_PATH','../../');
 
 /* SquirrelMail required files. */
 require_once(SM_PATH . 'include/validate.php');
 require_once(SM_PATH . 'functions/page_header.php');
 require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/forms.php');
 require_once(SM_PATH . 'plugins/info/functions.php');
 
 global $username, $color, $folder_prefix, $default_charset;
 $default_charset = strtoupper($default_charset);
 displayPageHeader($color, 'None');
 $mailbox = 'INBOX';
+
+/* GLOBALS */
+sqgetGlobalVar('username', $username, SQ_SESSION);     
+sqgetGlobalVar('key', $key, SQ_COOKIE);     
+sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);  
+
+sqgetGlobalVar('submit', $submit, SQ_POST);
+
+for($i = 0; $i <= 9; $i++){
+    $varc = 'CHECK_TEST_'.$i;
+    sqgetGlobalVar($varc, $$varc, SQ_POST);
+    $vart  = 'TEST_'.$i;
+    sqgetGlobalVar($vart, $$vart, SQ_POST);
+}
+
+/* END GLOBALS */
+
 $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 $caps_array = get_caps($imap_stream);
 $list = array (
@@ -42,23 +66,29 @@ print "<CENTER><TABLE WIDTH=\"95%\" BORDER=1 BGCOLOR=".$color[3].">\n";
 print "<TR><TD BGCOLOR=".$color[4]."><B>Server Capability response:</B><BR>\n";
 
 foreach($caps_array[0] as $value) {
-    print $value;
+    print htmlspecialchars($value);
 }
 
 print "</TD></TR><TR><TD>\n";
 
 if (!isset($submit) || $submit == 'default') {
-    print "<BR><SMALL><FONT COLOR=".$color[6].">Select the IMAP commands you would like to run. Most commands require a selected mailbox so the select command is already setup. You can clear all the commands and test your own IMAP command strings. The commands are executed in order. The default values are simple IMAP commands using your default_charset and folder_prefix from Squirrelmail when needed.<BR><BR><B><CENTER>NOTE: These commands are live, any changes made will effect your current email account.</B></CENTER></FONT></SMALL><BR>\n";
+    print "<br><small><font color=".$color[6].">Select the IMAP commands you would like to run.
+        Most commands require a selected mailbox so the select command is already setup.
+        You can clear all the commands and test your own IMAP command strings. The commands are
+        executed in order. The default values are simple IMAP commands using your default_charset
+        and folder_prefix from SquirrelMail when needed.<br><br>
+        <b><center>NOTE: These commands are live, any changes made will effect your current
+        email account.</b></center></font></small><br>\n";
     if (!isset($submit)) {
         $submit = '';
     }
 }
 else {
-    print "folder_prefix = $folder_prefix<BR>\n";
-    print "default_charset = $default_charset\n";
+    print 'folder_prefix = ' . htmlspecialchars($folder_prefix)."<br />\n" .
+          'default_charset = '.htmlspecialchars($default_charset)."\n";
 }
 
-print "<BR></TD></TR></TABLE></CENTER><BR>\n";
+print "<br /></td></tr></table></center><br />\n";
 
 
 if ($submit == 'submit') {
@@ -103,13 +133,15 @@ foreach($type as $index=>$value) {
         print " CHECKED";
     }
     print "></TD><TD WIDTH=\"30%\">$index</TD><TD WIDTH=\"60%\">\n";
-    print "<INPUT TYPE=TEXT NAME=$index VALUE='$value' SIZE=60>\n"; 
+    print addInput($index, $value, 60);
 }
 
-print "</TD></TR></TABLE></CENTER><BR>\n";
-print "<CENTER><INPUT TYPE=SUBMIT NAME=submit value=submit>\n";
-print "<INPUT TYPE=SUBMIT NAME=submit value=clear>\n";
-print "<INPUT TYPE=SUBMIT NAME=submit value=default></CENTER><BR>\n";
+print "</td></tr></table></center><br>\n";
+print "<center>".
+        addSubmit('submit','submit').
+        addSubmit('clear','submit').
+        addSubmit('default','submit').
+        "</center><br>\n";
 
 $tests = array();