/usr/share/php/smarty3/plugins/block.render.php is in fusiondirectory-smarty3-acl-render 1.0.8.2-5+deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | <?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003-2010 Cajus Pollmeier
Copyright (C) 2011-2013 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
function smarty_block_render($params, $text, &$smarty)
{
/* Skip closing tag </render> */
if(empty($text)) {
return("");
}
/* Get acl parameter */
$acl = "";
if (isset($params['acl'])) {
$acl = $params['acl'];
}
/* Debug output */
if (session::is_set('DEBUGLEVEL') && session::get('DEBUGLEVEL') & DEBUG_ACL ){
echo "<div style='color:blue;font-size:2;'> ".$acl."</div>";
}
/* Parameter : checkbox, checked
* If the parameter 'checkbox' is given, we create a html checkbox in front
* of the current object.
* The parameter 'checked' specifies whether the box is checked or not.
* The checkbox disables or enables the current object.
*/
if(isset($params['checkbox']) && $params['checkbox']){
/* Detect name and id of the current object */
$use_text = preg_replace("/\n/"," ",$text);
$name = preg_replace('/^.* name[ ]*=[ ]*("|\')([^\"\' ]*).*$/i',"\\2",$use_text);
/* Detect id */
if(preg_match("/ id=(\"|')[^\"']*(\"|')/i",$text)){
$id = preg_replace('/^.* id[ ]*=[ ]*("|\')([^\"\' ]*).*$/i',"\\2",$use_text);
}else{
$id = "";
}
/* Is the box checked? */
isset($params['checked'])&&$params['checked'] ? $check = " checked " : $check = "";
/* If name isset, we have a html input field */
if(!empty($name)){
/* Print checkbox */
echo "<input type='checkbox' name='use_".$name."' ".$check."
onClick=\"changeState('".$name."');\" class='center'>";
/* Disable current object, if checkbox isn't checked */
if($check == ""){
$text = preg_replace("/name=/i"," disabled name=",$text);
}
/* Add id to current entry, if it is missing */
if($id == ""){
$text = preg_replace("/name=/i"," id=\"".$name."\" name=",$text);
}
}
}
/* Read / Write*/
if(preg_match("/w/i",$acl)){
return ($text);
}
$text = preg_replace ("/\n/","GOSA_LINE_BREAK",$text);
/* Disable objects, but keep those active that have mode=read_active */
if(!(isset($params['mode']) && ($params['mode']=='read_active') && preg_match("/(r|w)/",$acl))){
/* Disable options && greyout divlists */
$from = array("/class=['\"]list1nohighlight['\"]/i",
"/class=['\"]list0['\"]/i",
"/class=['\"]list1['\"]/i",
"/class=['\"]sortableListItem[^'\"]*['\"]/i");
$to = array("class='list1nohighlightdisabled'",
"class='list1nohighlightdisabled'",
"class='list1nohighlightdisabled'",
"class='sortableListItemDisabled'");
if(!preg_match('/ disabled(="disabled")?( |\/?>)/', $text)){
$from [] = "/name=/i" ;
$to [] = "disabled name=";
}
$text = preg_replace($from,$to,$text);
/* Replace picture if object is disabled */
if(isset($params['disable_picture'])){
$syn = "/src=['\"][^\"']*['\"]/i";
$new = "src=\"".$params['disable_picture']."\"";
$text = preg_replace($syn,$new,$text);
}
}
/* Read only */
if(preg_match("/r/i",$acl)){
return(preg_replace("/GOSA_LINE_BREAK/","\n",$text));
}
/* No acls */
if(preg_match("/type['\"= ].*submit/",$text)){
$text = preg_replace("/submit/","button",$text);
}else{
$text = preg_replace("/value=['\"][^\"']*['\"]/","",$text);
}
/* Remove select options */
$from = array("#<option.*<\/option>#i",
"/(<textarea.*>).*(<\/textarea>)/i",
"/^(.*<input.*)checked(.*>.*)$/i");
$to = array(" ",
"\\1\\2",
"\\1 \\2");
$text = preg_replace($from,$to,$text);
$text = preg_replace("/GOSA_LINE_BREAK/","\n",$text);
return $text;
}
?>
|