gunnar: server/php-kolab/Kolab_Webadmin/Webadmin form.class.php, 1.3, 1.4 ldap.class.php, 1.3, 1.4
cvs at kolab.org
cvs at kolab.org
Fri Aug 17 10:48:53 CEST 2007
Author: gunnar
Update of /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin
In directory doto:/tmp/cvs-serv14657/Kolab_Webadmin/Webadmin
Modified Files:
form.class.php ldap.class.php
Log Message:
htmlentities did no come from the smarty class.
Index: form.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/form.class.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- form.class.php 16 Aug 2007 16:24:54 -0000 1.3
+++ form.class.php 17 Aug 2007 08:48:50 -0000 1.4
@@ -32,8 +32,6 @@
*
*/
-require_once('smarty/Smarty.class.php');
-
function output_headers()
{
header("Content-Type: text/html; charset=UTF-8");
@@ -51,7 +49,7 @@
foreach( $lst as $alias ) {
debug( "looking at $alias, exluding $dn" );
if( $ldap->countMail( $base_dn, $alias, $excludedn ) > 0 ) {
- $str .= _('Email address ').Smarty::htmlentities($alias)._(' collides with an address already used for another user, a vCard or a distribution list.<br />');
+ $str .= _('Email address ').KolabForm::htmlentities($alias)._(' collides with an address already used for another user, a vCard or a distribution list.<br />');
}
}
return $str;
@@ -155,12 +153,12 @@
$str .= '<tr>';
if( ereg( 'readonly', $value['attrs'] ) ) {
$str .= '<td><label>'.$value['name'].'</label></td>';
- $str .= '<td><p class="ctrl">'.Smarty::htmlentities($value['value']).'</p><input name="'
- .$key.'" type="hidden" value="'.Smarty::htmlentities($value['value']).'" /></td>';
+ $str .= '<td><p class="ctrl">'.KolabForm::htmlentities($value['value']).'</p><input name="'
+ .$key.'" type="hidden" value="'.KolabForm::htmlentities($value['value']).'" /></td>';
} else {
$str .= '<td><label for="'.$key.'">'.$value['name'].'</label></td>';
- $str .= '<td><input name="'.$key.'" id="'.$key.'" type="'.$value['type'].'" value="'.Smarty::htmlentities($value['value']).'" '
- .Smarty::htmlentities($value['attrs']).' size="'.$size.'" /></td>';
+ $str .= '<td><input name="'.$key.'" id="'.$key.'" type="'.$value['type'].'" value="'.KolabForm::htmlentities($value['value']).'" '
+ .KolabForm::htmlentities($value['attrs']).' size="'.$size.'" /></td>';
}
$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
$str .= '</tr>'."\n";
@@ -174,22 +172,22 @@
list($uname,$domain) = split('@',$value['value']);
}
if( ereg( 'readonly', $value['attrs'] ) ) {
- $str .= '<td><p class="ctrl">'.Smarty::htmlentities($value['value']).'</p><input name="user_'.$key.'" type="hidden" value="'.
- Smarty::htmlentities($uname).'" /><input name="domain_'.$key.'" type="hidden" value="'.
- Smarty::htmlentities($domain).'" /></td>';
+ $str .= '<td><p class="ctrl">'.KolabForm::htmlentities($value['value']).'</p><input name="user_'.$key.'" type="hidden" value="'.
+ KolabForm::htmlentities($uname).'" /><input name="domain_'.$key.'" type="hidden" value="'.
+ KolabForm::htmlentities($domain).'" /></td>';
} else {
$str .= '<td><label for="user_'.$key.'">'.$value['name'].'</label></td>';
- $str .= '<td><input name="user_'.$key.'" id="user_'.$key.'" type="text" value="'.Smarty::htmlentities($uname).'" '
+ $str .= '<td><input name="user_'.$key.'" id="user_'.$key.'" type="text" value="'.KolabForm::htmlentities($uname).'" '
.$value['attrs'].' size="'.($size-40).'" />';
if( count($value['domains']) == 1 ) {
- $str .= '<input name="domain_'.$key.'" type="hidden" value="'.Smarty::htmlentities($value['domains'][0]).'" />';
- $str .= '<span class="ctrl">@'.Smarty::htmlentities($value['domains'][0]).'</span></td>';
+ $str .= '<input name="domain_'.$key.'" type="hidden" value="'.KolabForm::htmlentities($value['domains'][0]).'" />';
+ $str .= '<span class="ctrl">@'.KolabForm::htmlentities($value['domains'][0]).'</span></td>';
} else {
$str .= '<label for="domain_'.$key.'">@</label><select name="domain_'.$key.'" id="domain_'.$key.'" '.$value['attrs']." >\n";
foreach( $value['domains'] as $dom ) {
if( $dom == $domain ) $s = 'selected="selected"';
else $s = '';
- $str .= '<option value="'.Smarty::htmlentities($dom).'" '.$s.'>'.Smarty::htmlentities($dom).'</option>'."\n";
+ $str .= '<option value="'.KolabForm::htmlentities($dom).'" '.$s.'>'.KolabForm::htmlentities($dom).'</option>'."\n";
}
$str .= '</select>';
$str .= '</td>';
@@ -209,10 +207,10 @@
$str .= '<tr>';
if( ereg( 'readonly', $value['attrs'] ) ) {
$str .= '<td><label>'.$value['name'].'</label></td>';
- $str .= '<td><p class="ctrl">'.Smarty::htmlentities($value['value']).'</p></td>';
+ $str .= '<td><p class="ctrl">'.KolabForm::htmlentities($value['value']).'</p></td>';
} else {
$str .= '<td><label for="'.$key.'">'.$value['name'].'</label></td>';
- $str .= '<td><textarea name="'.$key.'" id="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.Smarty::htmlentities($value['value']).'</textarea></td>';
+ $str .= '<td><textarea name="'.$key.'" id="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.KolabForm::htmlentities($value['value']).'</textarea></td>';
}
$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
$str .= '</tr>'."\n";
@@ -240,8 +238,8 @@
if( is_array( $value['value'] ) ) $checked = ( in_array($opt ,$value['value'] ))?"checked":"";
else $checked = "";
//debug("Checking if $opt is in ".join(",",$value['value'])." :$checked");
- $str .= '<tr><td><input name="'.$key.'[]" type="checkbox" value="'.Smarty::htmlentities($opt).'" '.$value['attrs']." $checked /></td><td>"
- .Smarty::htmlentities($opt).'</td></tr>';
+ $str .= '<tr><td><input name="'.$key.'[]" type="checkbox" value="'.KolabForm::htmlentities($opt).'" '.$value['attrs']." $checked /></td><td>"
+ .KolabForm::htmlentities($opt).'</td></tr>';
}
$str .= '</table></td>';
}
@@ -252,8 +250,8 @@
$str .= '<tr>';
if( ereg( 'readonly', $value['attrs'] ) ) {
$str .= '<td><label>'.$value['name'].'</label></td>';
- $str .= '<td><p class="ctrl">'.Smarty::htmlentities($value['options'][$value['value']]).
- '<input type="hidden" name="'.$key.'" value="'.Smarty::htmlentities($value['value']).'" /></p></td>';
+ $str .= '<td><p class="ctrl">'.KolabForm::htmlentities($value['options'][$value['value']]).
+ '<input type="hidden" name="'.$key.'" value="'.KolabForm::htmlentities($value['value']).'" /></p></td>';
} else {
$str .= '<td><label for="'.$key.'">'.$value['name'].'</label></td>';
$str .= '<td><select name="'.$key.'" id="'.$key.'" '.$value['attrs'].' >'."\n";
@@ -261,7 +259,7 @@
for( $i = 0; $i < count($value['options']); ++$i) {
if( $i == $value['value'] ) $s = 'selected="selected"';
else $s = '';
- $str .= '<option value="'.$i.'" '.$s.'>'.Smarty::htmlentities($value['options'][$i]).'</option>'."\n";
+ $str .= '<option value="'.$i.'" '.$s.'>'.KolabForm::htmlentities($value['options'][$i]).'</option>'."\n";
}
$str .= '</select>';
$str .= '</td>';
@@ -276,8 +274,8 @@
'contact' => _('Contacts'), 'note' => _('Notes'));
if( ereg( 'readonly', $value['attrs'] ) ) {
$str .= '<td><label>'.$value['name'].'</label></td>';
- $str .= '<td><p class="ctrl">'.Smarty::htmlentities($entries[$value['value']]).
- '<input type="hidden" name="'.$key.'" value="'.Smarty::htmlentities($value['value']).'" /></p></td>';
+ $str .= '<td><p class="ctrl">'.KolabForm::htmlentities($entries[$value['value']]).
+ '<input type="hidden" name="'.$key.'" value="'.KolabForm::htmlentities($value['value']).'" /></p></td>';
} else {
$str .= '<td><label for="'.$key.'">'.$value['name'].'</label></td>';
$str .= '<td><select name="'.$key.'" id="'.$key.'" '.$value['attrs'].' >'."\n";
@@ -287,7 +285,7 @@
else
$s = '';
- $str .= '<option value="'.$id.'" '.$s.'>'.Smarty::htmlentities($title).'</option>'."\n";
+ $str .= '<option value="'.$id.'" '.$s.'>'.KolabForm::htmlentities($title).'</option>'."\n";
}
$str .= '</select>';
$str .= '</td>';
@@ -299,11 +297,11 @@
$str .= '<tr>';
if( ereg( 'readonly', $value['attrs'] ) ) {
$str .= '<td><label>'.$value['name'].'</label></td>';
- if( $value['user'] ) $str .= '<td><span class="ctrl">'.Smarty::htmlentities($value['user']).'</span> <span class="ctrl">'.$value['perm'].'</span></td>';
+ if( $value['user'] ) $str .= '<td><span class="ctrl">'.KolabForm::htmlentities($value['user']).'</span> <span class="ctrl">'.$value['perm'].'</span></td>';
} else {
$str .= '<td><label for="user_'.$key.'">'.$value['name'].'</label></td>';
$str .= '<td><input name="user_'.$key.'" id="user_'.$key.'" type="'.$value['type'].'" size="'.($size-15).'" value="'
- .Smarty::htmlentities($value['user']).'" '.$value['attrs'].' />';
+ .KolabForm::htmlentities($value['user']).'" '.$value['attrs'].' />';
$str .= '<select name="perm_'.$key.'">'."\n";
if( $value['perm'] ) $selected_perm = $value['perm'];
else $selected_perm = 'all';
@@ -350,15 +348,15 @@
if( !$user ) continue;
$str .= '<tr><td>';
if( $user == 'anyone' ) $str .= '<p class="ctrl">'._('Anyone').'</p>';
- else $str .= '<p class="ctrl">'.Smarty::htmlentities($user).'</p>';
- $str .= '</td><td><p class="ctrl">'.Smarty::htmlentities($policies[$pol]).'</p></td></tr>'."\n";
+ else $str .= '<p class="ctrl">'.KolabForm::htmlentities($user).'</p>';
+ $str .= '</td><td><p class="ctrl">'.KolabForm::htmlentities($policies[$pol]).'</p></td></tr>'."\n";
} else {
$str .= '<tr><td>';
if( $user == 'anyone' ) {
- $str .= _('Anyone').'<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.Smarty::htmlentities($user).'" '.$value['attrs'].' />';
+ $str .= _('Anyone').'<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.KolabForm::htmlentities($user).'" '.$value['attrs'].' />';
} else {
$str .= '<input name="user_'.$key.'_'.$i.'" type="text" size="'.($size-20)
- .'" value="'.Smarty::htmlentities($user).'" '.$value['attrs'].' />';
+ .'" value="'.KolabForm::htmlentities($user).'" '.$value['attrs'].' />';
}
$str .= '</td><td><select name="policy_'.$key.'_'.$i.'">'."\n";
$j = 0;
@@ -387,7 +385,7 @@
if( !isset( $value['comment'] ) ) $value['comment'] = '';
if( !isset( $value['attrs'] ) ) $value['attrs'] = '';
if( $value['type'] == 'hidden' ) {
- $str .= '<input name="'.$key.'" type="hidden" value="'.Smarty::htmlentities($value['value']).'" '.$value['attrs'].' />';
+ $str .= '<input name="'.$key.'" type="hidden" value="'.KolabForm::htmlentities($value['value']).'" '.$value['attrs'].' />';
}
}
$str .= '</form>';
@@ -489,6 +487,10 @@
else return $default;
}
+ /** UTF-8 friendly htmlentities() */
+ /* static */ function htmlentities( $str ) {
+ return htmlentities( $str, ENT_QUOTES, "UTF-8");
+ }
var $name;
var $template;
Index: ldap.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/ldap.class.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ldap.class.php 16 Aug 2007 16:15:19 -0000 1.3
+++ ldap.class.php 17 Aug 2007 08:48:50 -0000 1.4
@@ -532,12 +532,10 @@
var $cached_domains;
};
-$ldap =& new KolabLDAP;
-
/*
Local variables:
mode: php
- indent-tabs-mode: t
+ indent-tabs-mode: f
tab-width: 4
buffer-file-coding-system: utf-8
End:
More information about the commits
mailing list