diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 111f37e438..e5bf4b17d9 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -1,7 +1,7 @@ * * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * @@ -27,7 +27,7 @@ list(,$this->user_agent,$this->ua_version) = $parts; $this->user_agent = strtolower($this->user_agent); - $this->prefered_img_title = $this->user_agent == 'mozilla' && $this->ua_version < 5 ? 'ALT' : 'TITLE'; + $this->prefered_img_title = $this->user_agent == 'mozilla' && $this->ua_version < 5 ? 'alt' : 'title'; //echo "

HTTP_USER_AGENT='$GLOBALS[HTTP_USER_AGENT]', UserAgent: '$this->user_agent', Version: '$this->ua_version', img_title: '$this->prefered_img_title'

\n"; $this->document_root = $_SERVER['DOCUMENT_ROOT']; @@ -37,6 +37,16 @@ $this->document_root = '/' . $this->document_root; } //echo "

_SERVER[DOCUMENT_ROOT]='$_SERVER[DOCUMENT_ROOT]', this->document_root='$this->document_root'

\n"; + + if ($GLOBALS['phpgw']->translation) + { + $this->charset = $GLOBALS['phpgw']->translation->charset(); + } + } + + function htmlspecialchars($str) + { + return htmlspecialchars($str,ENT_COMPAT,$this->charset); } /* @@ -58,7 +68,7 @@ } if ((int)$multiple > 0) { - $options .= ' MULTIPLE SIZE="'.(int)$multiple.'"'; + $options .= ' multiple size="'.(int)$multiple.'"'; if (substr($name,-2) != '[]') { $name .= '[]'; @@ -72,11 +82,11 @@ } foreach($arr as $k => $text) { - $out .= '\n"; } @@ -87,7 +97,7 @@ function div($content,$options='') { - return "
\n$content
\n"; + return "
\n$content
\n"; } function input_hidden($vars,$value='',$ignore_empty=True) @@ -104,7 +114,7 @@ } if (!$ignore_empty || $value && !($name == 'filter' && $value == 'none')) // dont need to send all the empty vars { - $html .= "\n"; + $html .= "htmlspecialchars($value)."\" />\n"; } } return $html; @@ -112,32 +122,32 @@ function textarea($name,$value='',$options='' ) { - return "\n"; + return "\n"; } function input($name,$value='',$type='',$options='' ) { if ($type) { - $type = 'TYPE="'.$type.'"'; + $type = 'type="'.$type.'"'; } - return "\n"; + return "htmlspecialchars($value)."\" $options />\n"; } function submit_button($name,$lang,$onClick='',$no_lang=0,$options='',$image='',$app='') { if ($image != '') { - if (strpos($image,'.')) + if (strpos($image,'.')) { $image = substr($image,0,strpos($image,'.')); } if (!($path = $GLOBALS['phpgw']->common->image($app,$image)) && - !($path = $GLOBALS['phpgw']->common->image('phpgwapi',$image))) + !($path = $GLOBALS['phpgw']->common->image('phpgwapi',$image))) { - $path = $image; // name may already contain absolut path + $path = $image; // name may already contain absolut path } - $image = ' SRC="'.$path.'"'; + $image = ' src="'.$path.'"'; } if (!$no_lang) { @@ -148,20 +158,20 @@ { $lang_u = str_replace('&'.$accesskey[1],''.$accesskey[1].'',$lang); $lang = str_replace('&','',$lang); - $options = 'ACCESSKEY="'.$accesskey[1].'" '.$options; + $options = 'accesskey="'.$accesskey[1].'" '.$options; } else { $accesskey = ''; $lang_u = $lang; } - if ($onClick) $options .= " onClick=\"$onClick\""; + if ($onClick) $options .= " onclick=\"$onClick\""; // '; } @@ -193,7 +203,7 @@ function checkbox($name,$value='') { - return "\n"; + return "\n"; } function form($content,$hidden_vars,$url,$url_vars='',$name='',$options='',$method='POST') @@ -201,7 +211,7 @@ $html = "
link($url,$url_vars)."\" $options>\n"; $html .= $this->input_hidden($hidden_vars); - if ($content) + if ($content) { $html .= $content; $html .= "
\n"; @@ -211,8 +221,7 @@ function form_1button($name,$lang,$hidden_vars,$url,$url_vars='',$form_name='',$method='POST') { - return $this->form($this->submit_button($name,$lang), - $hidden_vars,$url,$url_vars,$form_name,'',$method); + return $this->form($this->submit_button($name,$lang),$hidden_vars,$url,$url_vars,$form_name,'',$method); } /*! @@ -229,7 +238,7 @@ */ function table($rows,$options = '',$no_table_tr=False) { - $html = $no_table_tr ? '' : "\n"; + $html = $no_table_tr ? '' : "
\n"; foreach($rows as $key => $row) { @@ -237,7 +246,7 @@ { continue; // parameter } - $html .= $no_table_tr && $key == 1 ? '' : "\t\n"; + $html .= $no_table_tr && $key == 1 ? '' : "\t\n"; foreach($row as $key => $cell) { @@ -245,20 +254,20 @@ { continue; // parameter } - $table_pos = strpos($cell,'$cell\n"; + $html .= "\t\t\n"; } } - $html .= "\t\n"; + $html .= "\t\n"; } - $html .= "
$cell
\n"; + $html .= "\n"; if ($no_table_tr) { @@ -269,7 +278,7 @@ function sbox_submit( $sbox,$no_script=0 ) { - $html = str_replace('htmlspecialchars($title).'"'; } - return ""; + return ""; } function a_href( $content,$url,$vars='',$options='') @@ -321,9 +330,8 @@ function hr($width,$options='') { - if ($width) - $options .= " WIDTH=$width"; - return "
\n"; + if ($width) $options .= " width=\"$width\""; + return "
\n"; } /*! @@ -339,10 +347,13 @@ if (!is_array($options)) $options = explode(',',$options); if (!is_array($names)) $names = explode(',',$names); - while (list($n,$val) = each($options)) - if ($val != '' && $names[$n] != '') - $html .= ' '.$names[$n].'="'.$val.'"'; - + foreach($options as $n => $val) + { + if ($val != '' && $names[$n] != '') + { + $html .= ' '.strtolower($names[$n]).'="'.$val.'"'; + } + } return $html; } @@ -363,7 +374,7 @@ */ function theme2css() { - return + return ".th { background: ".$GLOBALS['phpgw_info']['theme']['th_bg']."; }\n". ".row_on,.th_bright { background: ".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n". ".row_off { background: ".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n"; @@ -371,19 +382,19 @@ function style($styles) { - return $styles ? "" : ''; + return $styles ? "" : ''; } function label($content,$id='',$accesskey='',$options='') { if ($id != '') { - $id = " FOR=\"$id\""; + $id = " for=\"$id\""; } if ($accesskey != '') { - $accesskey = " ACCESSKEY=\"$accesskey\""; + $accesskey = " accesskey=\"$accesskey\""; } - return "$content"; + return "$content"; } }