c29621f2dd8c2c0ada487c669aaf7754633b0406
1 <?php
3 function smarty_block_render($params, $text, &$smarty)
4 {
5 $text = stripslashes($text);
6 $acl = "";
8 /* Skip closing tag </render> */
9 if(empty($text)) {
10 return("");
11 }
13 /* Get acl parameter */
14 if (isset($params['acl'])) {
15 $acl = $params['acl'];
16 unset($params['acl']);
17 }
19 echo "<font color='blue' size='2'>".$acl."</font>";
21 /* Read / Write*/
22 if(preg_match("/w/i",$acl)){
23 return ($text);
24 }
26 /* Disable objects, but keep those active that have mode=read_active */
27 if(!(isset($params['mode']) && $params['mode']=='readable')){
28 $from = array("/name=/i");
29 $to = array(" disabled name=");
30 $text = preg_replace($from,$to,$text);
32 /* Replace picture if object is disabled */
33 if(isset($params['disable_picture'])){
34 $syn = "/src=['\"][a-z0-9\/.]*['\"]/i";
35 $new = "src=\"".$params['disable_picture']."\"";
36 $text = preg_replace($syn,$new,$text);
37 }
39 }
41 /* Read only */
42 if(preg_match("/r/i",$acl)){
43 return($text);
44 }
46 /* No acls */
47 if(preg_match("/type['\"= ].*submit/",$text)){
48 $text = preg_replace("/submit/","button",$text);
49 }else{
50 $text = preg_replace("/value=['\" ].*['\" ]/","",$text);
51 }
53 return $text;
54 }
56 ?>