steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include form.class.php, 1.18.2.1, 1.18.2.2 mysmarty.php, 1.8.2.1, 1.8.2.2

cvs at intevation.de cvs at intevation.de
Mon Aug 29 23:28:52 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include
In directory doto:/tmp/cvs-serv9358/kolab-webadmin/php/admin/include

Modified Files:
      Tag: kolab_2_0_branch
	form.class.php mysmarty.php 
Log Message:
Backport of fix for Issue915 (encoding problem)

Index: form.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/form.class.php,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -u -d -r1.18.2.1 -r1.18.2.2
--- form.class.php	28 Jul 2005 01:45:41 -0000	1.18.2.1
+++ form.class.php	29 Aug 2005 21:28:50 -0000	1.18.2.2
@@ -82,11 +82,11 @@
 		$str .= '<tr>';
 		$str .= '<td>'.$value['name'].'</td>';
 		if( ereg( 'readonly', $value['attrs'] ) ) {
-		  $str .= '<td><p class="ctrl">'.htmlentities($value['value']).'</p><input name="'
-			.$key.'" type="hidden" value="'.htmlentities($value['value']).'" /></td>';
+		  $str .= '<td><p class="ctrl">'.MySmarty::htmlentities($value['value']).'</p><input name="'
+			.$key.'" type="hidden" value="'.MySmarty::htmlentities($value['value']).'" /></td>';
 		} else {
-		  $str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="'.htmlentities($value['value']).'" '
-			.htmlentities($value['attrs']).' size="'.$size.'" /></td>';
+		  $str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="'.MySmarty::htmlentities($value['value']).'" '
+			.MySmarty::htmlentities($value['attrs']).' size="'.$size.'" /></td>';
 		}
 		$str .= '<td>'.$value['comment'].'</td>';
 		$str .= '</tr>'."\n";
@@ -102,9 +102,9 @@
 		$str .= '<tr>';
 		$str .= '<td>'.$value['name'].'</td>';
 		if( ereg( 'readonly', $value['attrs'] ) ) {
-		  $str .= '<td><p class="ctrl">'.htmlentities($value['value']).'</p></td>';
+		  $str .= '<td><p class="ctrl">'.MySmarty::htmlentities($value['value']).'</p></td>';
 		} else {
-		  $str .= '<td><textarea name="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.htmlentities($value['value']).'</textarea></td>';
+		  $str .= '<td><textarea name="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.MySmarty::htmlentities($value['value']).'</textarea></td>';
 		}
 		$str .= '<td>'.$value['comment'].'</td>';
 		$str .= '</tr>'."\n";
@@ -124,15 +124,15 @@
 		$str .= '<tr>';
 		$str .= '<td>'.$value['name'].'</td>';
 		if( ereg( 'readonly', $value['attrs'] ) ) {
-		  $str .= '<td><p class="ctrl">'.htmlentities($value['options'][$value['value']]).
-			'<input type="hidden" name="'.$key.'" value="'.htmlentities($value['value']).'" /></p></td>';
+		  $str .= '<td><p class="ctrl">'.MySmarty::htmlentities($value['options'][$value['value']]).
+			'<input type="hidden" name="'.$key.'" value="'.MySmarty::htmlentities($value['value']).'" /></p></td>';
 		} else {
 		  $str .= '<td><select name="'.$key.'" '.$value['attrs'].' >'."\n";
 
 		  for( $i = 0; $i < count($value['options']); ++$i) {
 			if( $i == $value['value'] ) $s = 'selected';
 			else $s = '';
-			$str .= '<option value="'.$i.'" '.$s.'>'.htmlentities($value['options'][$i]).'</option>'."\n";
+			$str .= '<option value="'.$i.'" '.$s.'>'.MySmarty::htmlentities($value['options'][$i]).'</option>'."\n";
 		  }
 		  $str .= '</select>';
 		  $str .= '</td>';
@@ -144,10 +144,10 @@
 		$str .= '<tr>';
 		$str .= '<td>'.$value['name'].'</td>';
 		if( ereg( 'readonly', $value['attrs'] ) ) {
-		  if( $value['user'] ) $str .= '<td><span class="ctrl">'.htmlentities($value['user']).'</span> <span class="ctrl">'.$value['perm'].'</span></td>';
+		  if( $value['user'] ) $str .= '<td><span class="ctrl">'.MySmarty::htmlentities($value['user']).'</span> <span class="ctrl">'.$value['perm'].'</span></td>';
 		} else {
 		  $str .= '<td><input name="user_'.$key.'" type="'.$value['type'].'" size="'.($size-15).'" value="'
-			.htmlentities($value['user']).'" '.$value['attrs'].' />';
+			.MySmarty::htmlentities($value['user']).'" '.$value['attrs'].' />';
 		  $str .= '<select name="perm_'.$key.'">'."\n";
 		  if( $value['perm'] ) $selected_perm = $value['perm'];
 		  else $selected_perm = 'all';
@@ -194,15 +194,15 @@
 			if( !$user ) continue;
 			$str .= '<tr><td>';
 			if( $user == 'anyone' ) $str .= '<p class="ctrl">'._('Anyone').'</p>';
-			else $str .= '<p class="ctrl">'.htmlentities($user).'</p>';
-			$str .= '</td><td><p class="ctrl">'.htmlentities($policies[$pol]).'</p></td></tr>'."\n";
+			else $str .= '<p class="ctrl">'.MySmarty::htmlentities($user).'</p>';
+			$str .= '</td><td><p class="ctrl">'.MySmarty::htmlentities($policies[$pol]).'</p></td></tr>'."\n";
 		  } else {
 			$str .= '<tr><td>';
 			if( $user == 'anyone' ) {
-			  $str .= _('Anyone').'<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.htmlentities($user).'" '.$value['attrs'].' />';
+			  $str .= _('Anyone').'<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.MySmarty::htmlentities($user).'" '.$value['attrs'].' />';
 			} else {
 			  $str .= '<input name="user_'.$key.'_'.$i.'" type="text" size="'.($size-20)
-				.'" value="'.htmlentities($user).'" '.$value['attrs'].' />';
+				.'" value="'.MySmarty::htmlentities($user).'" '.$value['attrs'].' />';
 			}
 			$str .= '</td><td><select name="policy_'.$key.'_'.$i.'">'."\n";
 			$j = 0;
@@ -231,7 +231,7 @@
       if( !isset( $value['comment'] ) ) $value['comment'] = '';
       if( !isset( $value['attrs'] ) ) $value['attrs'] = '';
       if( $value['type'] == 'hidden' ) {
-		$str .= '<input name="'.$key.'" type="hidden" value="'.htmlentities($value['value']).'" '.$value['attrs'].' />';
+		$str .= '<input name="'.$key.'" type="hidden" value="'.MySmarty::htmlentities($value['value']).'" '.$value['attrs'].' />';
       }
     }
     $str .= '</form>';

Index: mysmarty.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/mysmarty.php,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -d -r1.8.2.1 -r1.8.2.2
--- mysmarty.php	11 Aug 2005 15:28:26 -0000	1.8.2.1
+++ mysmarty.php	29 Aug 2005 21:28:50 -0000	1.8.2.2
@@ -67,6 +67,11 @@
 											 'code' => 'nl_NL' )  
 									  ));
   }
+
+  /** UTF-8 friendly htmlentities() */
+  /* static */ function htmlentities( $str ) {	
+	return htmlentities( $str, ENT_QUOTES, "UTF-8");
+  }
 };
 
 /*





More information about the commits mailing list