Code

Added initial smarty acl block function
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Jul 2006 07:56:30 +0000 (07:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Jul 2006 07:56:30 +0000 (07:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4175 594d385d-05f5-0310-b6e9-bd551577e9d8

include/smarty/plugins/block.render.php [new file with mode: 0755]

diff --git a/include/smarty/plugins/block.render.php b/include/smarty/plugins/block.render.php
new file mode 100755 (executable)
index 0000000..1aa87ba
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+function smarty_block_render($params, $text, &$smarty)
+{
+       $text = stripslashes($text);
+
+       if (isset($params['acl'])) {
+               $acl = $params['acl'];
+               unset($params['acl']);
+       }
+
+       if(preg_match("/w/i",$acl)){
+               
+               /* Read / Write*/
+
+       }elseif(preg_match("/r/i",$acl)){
+               
+               /* Read only */
+               $from   =  array("/name=/i");
+               $to     =  array("disabled name=");
+               $text = preg_replace($from,$to,$text);
+
+       }elseif(empty($acl)){
+               
+               /* No rights */
+               $text= "&nbsp;";
+               
+       }else{
+               // unknown
+               $text ="&nbsp;";
+       }
+               
+
+       return $text;
+}
+
+?>