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:
Esteban Sanchez 2008-08-21 21:57:11 +00:00
parent 3ac0eccf78
commit 47e14f88b9
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> 2008-08-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
* index.php: Update HTML for unclosed tags and put everything in PHP * 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 /> <a href="index.php"><img src="images/pandora_logo.png" border="0" alt="logo"></a><br />
'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').' '.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'
</td><td class="f9b"> </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> </td></tr>
<tr><td class="f9b"> <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> </td></tr>
<tr><td align="center"> <tr><td align="center">
'.print_submit_button ("Login",'',false,'class="sub next"',true).' '.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 string $alt Alternative HTML string.
* @param bool $return Whether to return an output string or echo now (optional, echo by default). * @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; static $idcounter = 0;
++$idcounter; ++$idcounter;
$type = $password ? 'password' : 'text';
if (empty ($name)) { if (empty ($name)) {
$name = 'unnamed'; $name = 'unnamed';
} }
@ -132,7 +135,7 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength,
$maxlength = ' maxlength="'.$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 != '') { if ($id != '') {
$output .= ' id="'.$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 * Render an input password element.
* See print_input_text_extended for all options *
* @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; function print_input_password ($name, $value, $alt = '', $size = 50, $maxlength = 0, $return = false) {
if (empty ($name)) { $output = print_input_text_extended ($name, $value, 'password-'.$name, $alt, $size, $maxlength, false, '', '', true, true);
$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 .= ' />';
if ($return) if ($return)
return $output; return $output;
echo $output; echo $output;
} }
/** /**
* Render an input text element. * Render an input text element.
* *