diff --git a/contrib/smarty/plugins/block.render.php b/contrib/smarty/plugins/block.render.php index 35c03472d5f8155ebe85231406e6a8e7ec0a0425..f47fabd5fe4f29803a4df6ae8e9aa8756611da2b 100644 --- a/contrib/smarty/plugins/block.render.php +++ b/contrib/smarty/plugins/block.render.php @@ -20,125 +20,125 @@ */ function smarty_block_render($params, $text, &$smarty) { - /* Skip closing tag </render> */ - if(empty($text)) { - return(""); - } + /* Skip closing tag </render> */ + if(empty($text)) { + return(""); + } - /* Get acl parameter */ - $acl = ""; - if (isset($params['acl'])) { - $acl = $params['acl']; - } + /* 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>"; - } + /* 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 + /* 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 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; + 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; } ?> diff --git a/contrib/smarty/plugins/function.msgPool.php b/contrib/smarty/plugins/function.msgPool.php index 717942f11f9054f6bd69e7e35423eb67d4ab60ef..a50542ecc197be40e4e97714306ce733ddf11ede 100644 --- a/contrib/smarty/plugins/function.msgPool.php +++ b/contrib/smarty/plugins/function.msgPool.php @@ -20,20 +20,20 @@ */ function smarty_function_msgPool($params, &$smarty) { - if(class_available("msgPool") && isset($params['type'])){ - $parameter = array(); - foreach($params as $para => $value){ - if(!preg_match("/^type$/i",$para)){ - $parameter[$para] = $value; - } - } - if(is_callable("msgPool::".$params['type'])){ - echo call_user_func_array(array("msgPool",$params['type']), $parameter); - }else{ - trigger_error("Unknown msgPool function ".$params['type']); - } - }else{ - trigger_error("Unknown class msgPool."); - } + if(class_available("msgPool") && isset($params['type'])){ + $parameter = array(); + foreach($params as $para => $value){ + if(!preg_match("/^type$/i",$para)){ + $parameter[$para] = $value; + } + } + if(is_callable("msgPool::".$params['type'])){ + echo call_user_func_array(array("msgPool",$params['type']), $parameter); + }else{ + trigger_error("Unknown msgPool function ".$params['type']); + } + }else{ + trigger_error("Unknown class msgPool."); + } } ?> diff --git a/include/class_template.inc b/include/class_template.inc index cc332d8b61d1c957a7985e7426c0ec6f2544ac0a..ebb73833d03b8dc032bc970490d862a4952e2a20 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -56,7 +56,8 @@ class template trigger_error("This should not be used for now"); $this->tabObject = objects::open($this->dn, $this->type); } - $tempTabObject = objects::open($this->dn, $this->type); /* Used to know which tab is activated */ + /* Used to know which tab is activated */ + $tempTabObject = objects::open($this->dn, $this->type); $this->attributes = array(); foreach ($tempTabObject->by_object as $class => &$plugin) { if ($plugin->is_account || $plugin->ignore_account) { @@ -79,10 +80,12 @@ class template function reset() { list($this->attrs, $depends) = plugin::tpl_fetch_template($this->dn); - $this->needed = plugin::tpl_needed_attrs($this->attrs, $depends); // This is needed because it removes %askme% values from attrs + /* This is needed because it removes %askme% values from attrs */ + $this->needed = plugin::tpl_needed_attrs($this->attrs, $depends); $this->needed[] = 'base'; $this->tabObject = objects::create($this->type); - $tempTabObject = objects::open($this->dn, $this->type); /* Used to know which tab is activated */ + /* Used to know which tab is activated */ + $tempTabObject = objects::open($this->dn, $this->type); foreach ($tempTabObject->by_object as $class => &$plugin) { if ($plugin->is_account || $plugin->ignore_account) { $this->tabObject->by_object[$class]->is_account = $plugin->is_account; diff --git a/include/functions.inc b/include/functions.inc index c8cb5b0f079fa3eaf0b759136ea134427a0ebab0..eec0db5d6fd707e23a25883e71e7d55b3f3bc7b4 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -2659,7 +2659,8 @@ function check_schema($cfg) */ function get_languages($languages_in_own_language = FALSE, $strip_region_tag = FALSE) { - $tmp_english = array( // locales in english + /* locales in english */ + $tmp_english = array( "ar" => "Arabic", "ca_ES" => "Catalan", "cs_CZ" => "Czech", @@ -2686,7 +2687,8 @@ function get_languages($languages_in_own_language = FALSE, $strip_region_tag = F $ret = array(); if ($languages_in_own_language) { - $tmp_ownlang = array( // locales in their own language + /* locales in their own language */ + $tmp_ownlang = array( "ar" => "عربية", "ca_ES" => "Català ", "cs_CZ" => "Česky", diff --git a/include/password-methods/class_password-methods-sasl.inc b/include/password-methods/class_password-methods-sasl.inc index aa9285a24d13c234c8f86419cd61767dfdccc599..99089c77f7d40dd8d9511398caf8b9014137111d 100644 --- a/include/password-methods/class_password-methods-sasl.inc +++ b/include/password-methods/class_password-methods-sasl.inc @@ -28,7 +28,8 @@ * \see passwordMethod */ class passwordMethodsasl extends passwordMethod { - var $uid = ""; // uid, or exop specified field value + /* uid, or exop specified field value */ + var $uid = ""; var $realm = ""; var $exop = ""; @@ -86,7 +87,8 @@ class passwordMethodsasl extends passwordMethod { } return '{SASL}'.$this->uid.'@'.$this->realm; } else { - return '{SASL}'.$this->uid; // may not be the uid, see saslExop option + /* may not be the uid, see saslExop option */ + return '{SASL}'.$this->uid; } } diff --git a/include/simpleplugin/attributes/class_FileAttribute.inc b/include/simpleplugin/attributes/class_FileAttribute.inc index 54f5d8fa7c754bbb0e4aa497715cef33c69e5976..42fbfb5c82e06dab6d9d67ca27706f2fd350b80a 100644 --- a/include/simpleplugin/attributes/class_FileAttribute.inc +++ b/include/simpleplugin/attributes/class_FileAttribute.inc @@ -41,7 +41,8 @@ class FileAttribute extends Attribute // Reading content $this->readFile($handle); } - $_FILES[$this->getHtmlId()]['name'] = ""; // so that we only handle the file once + /* so that we only handle the file once */ + $_FILES[$this->getHtmlId()]['name'] = ""; } } @@ -304,7 +305,8 @@ class ImageAttribute extends FileAttribute { $this->setValue($this->inputValue($this->getValue())); $id = $this->getHtmlId(); - srand((double)microtime() * 1000000); // Just to be sure the image is not cached + /* Just to be sure the image is not cached */ + srand((double)microtime() * 1000000); $display = '<img id="'.$id.'_img"'. ($this->disabled? 'disabled="disabled"':''). ' src="getbin.php?rand='.rand(0, 10000).'"'. diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index 1c12a710031773fbaafb9e8abb3da5cb612dea15..58e6d9455873365092581b0b8531877538417534 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -570,7 +570,8 @@ class Attribute $type[] = $class; $class = get_parent_class($class); } - $type[] = 'Attribute'; // To avoid empty array + /* To avoid empty array */ + $type[] = 'Attribute'; $infos = array( 'htmlid' => $this->getHtmlId(), 'label' => $this->getLabel(), @@ -614,7 +615,8 @@ class Attribute */ function getAclInfo () { - if (empty($this->acl)) { // If acl is not empty, we use an acl that is not ours, we have no acl to create + /* If acl is not empty, we use an acl that is not ours, we have no acl to create */ + if (empty($this->acl)) { return array( 'name' => $this->getHtmlId(), 'desc' => $this->getDescription() diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc index e2e0b45825535da9f6985278d742866dfeeb2ee4..3088ae72ba411c37ef1a0ceae807ab248240e76e 100644 --- a/include/simpleplugin/class_simpleManagement.inc +++ b/include/simpleplugin/class_simpleManagement.inc @@ -66,7 +66,8 @@ class templateDialog trigger_error('redefining template object'); } $this->template = new template($this->type, $_POST['template']); - unset($_POST['template']); // This method can loop if there are several targets + /* This method can loop if there are several targets */ + unset($_POST['template']); } if (is_object($this->template)) { if ($this->target !== NULL) { diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 888b865ec483fa3096378f57fd55b1f1ab5f8f59..1fb0653637141c8279211056dd3616d922e77620 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -202,7 +202,8 @@ class simplePlugin extends plugin foreach ($this->attributesInfo as &$sectionInfo) { foreach ($sectionInfo['attrs'] as $name => &$attr) { if (in_array($name, $this->preInitAttributes)) { - continue; // skip the preInit ones + /* skip the preInit ones */ + continue; } $attr->setParent($this); $attr->loadValue($this->attrs); diff --git a/include/simpleplugin/class_simpleTabs.inc b/include/simpleplugin/class_simpleTabs.inc index df918dab16a6cbf0323b278fd457e1e28973df88..b8a0ea7cbcb736a31d77c424d0573a23864cd3f1 100644 --- a/include/simpleplugin/class_simpleTabs.inc +++ b/include/simpleplugin/class_simpleTabs.inc @@ -43,9 +43,11 @@ class simpleTabs var $by_object = array(); var $acl_category; - var $parent = NULL; // A parent object if available, e.g. a management class. + /* A parent object if available, e.g. a management class. */ + var $parent = NULL; - var $read_only = FALSE; // Used when the entry is opened as "readonly" due to locks. + /* Used when the entry is opened as "readonly" due to locks. */ + var $read_only = FALSE; var $baseclass = ""; @@ -173,7 +175,8 @@ class simpleTabs } else { $baseobject->base = dn2base(get_userinfo()->dn); } - if (!($baseobject instanceOf simplePlugin) && is_object($baseobject->baseSelector)) { // For some plugins not yet migrated to simple plugin. + /* For some plugins not yet migrated to simple plugin. */ + if (!($baseobject instanceOf simplePlugin) && is_object($baseobject->baseSelector)) { $baseobject->baseSelector->setBase($baseobject->base); } @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixed base'); diff --git a/plugins/addons/dashboard/class_dashBoardUsers.inc b/plugins/addons/dashboard/class_dashBoardUsers.inc index 8efebea97c3f5d29c803555ad033af4f787791b2..4f4b6241f62f1045085002c56c5908a48abe48d5 100644 --- a/plugins/addons/dashboard/class_dashBoardUsers.inc +++ b/plugins/addons/dashboard/class_dashBoardUsers.inc @@ -128,7 +128,7 @@ class dashboardUsers extends simplePlugin */ /* getting the date in TIMESTAMP UNIX format */ - $today = floor(time() / 86400); // 24 * 60 * 60 + $today = floor(time() / 86400); /* Fetch global value from fusiondirectory.conf */ $next_expired_days = $config->get_cfg_value('dashboardExpiredAccountsDays', 15); @@ -175,7 +175,7 @@ class dashboardUsers extends simplePlugin $manager_phone = ''; } - $human_shadowExpire = date('d.m.Y', $attrs['shadowExpire'][0] * 86400); // 24 * 60 * 60 + $human_shadowExpire = date('d.m.Y', $attrs['shadowExpire'][0] * 86400); return array( 'uid' => $attrs['uid'][0], diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc index 28b3b493b419bb34b6a7f0a37d309d0b0b40eaf8..41e51104edc9594e0f65e282526a68966efa70e9 100644 --- a/plugins/admin/acl/class_aclManagement.inc +++ b/plugins/admin/acl/class_aclManagement.inc @@ -166,7 +166,8 @@ class aclManagement extends simpleManagement function configureHeadpage () { - $this->headpage->objectTypes = array(); // Remove department types so that we don't mistake assignments with them. + /* Remove department types so that we don't mistake assignments with them. */ + $this->headpage->objectTypes = array(); $this->headpage->registerElementFilter('filterLabel', 'aclManagement::filterLabel'); parent::configureHeadpage(); } diff --git a/plugins/admin/groups/class_ogroup.inc b/plugins/admin/groups/class_ogroup.inc index f78c9437dbedbb501f5fd2377570139a0b8b5441..c3c2de7d84379b5fbab780e59f3da87e1a344976 100644 --- a/plugins/admin/groups/class_ogroup.inc +++ b/plugins/admin/groups/class_ogroup.inc @@ -115,7 +115,8 @@ class ObjectsAttribute extends GenericDialogAttribute function listObjectTypes() { - $this->getDisplayValues(); // refresh types and displays + /* refresh types and displays */ + $this->getDisplayValues(); return '['.join(array_unique($this->types)).']'; } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index eeba0d55b5b54a2e37bc51dabf3bec4bd4e671ee..fa02df1c2b63221ad260b6d77a7c8b618c3f635c 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -350,7 +350,8 @@ class user extends simplePlugin _('Phone'), _('Business phone number'), 'telephoneNumber', FALSE ), - new PhoneNumberAttribute ( // TODO: mobile attribute + /* TODO: mobile attribute */ + new PhoneNumberAttribute ( _('Mobile'), _('Business mobile number'), 'mobile', FALSE ), diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index f10c9f77544b5575bba440feac27ee9dca3f5d6e..0a5fa4c1d5a84ae7b079369d72d9c6063a137a02 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -32,7 +32,7 @@ class EpochDaysDateAttribute extends DateAttribute { - public static $secondsPerDay = 86400; //60 * 60 * 24 + public static $secondsPerDay = 86400; function __construct ($label, $description, $ldapName, $required, $defaultValue = 'now', $acl = "") { @@ -392,7 +392,8 @@ class posixAccount extends simplePlugin if ($ldap->count() > 0) { /* The copied user had its own group */ - $this->primaryGroup = 0; // switch back to automatic + /* switch back to automatic */ + $this->primaryGroup = 0; } $this->force_ids = FALSE;