2008-08-21 Esteban Sanchez <estebans@artica.es>

* include/functions_html.php: Added an optional parameter to 
        print_input_text_extended() to allow password inputs. Replaced 
        print_input_password_extended() with print_input_password().

        * general/login_page.php: Replaced print_input_password_extended()
        with print_input_text_extended(). Style correction.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1021 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2008-08-21 21:57:11 +00:00
parent 39bc02f570
commit 2b538227be
3 changed files with 27 additions and 31 deletions

View File

@ -1,3 +1,12 @@
2008-08-21 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added an optional parameter to
print_input_text_extended() to allow password inputs. Replaced
print_input_password_extended() with print_input_password().
* general/login_page.php: Replaced print_input_password_extended()
with print_input_text_extended(). Style correction.
2008-08-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
* index.php: Update HTML for unclosed tags and put everything in PHP

View File

@ -38,10 +38,10 @@ echo '<div class="databox" id="login">
<a href="index.php"><img src="images/pandora_logo.png" border="0" alt="logo"></a><br />
'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'
</td><td class="f9b">
'.__('Login').':<br />'.print_input_text_extended ("nick",'', "nick",'','','',false,'','class="login"',true).'
'.__('Login').':<br />'.print_input_text_extended ("nick", '', "nick", '', '', '' , false, '', 'class="login"', true).'
</td></tr>
<tr><td class="f9b">
'.__('Password').':<br />'.print_input_password_extended ("pass",'', "pass",'','','',false,'','class="login"',true).'
'.__('Password').':<br />'.print_input_text_extended ("pass", '', "pass", '', '', '' ,false, '', 'class="login"', true, true).'
</td></tr>
<tr><td align="center">
'.print_submit_button ("Login",'',false,'class="sub next"',true).'

View File

@ -116,10 +116,13 @@ function print_select_from_sql ($sql, $name, $selected = '', $script = '', $noth
* @param string $alt Alternative HTML string.
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
*/
function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength, $disabled, $script, $attributes, $return = false) {
function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength, $disabled, $script, $attributes, $return = false, $password = false) {
static $idcounter = 0;
++$idcounter;
$type = $password ? 'password' : 'text';
if (empty ($name)) {
$name = 'unnamed';
}
@ -132,7 +135,7 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength,
$maxlength = ' maxlength="'.$maxlength.'" ';
}
$output = '<input name="'.$name.'" type="text" value="'.$value.'" size="'.$size.'" '.$maxlength.' alt="'.$alt.'" ';
$output = '<input name="'.$name.'" type="'.$type.'" value="'.$value.'" size="'.$size.'" '.$maxlength.' alt="'.$alt.'" ';
if ($id != '') {
$output .= ' id="'.$id.'"';
@ -153,40 +156,24 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength,
}
/**
* Render an input password element. Extended version
* See print_input_text_extended for all options
* Render an input password element.
*
* @param string $name Input name.
* @param string $value Input value.
* @param string $alt Alternative HTML string (optional).
* @param int $size Size of the input (optional).
* @param int $maxlength Maximum length allowed (optional).
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
*/
function print_input_password_extended ($name, $value, $id, $alt, $size, $maxlength, $disabled, $script, $attributes, $return = false) {
static $idcounter = 0;
++$idcounter;
if (empty ($name)) {
$name = 'unnamed';
}
if (empty ($alt)) {
$alt = 'textfield';
}
if (!empty ($maxlength)) {
$maxlength = ' maxlength="'.$maxlength.'" ';
}
$output = '<input name="'.$name.'" type="password" value="'.$value.'" size="'.$size.'" '.$maxlength.' alt="'.$alt.'" ';
if ($id != '') {
$output .= ' id="'.$id.'"';
} else {
$htmlid = 'pass-'.sprintf ('%04d', $idcounter);
$output .= ' id="'.$htmlid.'"';
}
if ($disabled)
$output .= ' disabled';
if ($attributes != '')
$output .= ' '.$attributes;
$output .= ' />';
function print_input_password ($name, $value, $alt = '', $size = 50, $maxlength = 0, $return = false) {
$output = print_input_text_extended ($name, $value, 'password-'.$name, $alt, $size, $maxlength, false, '', '', true, true);
if ($return)
return $output;
echo $output;
}
/**
* Render an input text element.
*