X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Foptions.php;h=6fa6b2f858caaaed8d1d535b0c72d34192e249f8;hp=022cc224ffb21ecba74d9de717bcd3c0f5651cef;hb=d8e94f0ae6733ca565035a93704d71de69b9f2e3;hpb=e40b0e8e41f95e772e5557fcdf15cfcc4e015165 diff --git a/functions/options.php b/functions/options.php index 022cc224..6fa6b2f8 100644 --- a/functions/options.php +++ b/functions/options.php @@ -5,7 +5,7 @@ * * Functions needed to display the options pages. * - * @copyright © 1999-2007 The SquirrelMail Project Team + * @copyright 1999-2009 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -213,7 +213,9 @@ class SquirrelOption { } /* Set the default save function. */ - if (($type != SMOPT_TYPE_HIDDEN) && ($type != SMOPT_TYPE_COMMENT)) { + if ($type != SMOPT_TYPE_HIDDEN + && $type != SMOPT_TYPE_INFO + && $type != SMOPT_TYPE_COMMENT) { $this->save_function = SMOPT_SAVE_DEFAULT; } else { $this->save_function = SMOPT_SAVE_NOOP; @@ -362,6 +364,9 @@ class SquirrelOption { /* Get the widget for this option type. */ switch ($this->type) { + case SMOPT_TYPE_PASSWORD: + $result = $this->createWidget_String(TRUE); + break; case SMOPT_TYPE_STRING: $result = $this->createWidget_String(); break; @@ -410,6 +415,9 @@ class SquirrelOption { case SMOPT_TYPE_SUBMIT: $result = $this->createWidget_Submit(); break; + case SMOPT_TYPE_INFO: + $result = $this->createWidget_Info(); + break; default: error_box ( sprintf(_("Option Type '%s' Not Found"), $this->type) @@ -428,11 +436,25 @@ class SquirrelOption { return $result; } + /** + * Creates info block + * @return string html formated output + */ + function createWidget_Info() { + return sq_htmlspecialchars($this->value); + } + /** * Create string field + * + * @param boolean $password When TRUE, the text in the input + * widget will be obscured (OPTIONAL; + * default = FALSE). + * * @return string html formated option field + * */ - function createWidget_String() { + function createWidget_String($password=FALSE) { switch ($this->size) { case SMOPT_SIZE_TINY: $width = 5; @@ -451,7 +473,11 @@ class SquirrelOption { $width = 25; } - return addInput('new_' . $this->name, $this->value, $width, 0, $this->aExtraAttribs) . htmlspecialchars($this->trailing_text); +//TODO: might be better to have a separate template file for all widgets, because then the layout of the widget and the "trailing text" can be customized - they are still hard coded here + if ($password) + return addPwField('new_' . $this->name, $this->value, $width, 0, $this->aExtraAttribs) . ' ' . htmlspecialchars($this->trailing_text); + else + return addInput('new_' . $this->name, $this->value, $width, 0, $this->aExtraAttribs) . ' ' . htmlspecialchars($this->trailing_text); } /**