From 360e580d792f1e77e993d08da94c80e53f9dff1e Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 16 Feb 2005 21:00:19 +0000 Subject: [PATCH] fixed call-by-reference warnings --- lam/lib/cache.inc | 6 +++--- lam/lib/modules.inc | 18 ++++++++++-------- lam/lib/modules/account.inc | 6 +++--- lam/lib/modules/ieee802device.inc | 4 ++-- lam/lib/modules/inetLocalMailRecipient.inc | 4 ++-- lam/lib/modules/inetOrgPerson.inc | 6 +++--- lam/lib/modules/nisMailAlias.inc | 4 ++-- lam/lib/modules/posixAccount.inc | 10 +++++----- lam/lib/modules/posixGroup.inc | 10 +++++----- lam/lib/modules/quota.inc | 6 +++--- lam/lib/modules/sambaAccount.inc | 16 ++++++++++------ lam/lib/modules/sambaGroupMapping.inc | 6 +++--- lam/lib/modules/sambaSamAccount.inc | 10 +++++----- lam/lib/modules/shadowAccount.inc | 6 +++--- lam/lib/xml_parser.inc | 2 +- 15 files changed, 60 insertions(+), 54 deletions(-) diff --git a/lam/lib/cache.inc b/lam/lib/cache.inc index 6eee7790..f684c64f 100644 --- a/lam/lib/cache.inc +++ b/lam/lib/cache.inc @@ -197,7 +197,7 @@ class cache { foreach ($scopes as $scope) { // Get Scope If ($scope != '*') - $suffix = call_user_func(array(&$_SESSION['config'], 'get_'.ucfirst($scope).'Suffix')); + $suffix = call_user_func(array($_SESSION['config'], 'get_'.ucfirst($scope).'Suffix')); else $suffix = ''; // Get Data from ldap $search = $this->attributes[$scope]; @@ -239,7 +239,7 @@ class cache { if ($allowed_types[$i]!='*') { // *** fixme, where is get_DomainSuffix If ($scope != '*') - $suffix = call_user_func(array(&$_SESSION['config'], 'get_'.ucfirst($allowed_types[$i]).'Suffix')); + $suffix = call_user_func(array($_SESSION['config'], 'get_'.ucfirst($allowed_types[$i]).'Suffix')); else $suffix = ''; if (substr($suffix, $dn)) $singlescope = $allowed_types[$i]; } @@ -250,7 +250,7 @@ class cache { // Get Scope foreach ($allowed_types as $scope) { if ($scope!='*') { - $suffix = call_user_func(array(&$_SESSION['config'], 'get_'.ucfirst($scope).'Suffix')); + $suffix = call_user_func(array($_SESSION['config'], 'get_'.ucfirst($scope).'Suffix')); if (strpos($dn, $suffix)) $singlescope = $scope; } } diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 6c22e8a5..c7282ff2 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -640,7 +640,7 @@ class accountContainer { } } } - else $result = call_user_func(array(&$this->module[$this->order[$this->current_page]], 'proccess_'.$this->subpage), &$post); + else $result = call_user_func(array(&$this->module[$this->order[$this->current_page]], 'proccess_'.$this->subpage), $post); } if (is_string($result)) $this->subpage = $result; if (is_int($result)) { @@ -720,7 +720,7 @@ class accountContainer { if (count($table)!=0) $return[] = array ( 0 => array ( 'kind' => 'table', 'value' => $table ) ); // loop through all suffixes - $rootsuffix = call_user_func(array(&$_SESSION['config'], 'get_' . ucfirst($this->type) . 'Suffix')); + $rootsuffix = call_user_func(array($_SESSION['config'], 'get_' . ucfirst($this->type) . 'Suffix')); foreach ($_SESSION['ldap']->search_units($rootsuffix) as $suffix) { if ($this->dn == $suffix) $option_selected = $suffix; $suffixes[] = $suffix; @@ -766,8 +766,10 @@ class accountContainer { 'value' => _('Back to account list'))); } } - else $return = call_user_func(array($this->module[$this->order[$this->current_page]], 'display_html_'.$this->subpage), &$post); - $this->parse_html($this->order[$this->current_page], $return); + else $return = call_user_func(array($this->module[$this->order[$this->current_page]], 'display_html_'.$this->subpage), $post); + $y = 5000; + $z = 10000; + $this->parse_html($this->order[$this->current_page], $return, $y, $z); // Display rest of html-page echo "\n"; echo "\n"; @@ -777,7 +779,7 @@ class accountContainer { return 0; } - function parse_html($module, $input, $y=5000, $z=10000) { + function parse_html($module, $input, &$y, &$z) { /* $y and $z are used to change the the taborder. * Unfortunatly we don't now how many taborders we need * Every link also help needs a taborder. @@ -826,7 +828,7 @@ class accountContainer { echo ">\n"; echo "
\n"; if ($input[$i][$j]['legend']!='') echo "" . $input[$i][$j]['legend'] . "\n"; - $this->parse_html($module, $input[$i][$j]['value'], &$y, &$z); + $this->parse_html($module, $input[$i][$j]['value'], $y, $z); echo "
\n"; break; case 'select': @@ -859,7 +861,7 @@ class accountContainer { echo "\n"; - $this->parse_html($module, $input[$i][$j]['value'], &$y, &$z); + $this->parse_html($module, $input[$i][$j]['value'], $y, $z); echo "\n"; break; case 'help': @@ -1247,7 +1249,7 @@ class accountContainer { // TODO remove this function? - function proccess_profile($post) { + function proccess_profile(&$post) { $return = array(); $module = array_keys ($this->module); foreach ($module as $singlemodule) { diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc index 8498129a..a7850720 100644 --- a/lam/lib/modules/account.inc +++ b/lam/lib/modules/account.inc @@ -143,7 +143,7 @@ class account extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { // Load attributes $this->attributes['description'][0] = $post['description']; return 0; @@ -153,7 +153,7 @@ class account extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ), 1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['description'][0] ), @@ -162,7 +162,7 @@ class account extends baseModule { return $return; } - function display_html_delete($post) { + function display_html_delete(&$post) { return 0; } diff --git a/lam/lib/modules/ieee802device.inc b/lam/lib/modules/ieee802device.inc index dcf147de..d78c786e 100644 --- a/lam/lib/modules/ieee802device.inc +++ b/lam/lib/modules/ieee802device.inc @@ -138,7 +138,7 @@ class ieee802Device extends baseModule { * * @param array $post HTTP-POST values */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { $return = array(); // list current MACs for ($i = 0; $i < sizeof($this->attributes['macAddress']); $i++) { @@ -163,7 +163,7 @@ class ieee802Device extends baseModule { * * @param array $post HTTP-POST values */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { $this->triggered_messages = array(); $this->attributes['macAddress'] = array(); // check old MACs diff --git a/lam/lib/modules/inetLocalMailRecipient.inc b/lam/lib/modules/inetLocalMailRecipient.inc index 5ba5654a..0d49c739 100644 --- a/lam/lib/modules/inetLocalMailRecipient.inc +++ b/lam/lib/modules/inetLocalMailRecipient.inc @@ -192,7 +192,7 @@ class inetLocalMailRecipient extends baseModule { * * @param array $post HTTP-POST values */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { $return = array(); // mail routing address $return[] = array( @@ -227,7 +227,7 @@ class inetLocalMailRecipient extends baseModule { * * @param array $post HTTP-POST values */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { $this->triggered_messages = array(); $this->attributes['mailRoutingAddress'] = array(); $this->attributes['mailLocalAddress'] = array(); diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index cc4e2bb2..8fc8a11e 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -350,7 +350,7 @@ class inetOrgPerson extends baseModule { return 0; } - function proccess_attributes($post) { + function proccess_attributes(&$post) { // Load attributes $this->attributes['description'][0] = $post['description']; $this->attributes['sn'][0] = $post['sn']; @@ -397,7 +397,7 @@ class inetOrgPerson extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ), 1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['description'][0] ), @@ -457,7 +457,7 @@ class inetOrgPerson extends baseModule { return $return; } - function display_html_delete($post) { + function display_html_delete(&$post) { return 0; } diff --git a/lam/lib/modules/nisMailAlias.inc b/lam/lib/modules/nisMailAlias.inc index f3658bc5..44436713 100644 --- a/lam/lib/modules/nisMailAlias.inc +++ b/lam/lib/modules/nisMailAlias.inc @@ -162,7 +162,7 @@ class nisMailAlias extends baseModule { * * @param array $post HTTP-POST values */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { $return = array(); // alias name $return[] = array( @@ -192,7 +192,7 @@ class nisMailAlias extends baseModule { * * @param array $post HTTP-POST values */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { $this->triggered_messages = array(); $this->attributes['cn'] = array(); $this->attributes['rfc822MailMember'] = array(); diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index d91e4d38..8c97c3b3 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -585,7 +585,7 @@ class posixAccount extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { $this->attributes['homeDirectory'][0] = $post['homeDirectory']; $this->attributes['loginShell'][0] = $post['loginShell']; if (isset($post['gecos'])) $this->attributes['gecos'][0] = $post['gecos']; @@ -787,7 +787,7 @@ class posixAccount extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_group($post) { + function proccess_group(&$post) { do { // X-Or, only one if() can be true if (isset($post['addgroups']) && isset($post['addgroups_button'])) { // Add groups to list // Add new group @@ -810,7 +810,7 @@ class posixAccount extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { $groups = $_SESSION['cache']->findgroups(); // list of all groupnames $shelllist = getshells(); // list of all valid shells @@ -868,7 +868,7 @@ class posixAccount extends baseModule { return $return; } - function display_html_delete($post) { + function display_html_delete(&$post) { if ($_SESSION[$this->base]->type=='user' && isset($_SESSION['config']->scriptPath)) { $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Delete home directory') ), 1 => array ( 'kind' => 'input', 'name' => 'deletehomedir', 'type' => 'checkbox'), @@ -877,7 +877,7 @@ class posixAccount extends baseModule { return $return; } - function display_html_group($post) { + function display_html_group(&$post) { // load list with all groups $dn_groups = $_SESSION['cache']->get_cache('gidNumber', 'posixGroup', 'group'); $DNs = array_keys($dn_groups); diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index e6901d46..393e1bfc 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -121,7 +121,7 @@ class posixGroup extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Groupname").'*' ), 1 => array ( 'kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '20', 'maxlength' => '20', 'value' => $this->attributes['cn'][0]), 2 => array ('kind' => 'help', 'value' => 'cn')); @@ -159,13 +159,13 @@ class posixGroup extends baseModule { } - function display_html_delete($post) { + function display_html_delete(&$post) { // Get list of primary groupmembers. return 0; } - function display_html_user($post) { + function display_html_user(&$post) { // load list with all groups $dn_users = $_SESSION['cache']->get_cache('uid', 'posixAccount', 'user'); if (is_array($dn_users)) { @@ -441,7 +441,7 @@ class posixGroup extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { $this->attributes['description'][0] = $post['description']; if (($post['userPassword_lock'] && $post['userPassword_invalid']) || ($post['userPassword_nopassword'] && $post['userPassword_invalid'])) { @@ -607,7 +607,7 @@ class posixGroup extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_user($post) { + function proccess_user(&$post) { do { // X-Or, only one if() can be true if (isset($post['addusers']) && isset($post['addusers_button'])) { // Add groups to list // Add new user diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index a560a699..608768e1 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -248,7 +248,7 @@ class quota extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { // Write all general values into $account_new $i=0; // loop for every mointpoint with quotas @@ -286,7 +286,7 @@ class quota extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Mountpoint') ), 1 => array ( 'kind' => 'text', 'text' => _('Used blocks') ), @@ -325,7 +325,7 @@ class quota extends baseModule { return $return; } - function display_html_delete($post) { + function display_html_delete(&$post) { return 0; } diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index 48886f12..c3b382bc 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -381,7 +381,11 @@ class sambaAccount extends baseModule { return $return; } - // Constructor + /** + * Initializes the module after it became part of an accountContainer + * + * @param string $base the name of the accountContainer object ($_SESSION[$base]) + */ function init($base) { // call parent init parent::init($base); @@ -525,7 +529,7 @@ class sambaAccount extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { $this->attributes['domain'][0] = $post['domain']; // Start character $flag = "["; @@ -658,7 +662,7 @@ class sambaAccount extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_userWorkstations($post) { + function proccess_userWorkstations(&$post) { // Load attributes if ($_SESSION[$this->base]->type=='user') { do { // X-Or, only one if() can be true @@ -709,7 +713,7 @@ class sambaAccount extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { if ($_SESSION[$this->base]->type=='user') { $canchangedate = getdate($this->attributes['pwdCanChange'][0]); $mustchangedate = getdate($this->attributes['pwdMustChange'][0]); @@ -825,7 +829,7 @@ class sambaAccount extends baseModule { return $return; } - function display_html_delete($post) { + function display_html_delete(&$post) { return 0; } @@ -833,7 +837,7 @@ class sambaAccount extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_userWorkstations($post) { + function display_html_userWorkstations(&$post) { if ($_SESSION[$this->base]->type=='user') { // Get list of all hosts. $result = $_SESSION['cache']->get_cache('uid', 'sambaAccount', 'host'); diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 5869d1b6..a606bf63 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -142,7 +142,7 @@ class sambaGroupMapping extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { // Get Domain SID from name $sambaDomains = search_domains($_SESSION['config']->get_domainSuffix()); // Get Domain-SID from group SID @@ -191,7 +191,7 @@ class sambaGroupMapping extends baseModule { return $return; } - function display_html_delete($post) { + function display_html_delete(&$post) { return 0; } @@ -390,7 +390,7 @@ class sambaGroupMapping extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { // Save attributes $this->attributes['displayName'][0] = $post['displayName']; $this->attributes['sambaGroupType'][0] = $this->sambaGroupTypes[$post['sambaGroupType']]; diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index c1969082..0a2052a6 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -498,7 +498,7 @@ class sambaSamAccount extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { // Save attributes $this->attributes['sambaDomainName'][0] = $post['sambaDomainName']; // Get Domain SID from name @@ -639,7 +639,7 @@ class sambaSamAccount extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_sambaUserWorkstations($post) { + function proccess_sambaUserWorkstations(&$post) { // Load attributes if ($_SESSION[$this->base]->type=='user') { do { // X-Or, only one if() can be true @@ -690,7 +690,7 @@ class sambaSamAccount extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { // Get Domain SID from name $sambaDomains = search_domains($_SESSION['config']->get_domainSuffix()); for ($i=0; $ibase]->type=='user') { // Get list of all hosts. $result = $_SESSION['cache']->get_cache('uid', 'sambaSamAccount', 'host'); diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 21f26778..1e020573 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -268,7 +268,7 @@ class shadowAccount extends baseModule { /* Write variables into object and do some regexp checks */ - function proccess_attributes($post) { + function proccess_attributes(&$post) { // Load attributes $this->attributes['shadowMin'][0] = $post['shadowMin']; $this->attributes['shadowMax'][0] = $post['shadowMax']; @@ -294,7 +294,7 @@ class shadowAccount extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes(&$post) { // Use dd-mm-yyyy format of date because it's easier to read for humans $date = getdate ($this->attributes['shadowExpire'][0]*3600*24); @@ -326,7 +326,7 @@ class shadowAccount extends baseModule { return $return; } - function display_html_delete($post) { + function display_html_delete(&$post) { return 0; } diff --git a/lam/lib/xml_parser.inc b/lam/lib/xml_parser.inc index 8243c854..9f026e4d 100644 --- a/lam/lib/xml_parser.inc +++ b/lam/lib/xml_parser.inc @@ -49,7 +49,7 @@ class xmlParser { */ function xmlParser() { $this->xmlParser = xml_parser_create(); - xml_set_object($this->xmlParser,&$this); + xml_set_object($this->xmlParser,$this); xml_parser_set_option($this->xmlParser, XML_OPTION_CASE_FOLDING, 1); xml_parser_set_option($this->xmlParser, XML_OPTION_SKIP_WHITE, 1); }