includes/template.php
changeset 1352 d97cf005f674
parent 1344 dc96d6c5cd1e
child 1361 26e80700ff1d
child 1363 f1ed3e9298ae
equal deleted inserted replaced
1351:a57727e67241 1352:d97cf005f674
  2116  	* @return string
  2116  	* @return string
  2117  	*/
  2117  	*/
  2118  	
  2118  	
  2119 	function username_field($name, $value = false)
  2119 	function username_field($name, $value = false)
  2120 	{
  2120 	{
       
  2121 		global $db, $session, $paths, $template, $plugins; // Common objects
       
  2122 		
       
  2123 		$value = $value ? htmlspecialchars($value) : false;
       
  2124 		
       
  2125 		$val = $value ? "value=\"" . $value . "\"" : "";
       
  2126 		
       
  2127 		if ( $session->user_id == 1 && getConfig('autofill_username_for_guests', 0) != 1 )
       
  2128 			return "<input name=\"$name\" type=\"text\" size=\"30\" $val />";
       
  2129 		
  2121 		$randomid = md5( time() . microtime() . mt_rand() );
  2130 		$randomid = md5( time() . microtime() . mt_rand() );
  2122 		$text = '<input name="'.$name.'" class="autofill username" onkeyup="new AutofillUsername(this);" type="text" size="30" id="userfield_'.$randomid.'" autocomplete="off"';
  2131 		$text = '<input name="'.$name.'" class="autofill username" onkeyup="new AutofillUsername(this);" type="text" size="30" id="userfield_'.$randomid.'" autocomplete="off"';
  2123 		if($value) $text .= ' value="'.$value.'"';
  2132 		if($value) $text .= ' value="'.$value.'"';
  2124 		$text .= ' />';
  2133 		$text .= ' />';
  2125 		return $text;
  2134 		return $text;