Make use of forms.php functions.
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 31 Mar 2004 11:30:17 +0000 (11:30 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 31 Mar 2004 11:30:17 +0000 (11:30 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6977 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/addrbook_search.php
src/addrbook_search_html.php
src/addressbook.php
src/folders.php
src/folders_delete.php
src/folders_rename_getname.php
src/options.php
src/options_highlight.php

index 4cfca0968c951cf6e4c36e60f63698c90a1fbaee..45e1ed2ea133ba4389689191f53eef15735b3a46 100644 (file)
@@ -26,6 +26,7 @@ require_once(SM_PATH . 'include/validate.php');
 require_once(SM_PATH . 'functions/strings.php');
 require_once(SM_PATH . 'functions/global.php');
 require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/forms.php');
 
 /** lets get the global vars we may need */
 sqgetGlobalVar('key',       $key,           SQ_COOKIE);
@@ -189,7 +190,7 @@ if ($show == 'form' && !isset($listall)) {
 /* Empty search */
 if (empty($query) && empty($show) && empty($listall)) {
     echo html_tag( 'p', '<br>' .
-                      _("No persons matching your search was found"),
+                      _("No persons matching your search were found"),
             'center' ) .
           "\n</BODY></HTML>\n",
     exit;
@@ -206,20 +207,20 @@ if ($show == 'form' && empty($listall)) {
          html_tag( 'tr' ) .
          html_tag( 'td', '  <strong>' . _("Search for") . "</strong>\n", 'left', '', 'nowrap valign="middle" width="10%"' ) .
          html_tag( 'td', '', 'left', '', '' ) .
-                 '<INPUT TYPE=text NAME=query VALUE="' . htmlspecialchars($query) .
-                 "\" SIZE=28>\n";
+            addInput('query', $query, 28);
 
     /* List all backends to allow the user to choose where to search */
     if ($abook->numbackends > 1) {
-        echo '<STRONG>' . _("in") . '</STRONG>&nbsp;<SELECT NAME=backend>'."\n".
-             '<OPTION VALUE=-1 SELECTED>' . _("All address books") . "\n";
+        echo '<STRONG>' . _("in") . '</STRONG>&nbsp;'."\n".
+       $selopts['-1'] = _("All address books");
+       
         $ret = $abook->get_backend_list();
         while (list($undef,$v) = each($ret)) {
-            echo '<OPTION VALUE=' . $v->bnum . '>' . $v->sname . "\n";
+            $selopts[$v->bnum] = $v->sname;
         }
-        echo "</SELECT>\n";
+       echo addSelect('backend', $selopts, '-1', TRUE);
     } else {
-        echo '<INPUT TYPE=hidden NAME=backend VALUE=-1>' . "\n";
+        echo addHidden('backend', '-1');
     }
         
     echo '</td></tr>' .
index bf0c8a475725303b3b94fc7d0fd7e4544ba8618d..bfb0797ddc9c6a8d1c89b92c1ac7fd466a117819 100644 (file)
@@ -42,27 +42,22 @@ function addr_insert_hidden() {
     global $body, $subject, $send_to, $send_to_cc, $send_to_bcc, $mailbox,
            $identity, $session;
 
-   echo '<input type=hidden value="';
    if (substr($body, 0, 1) == "\r") {
-       echo "\n";
-   }
-   echo htmlspecialchars($body) . '" name=body>' . "\n" .
-        '<input type=hidden value="' . $session . '" name=session>' . "\n" .
-        '<input type=hidden value="' . htmlspecialchars($subject) .
-        '" name=subject>' . "\n" .
-        '<input type=hidden value="' . htmlspecialchars($send_to) .
-        '" name=send_to>' . "\n" .
-        '<input type=hidden value="' . htmlspecialchars($send_to_cc) .
-        '" name=send_to_cc>' . "\n" .
-        '<input type=hidden value="' . htmlspecialchars($send_to_bcc) .
-        '" name=send_to_bcc>' . "\n" .
-        '<input type=hidden value="' . htmlspecialchars($identity) .
-        '" name=identity>' . "\n" .
-        '<input type=hidden name=mailbox value="' . htmlspecialchars($mailbox) .
-        "\">\n" . '<input type=hidden value="true" name=from_htmladdr_search>' .
-        "\n";
+       echo addHidden('body', "\n".$body);
+   } else {
+       echo addHidden('body', $body);
    }
 
+   echo addHidden('session', $session).
+        addHidden('subject', $subject).
+       addHidden('send_to', $send_to).
+       addHidden('send_to_bcc', $send_to_bcc).
+       addHidden('send_to_cc', $send_to_cc).
+       addHidden('identity', $identity).
+       addHidden('mailbox', $mailbox).
+       addHidden('from_htmladdr_search', 'true');
+}
+
 
 /**
  * List search results
@@ -74,8 +69,8 @@ function addr_display_result($res, $includesource = true) {
 
     if (sizeof($res) <= 0) return;
 
-    echo '<form method=post action="' . $PHP_SELF . '" name="addrbook">'."\n" .
-         '<input type=hidden name="html_addr_search_done" value="true">' . "\n";
+    echo addForm($PHP_SELF, 'POST', 'addrbook').
+         addHidden('html_addr_search_done', 'true');
     addr_insert_hidden();
     $line = 0;
 
@@ -133,12 +128,12 @@ if ($javascript_on) {
             } else {
         echo html_tag( 'tr', '', '', $tr_bgcolor, 'nowrap' ) .
         html_tag( 'td',
-             '<input type=checkbox name="send_to_search[T' . $line . ']" value = "' .
-             htmlspecialchars($email) . '">&nbsp;' . _("To") . '&nbsp;' .
-             '<input type=checkbox name="send_to_search[C' . $line . ']" value = "' .
-             htmlspecialchars($email) . '">&nbsp;' . _("Cc") . '&nbsp;' .
-             '<input type=checkbox name="send_to_search[B' . $line . ']" value = "' .
-             htmlspecialchars($email) . '">&nbsp;' . _("Bcc") . '&nbsp;' ,
+           addCheckBox('send_to_search[T'.$line.']', FALSE, $email).
+            '&nbsp;' . _("To") . '&nbsp;' .
+           addCheckBox('send_to_search[C'.$line.']', FALSE, $email).
+           '&nbsp;' . _("Cc") . '&nbsp;' .
+           addCheckBox('send_to_search[B'.$line.']', FALSE, $email).
+           '&nbsp;' . _("Bcc") . '&nbsp;' ,
         'center', '', 'width="5%" nowrap' ) .
         html_tag( 'td', '&nbsp;' . htmlspecialchars($row['name']) . '&nbsp;', 'left', '', 'nowrap' ) .
         html_tag( 'td', '&nbsp;' . htmlspecialchars($row['email']) . '&nbsp;', 'left', '', 'nowrap' ) .
@@ -159,7 +154,7 @@ if ($javascript_on) {
                 'center', '', 'colspan="'. $td_colspan .'"' )
             ) .
          '</TABLE>' .
-         '<INPUT TYPE=hidden VALUE=1 NAME="html_addr_search_done">' .
+        addHidden('html_addr_search_done', '1').
          '</FORM>';
 }
 
@@ -188,34 +183,31 @@ echo '<center>' .
     html_tag( 'table', '', 'center', '', 'border="0"' ) .
     html_tag( 'tr' ) .
     html_tag( 'td', '', 'left', '', 'nowrap valign="middle"' ) . "\n" .
-    '<FORM METHOD=post NAME=f ACTION="' . $PHP_SELF .
-    '?html_addr_search=true">' . "\n<CENTER>\n" .
+    addForm($PHP_SELF.'?html_addr_search=true', 'POST', 'f').
+    "\n<CENTER>\n" .
     '  <nobr><STRONG>' . _("Search for") . "</STRONG>\n";
 addr_insert_hidden();
 if (! isset($addrquery))
     $addrquery = '';
-echo '  <INPUT TYPE=text NAME=addrquery VALUE="' .
-     htmlspecialchars($addrquery) . "\" SIZE=26>\n";
+echo addInput('addrquery', $addrquery, 26);
 
 /* List all backends to allow the user to choose where to search */
 if (!isset($backend)) { $backend = ''; }
 if ($abook->numbackends > 1) {
-    echo '<STRONG>' . _("in") . '</STRONG>&nbsp;<SELECT NAME=backend>' . "\n" .
-         '<OPTION VALUE=-1';
-    if ($backend == -1) { echo ' SELECTED'; }
-    echo '>' . _("All address books") . "\n";
+    echo '<STRONG>' . _("in") . '</STRONG>&nbsp;';
+    
+    $selopts['-1'] = _("All address books"); 
     $ret = $abook->get_backend_list();
+    
     while (list($undef,$v) = each($ret)) {
-        echo '<OPTION VALUE=' . $v->bnum;
-        if ($backend == $v->bnum) { echo ' SELECTED'; }
-        echo '>' . $v->sname . "\n";
+       $selopts[$v->bnum] = $v->sname;
     }
-    echo "</SELECT>\n";
+    echo addSelect('backend', $selopts, $backend, TRUE);
 } else {
-    echo '<INPUT TYPE=hidden NAME=backend VALUE=-1>' . "\n";
+    echo addHidden('backend', '-1');
 }
 if (isset($session)) {
-    echo "<input type=hidden name=\"session\" value=\"$session\">";
+    echo addHidden('session', $session);
 }
 
 echo '<INPUT TYPE=submit VALUE="' . _("Search") . '">' .
@@ -281,7 +273,7 @@ else {
         } else {
             if (sizeof($res) == 0) {
                 echo html_tag( 'p', '<br><b>' .
-                                 _("No persons matching your search was found") . "</b>\n" ,
+                                 _("No persons matching your search were found") . "</b>\n" ,
                        'center' ) .
                 "\n</BODY></HTML>\n";
             } else {
@@ -293,7 +285,8 @@ else {
 
 if ($addrquery == '' || sizeof($res) == 0) {
     /* printf('<center><FORM METHOD=post NAME=k ACTION="compose.php">'."\n", $PHP_SELF); */
-    echo '<center><FORM METHOD=post NAME=k ACTION="compose.php">' . "\n";
+    echo '<center>'.
+       addForm('compose.php','POST','k');
     addr_insert_hidden();
     echo '<INPUT TYPE=submit VALUE="' . _("Return") . '" NAME=return>' . "\n" .
          '</form></center></nobr>';
index a936aaff65322c6d298051c9feeab6c697d7e582..c1f230759ccf2e764e1d341a030843d1600841c4 100644 (file)
@@ -255,11 +255,9 @@ if(sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'P
                                    ),
                              'center', '', 'width="100%" ' );
                         address_form("editaddr", _("Update address"), $olddata);
-                        echo '<INPUT TYPE=hidden NAME=oldnick VALUE="' . 
-                             htmlspecialchars($olddata["nickname"]) . "\">\n" .
-                             '<INPUT TYPE=hidden NAME=backend VALUE="' .
-                             htmlspecialchars($olddata["backend"]) . "\">\n" .
-                             '<INPUT TYPE=hidden NAME=doedit VALUE=1>' . "\n" .
+                       echo addHidden('oldnick', $olddata['nickname']).
+                             addHidden('backend', $olddata['backend']).
+                            addHidden('doedit', '1').
                              '</FORM>';
                     }
                 } else {
index 1d7e29dd6e8887e768b4f3f869a3f42713e38fba..dc708a34a777522ac46566966b08e7418216b712 100644 (file)
@@ -22,6 +22,7 @@ require_once(SM_PATH . 'include/validate.php');
 require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/plugin.php');
 require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/forms.php');
 
 displayPageHeader($color, 'None');
 
@@ -95,11 +96,9 @@ echo html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="4" cellspaci
             ) .
             html_tag( 'tr' ) .
                 html_tag( 'td', '', 'center', $color[0] ) .
-
-     "<FORM NAME=cf ACTION=\"folders_create.php\" METHOD=\"POST\">\n".
-     "<input type=TEXT SIZE=25 NAME=folder_name><BR>\n".
-     _("as a subfolder of").
-     '<BR>'.
+     addForm('folders_create.php', 'POST', 'cf').
+     addInput('folder_name', '', 25).
+     "<BR>\n". _("as a subfolder of"). '<BR>'.
      "<TT><SELECT NAME=subfolder>\n";
 
 $show_selected = array();
@@ -127,7 +126,8 @@ echo sqimap_mailbox_option_list($imapConnection, $show_selected, $skip_folders,
 
 echo "</SELECT></TT>\n";
 if ($show_contain_subfolders_option) {
-    echo '<br><input type=CHECKBOX NAME="contain_subs"> &nbsp;'
+    echo '<br>'.
+         addCheckBox('contain_subs', FALSE, '1') .' &nbsp;'
        . _("Let this folder contain subfolders")
        . '<BR>';
 }
@@ -193,7 +193,7 @@ echo html_tag( 'tr',
         html_tag( 'td', '', 'center', $color[0] );
 
 if ($count_special_folders < count($boxes)) {
-    echo "<FORM ACTION=\"folders_rename_getname.php\" METHOD=\"POST\">\n"
+    echo addForm('folders_rename_getname.php')
        . "<TT><SELECT NAME=old>\n"
        . '         <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
 
@@ -225,7 +225,7 @@ echo html_tag( 'tr',
         html_tag( 'td', '', 'center', $color[0] );
 
 if ($count_special_folders < count($boxes)) {
-    echo "<FORM ACTION=\"folders_delete.php\" METHOD=\"POST\">\n"
+    echo addForm('folders_delete.php')
        . "<TT><SELECT NAME=mailbox>\n"
        . '         <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
 
@@ -256,7 +256,7 @@ echo html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="4" cellspaci
                 html_tag( 'td', '', 'center', $color[0], 'width="50%"' );
 
 if ($count_special_folders < count($boxes)) {
-    echo "<FORM ACTION=\"folders_subscribe.php?method=unsub\" METHOD=\"POST\">\n"
+    echo addForm('folders_subscribe.php?method=unsub')
        . "<TT><SELECT NAME=\"mailbox[]\" multiple size=8>\n";
     for ($i = 0; $i < count($boxes); $i++) {
         $use_folder = true;
@@ -304,7 +304,7 @@ if(!$no_list_for_subscribe) {
     }
   }
   if ($box && $box2) {
-    echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n"
+    echo addForm('folders_subscribe.php?method=sub')
        . '<tt><select name="mailbox[]" multiple size=8>';
 
     for ($q = 0; $q < count($box); $q++) {      
@@ -318,7 +318,7 @@ if(!$no_list_for_subscribe) {
   }
 } else {
   /* don't perform the list action -- this is much faster */
-  echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n"
+  echo addForm('folders_subscribe.php?method=sub')
      . _("Subscribe to:") . '<br>'
      . '<tt><input type="text" name="mailbox[]" size=35>'
      . '<INPUT TYPE=SUBMIT VALUE="'. _("Subscribe") . "\">\n"
index 9c80a143412a05c88a1ff14eb9bc69568f0bcbe0..d14bf210b230831dbe0333e580fd3a34ec3c37c8 100644 (file)
@@ -23,6 +23,7 @@ require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/tree.php');
 require_once(SM_PATH . 'functions/display_messages.php');
 require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/forms.php');
 
 /*
  *  Incoming values:
@@ -62,9 +63,8 @@ if( !sqgetGlobalVar('confirmed', $tmp, SQ_POST) ) {
         html_tag( 'tr' ) .
         html_tag( 'td', '', 'center', $color[4] ) .
         sprintf(_("Are you sure you want to delete %s?"), imap_utf7_decode_local($mailbox)).
-        '<FORM ACTION="folders_delete.php" METHOD="POST"><p>'.
-
-        '<INPUT TYPE=HIDDEN NAME="mailbox" VALUE="' . htmlspecialchars($mailbox) . "\">\n" .
+       addForm('folders_delete.php', 'POST').
+       addHidden('mailbox', $mailbox).
         '<INPUT TYPE=SUBMIT NAME="confirmed" VALUE="'._("Yes")."\">\n".
         '<INPUT TYPE=SUBMIT NAME="backingout" VALUE="'._("No")."\">\n".
         '</p></FORM><BR></td></tr></table>';
index 32045dd853528fc0b66b6aff3343253dcb1640a6..a5a9aa3cca0db2bdb4ade480eb4643bd30cd6abb 100644 (file)
@@ -22,6 +22,7 @@ require_once(SM_PATH . 'functions/global.php');
 require_once(SM_PATH . 'functions/imap_mailbox.php');
 require_once(SM_PATH . 'functions/html.php');
 require_once(SM_PATH . 'functions/display_messages.php');
+require_once(SM_PATH . 'functions/forms.php');
 
 /* get globals we may need */
 sqgetGlobalVar('key',       $key,           SQ_COOKIE);
@@ -65,16 +66,16 @@ echo '<br>' .
         ) .
         html_tag( 'tr' ) .
             html_tag( 'td', '', 'center', $color[4] ) .
-            '<FORM ACTION="folders_rename_do.php" METHOD="POST">'.
+           addForm('folders_rename_do.php').
      _("New name:").
      '<br><b>' . htmlspecialchars($old_parent) . ' ' . htmlspecialchars($delimiter) . '</b>' .
-     '<INPUT TYPE="TEXT" SIZE="25" NAME="new_name" VALUE="' . htmlspecialchars($old_name) . '"><BR>' . "\n";
+     addInput('new_name', $old_name, 25) . '<BR>' . "\n";
 if ( $isfolder ) {
-    echo '<INPUT TYPE=HIDDEN NAME="isfolder" VALUE="true">';
+    echo addHidden('isfolder', 'true');
 }
-printf("<INPUT TYPE=HIDDEN NAME=\"orig\" VALUE=\"%s\">\n", htmlspecialchars($old));
-printf("<INPUT TYPE=HIDDEN NAME=\"old_name\" VALUE=\"%s\">\n", htmlspecialchars($old_name));
-echo '<INPUT TYPE=SUBMIT VALUE="'._("Submit")."\">\n".
+echo addHidden('orig', $old).
+     addHidden('old_name', $old_name).
+     '<INPUT TYPE=SUBMIT VALUE="'._("Submit")."\">\n".
      '</FORM><BR></td></tr></table>';
 
 ?>
index 44c2279e13f922d6c060ddae3894d6b7c26842c5..7e5093260dfbbcd9024ee5d138c95425f7a2e4b1 100644 (file)
@@ -24,6 +24,7 @@ require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/options.php');
 require_once(SM_PATH . 'functions/strings.php');
 require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/forms.php');
 
 /*********************************/
 /*** Build the resultant page. ***/
@@ -390,7 +391,7 @@ if ($optpage == SMOPT_PAGE_MAIN) {
 /* If we are not looking at the main option page, display the page here. */
 /*************************************************************************/
 } else {
-    echo '<form name="f" action="options.php" method="post"><br>' . "\n"
+    echo addForm('options.php', 'POST', 'f')
        . create_optpage_element($optpage)
        . create_optmode_element(SMOPT_MODE_SUBMIT)
        . html_tag( 'table', '', '', '', 'width="100%" cellpadding="2" cellspacing="0" border="0"' ) . "\n"
index fde299f3b644a723ea75eb950c33916eecda05de..0fd3d4cb9a81abca8892c42c4e6ea97238628f72 100644 (file)
@@ -22,32 +22,17 @@ require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/plugin.php');
 require_once(SM_PATH . 'functions/strings.php');
 require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/forms.php');
 
 /* get globals */
-if (isset($_GET['action'])) {
-    $action = $_GET['action'];
-}
-if (isset($_GET['theid'])) {
-    $theid = $_GET['theid'];
-}
-if (isset($_GET['identname'])) {
-    $identname = $_GET['identname'];
-}
-if (isset($_GET['newcolor_choose'])) {
-    $newcolor_choose = $_GET['newcolor_choose'];
-}
-if (isset($_GET['newcolor_input'])) {
-    $newcolor_input = $_GET['newcolor_input'];
-}
-if (isset($_GET['color_type'])) {
-    $color_type = $_GET['color_type'];
-}
-if (isset($_GET['match_type'])) {
-    $match_type = $_GET['match_type'];
-}
-if (isset($_GET['value'])) {
-    $value = $_GET['value'];
-}
+sqGetGlobalVar('action', $action);
+sqGetGlobalVar('theid', $theid);
+sqGetGlobalVar('identname', $identname);
+sqGetGlobalVar('newcolor_choose', $newcolor_choose);
+sqGetGlobalVar('newcolor_input', $newcolor_input);
+sqGetGlobalVar('color_type', $color_type);
+sqGetGlobalVar('match_type', $match_type);
+sqGetGlobalVar('value', $value);
 
 /* end of get globals */
  
@@ -329,8 +314,10 @@ if ($action == 'edit' || $action == 'add') {
     $new_color_list["18,3"] = 'ff33ff';
     $new_color_list["18,4"] = 'ff00ff';
 
-    $selected_input = '';
-    $selected_choose = '';
+    $selected_input = FALSE;
+    $selected_i = null;
+    $selected_choose = FALSE;
+    $selected_predefined = FALSE;
 
     for ($i=0; $i < 14; $i++) {
         ${"selected".$i} = '';
@@ -338,8 +325,8 @@ if ($action == 'edit' || $action == 'add') {
     if ($action == 'edit' && isset($theid) && isset($message_highlight_list[$theid]['color'])) {
         for ($i=0; $i < 14; $i++) {
             if ($color_list[$i] == $message_highlight_list[$theid]['color']) {
-                $selected_choose = ' checked';
-                ${"selected".$i} = ' selected';
+                $selected_choose = TRUE;
+                $selected_i = $color_list[$i];
                 continue;
             }
         }
@@ -365,16 +352,17 @@ if ($action == 'edit' || $action == 'add') {
     }
 
     if (isset($theid) && !isset($message_highlight_list[$theid]['color']))
-        $selected_choose = ' checked';
+        $selected_choose = TRUE;
     else if ($pre_defined_color)
-        $selected_predefined = ' checked';
+        $selected_predefined = TRUE;
     else if ($selected_choose == '')
-        $selected_input = ' checked';
+        $selected_input = TRUE;
 
-    echo '<form name="f" action="options_highlight.php">' . "\n";
-    echo '<input type="hidden" value="save" name="action">' . "\n";
-    if($action == 'edit')
-        echo '<input type="hidden" value="'.(isset($theid)?$theid:'').'" name="theid">' . "\n";
+    echo addForm('options_highlight.php', 'POST', 'f').
+         addHidden('action', 'save');
+    if($action == 'edit') {
+        echo addHidden('theid', (isset($theid)?$theid:''));
+    }
     echo html_tag( 'table', '', 'center', '', 'width="80%" cellpadding="3" cellspacing="0" border="0"' ) . "\n";
     echo html_tag( 'tr', '', '', $color[0] ) . "\n";
     echo html_tag( 'td', '', 'right', '', 'nowrap' ) . "<b>\n";
@@ -385,33 +373,40 @@ if ($action == 'edit' || $action == 'add') {
         $disp = $message_highlight_list[$theid]['name'];
     else
         $disp = '';
-    $disp = htmlspecialchars($disp);
-    echo "         <input type=\"text\" value=\"".$disp."\" name=\"identname\">";
+    echo "         ".addInput('identname', $disp);
     echo "      </td>\n";
     echo "   </tr>\n";
     echo html_tag( 'tr', html_tag( 'td', '<small><small>&nbsp;</small></small>', 'left' ) ) ."\n";
     echo html_tag( 'tr', '', '', $color[0] ) . "\n";
     echo html_tag( 'td', '<b>'. _("Color") . ':</b>', 'right' );
     echo html_tag( 'td', '', 'left' );
-    echo "         <input type=\"radio\" name=color_type value=1$selected_choose> &nbsp;<select name=newcolor_choose>\n";
-    echo "            <option value=\"$color_list[0]\"$selected0>" . _("Dark Blue") . "\n";
-    echo "            <option value=\"$color_list[1]\"$selected1>" . _("Dark Green") . "\n";
-    echo "            <option value=\"$color_list[2]\"$selected2>" . _("Dark Yellow") . "\n";
-    echo "            <option value=\"$color_list[3]\"$selected3>" . _("Dark Cyan") . "\n";
-    echo "            <option value=\"$color_list[4]\"$selected4>" . _("Dark Magenta") . "\n";
-    echo "            <option value=\"$color_list[5]\"$selected5>" . _("Light Blue") . "\n";
-    echo "            <option value=\"$color_list[6]\"$selected6>" . _("Light Green") . "\n";
-    echo "            <option value=\"$color_list[7]\"$selected7>" . _("Light Yellow") . "\n";
-    echo "            <option value=\"$color_list[8]\"$selected8>" . _("Light Cyan") . "\n";
-    echo "            <option value=\"$color_list[9]\"$selected9>" . _("Light Magenta") . "\n";
-    echo "            <option value=\"$color_list[10]\"$selected10>" . _("Dark Gray") . "\n";
-    echo "            <option value=\"$color_list[11]\"$selected11>" . _("Medium Gray") . "\n";
-    echo "            <option value=\"$color_list[12]\"$selected12>" . _("Light Gray") . "\n";
-    echo "            <option value=\"$color_list[13]\"$selected13>" . _("White") . "\n";
-    echo "         </select><br>\n";
-    echo "         <input type=\"radio\" name=color_type value=2$selected_input> &nbsp;". _("Other:") ."<input type=\"text\" value=\"";
-    if ($selected_input && isset($theid)) echo $message_highlight_list[$theid]["color"];
-    echo '" name="newcolor_input" size="7"> '._("Ex: 63aa7f")."<br>\n";
+    echo '         '.addRadioBox('color_type', $selected_choose, '1');
+
+    $selops = array (
+       $color_list[0] => _("Dark Blue"),
+       $color_list[1] => _("Dark Green"),
+       $color_list[2] => _("Dark Yellow"),
+       $color_list[3] => _("Dark Cyan"),
+       $color_list[4] => _("Dark Magenta"),
+       $color_list[5] => _("Light Blue"),
+       $color_list[6] => _("Light Green"),
+       $color_list[7] => _("Light Yellow"),
+       $color_list[8] => _("Light Cyan"),
+       $color_list[9] => _("Light Magenta"),
+       $color_list[10] => _("Dark Gray"),
+       $color_list[11] => _("Medium Gray"),
+       $color_list[12] => _("Light Gray"),
+       $color_list[13] => _("White") );
+       
+    echo addSelect('newcolor_choose', $selops, $selected_i, TRUE);
+    echo "<br>\n";
+
+    echo '         '.addRadioBox('color_type', $selected_input, 2).
+        ' &nbsp;'. _("Other:") .
+       addInput('newcolor_input',
+           (($selected_input && isset($theid)) ? $message_highlight_list[$theid]['color'] : ''),
+           '7');
+    echo _("Ex: 63aa7f")."<br>\n";
     echo "      </td>\n";
     echo "   </tr>\n";
 
@@ -425,8 +420,8 @@ if ($action == 'edit' || $action == 'add') {
         for($y = 0; $y < 19; $y++) {
         $gridindex = "$y,$x";
         $gridcolor = $new_color_list[$gridindex];
-        $selected = ($gridcolor == $current_color) ? ' checked' : '' ;
-        echo html_tag( 'td', '<input type="radio" name="color_type" value="#' . $gridcolor .'"' . $selected . '>', 'left', $gridcolor, 'colspan="2"' );
+        echo html_tag( 'td', addRadioBox('color_type', ($gridcolor == $current_color), '#'.$gridcolor),
+           'left', $gridcolor, 'colspan="2"' );
         }
         echo "</tr>\n";
     }
@@ -458,9 +453,7 @@ if ($action == 'edit' || $action == 'add') {
         $disp = $message_highlight_list[$theid]['value'];
     else
         $disp = '';
-    $disp = htmlspecialchars($disp);
-    echo '         <input type="text" value="' . $disp .
-        '" name="value" size=40>';
+    echo '         '.addInput('value', $disp, 40);
     echo "        </td>\n";
     echo "   </tr>\n";
     echo "</table>\n";