More XSS refinements. I was making the e-mails perhaps too secure. ;)
[squirrelmail.git] / functions / html.php
CommitLineData
9cd67a0a 1<?php
2
3/**
8008456a 4 * html.php
9cd67a0a 5 *
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * The idea is to inlcude here some functions to make easier
10 * the right to left implementation by "functionize" some
11 * html outputs.
12 *
13 * $Id$
14 */
15
8008456a 16 function html_tag( $tag, // Tag to output
17 $val = '', // Value between tags (if empty only start tag is output)
18 $align = '', // Alignment
19 $bgcolor = '', // Back color
20 $xtra = '' ) { // Extra options
9cd67a0a 21
94ac35c6 22 GLOBAL $languages, $language;
23
24 $align = strtolower( $align );
25 $dir = strtolower( $dir );
8008456a 26 $tag = strtoupper( $tag );
94ac35c6 27
28 if ( isset( $languages[$language]['DIR']) ) {
29 $dir = $languages[$language]['DIR'];
30 } else {
31 $dir = 'ltr';
32 }
33
34 if ( $dir == 'ltr' ) {
35 $rgt = 'right';
36 $lft = 'left';
37 } else {
38 $rgt = 'left';
39 $lft = 'right';
40 }
41
42 if ( $bgcolor <> '' ) {
43 $bgc = " BGCOLOR=\"$bgcolor\"";
44 }
45
46 switch ( $align ) {
47 case '':
48 $alg = '';
49 break;
50 case 'right':
51 $alg = " ALIGN=\"$rgt\"";
52 break;
8008456a 53 case 'left':
54 $alg = " ALIGN=\"$lft\"";
94ac35c6 55 default:
8008456a 56 $alg = " ALIGN=\"$align\"";
94ac35c6 57 }
9cd67a0a 58
8008456a 59 $ret = "<$tag";
60
61 if ( $dir <> 'ltr' ) {
62 $ret .= " DIR=\"$dir\"";
63 }
64
65 $ret .= "$bgc$alg";
66
67 if ( $xtra <> '' ) {
68 $ret .= " $xtra";
69 }
70 $ret .= '>';
71
72 if ( $val <> '' ) {
73 $ret .= "$val</$tag>";
74 }
75
94ac35c6 76 return( $ret );
94ac35c6 77 }
78
94ac35c6 79?>