1 <?php
3 function smarty_block_render($params, $text, &$smarty)
4 {
5 $text = stripslashes($text);
6 $acl = "";
8 if (isset($params['acl'])) {
9 $acl = $params['acl'];
10 unset($params['acl']);
11 }
13 /* Read / Write*/
14 if(preg_match("/w/i",$acl)){
15 return ($text);
16 }
18 $from = array("/name=/i");
19 $to = array("disabled name=");
20 $text = preg_replace($from,$to,$text);
22 /* Read only */
23 if(preg_match("/r/i",$acl)){
24 return($text);
25 }
27 /* No acls */
28 if(preg_match("/type['\"= ].*submit/",$text)){
29 $text = preg_replace("/submit/","button",$text);
30 }else{
31 $text = preg_replace("/value=['\" ].*['\" ]/","",$text);
32 }
34 return $text;
35 }
37 ?>