From f1e3cb7ad095ea89d338cc84e162bac4eb66b400 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Fri, 14 Aug 2009 20:18:08 +0000 Subject: [PATCH] PHP 5.3 compatibility --- lam/lib/lamdaemon.inc | 2 +- lam/lib/modules.inc | 2 +- lam/lib/modules/dhcp_settings.inc | 2 +- lam/lib/modules/kolabUser.inc | 12 ++++++------ lam/lib/modules/quota.inc | 14 +++++++------- lam/lib/profiles.inc | 2 +- lam/templates/tests/lamdaemonTest.php | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lam/lib/lamdaemon.inc b/lam/lib/lamdaemon.inc index 320ea441..53da1663 100644 --- a/lam/lib/lamdaemon.inc +++ b/lam/lib/lamdaemon.inc @@ -128,7 +128,7 @@ function lamdaemonSSH($commands, $server) { return $return; } usleep(100); - $read = split("\n", trim(fread($shell, 100000))); + $read = explode("\n", trim(fread($shell, 100000))); if ((sizeof($read) == 1) && (!isset($read[0]) || ($read[0] == ""))) continue; for ($i = 0; $i < sizeof($read); $i++) { $return[] = $read[$i]; diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index e79e917b..e366f87a 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -1482,7 +1482,7 @@ class accountContainer { $this->dn = substr($dn, strpos($dn, ',')+1); $this->dn_orig = $dn; // extract RDN - $this->rdn = split("=", substr($dn, 0, strpos($dn, ','))); + $this->rdn = explode("=", substr($dn, 0, strpos($dn, ','))); $this->rdn = $this->rdn[0]; $attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry); // remove 'count' entries and numerical entries diff --git a/lam/lib/modules/dhcp_settings.inc b/lam/lib/modules/dhcp_settings.inc index 020ee5aa..145085b6 100644 --- a/lam/lib/modules/dhcp_settings.inc +++ b/lam/lib/modules/dhcp_settings.inc @@ -40,7 +40,7 @@ $Id$ **/ if (!function_exists('check_ip')) { function check_ip($ip,$subnet=false) { - $part = split("[.]", $ip); + $part = explode(".", $ip); // Wenn... Keine 4 Segmente gefunden wurde if (count($part) != 4) { return false; diff --git a/lam/lib/modules/kolabUser.inc b/lam/lib/modules/kolabUser.inc index 46b7e50a..7c6150bb 100644 --- a/lam/lib/modules/kolabUser.inc +++ b/lam/lib/modules/kolabUser.inc @@ -312,7 +312,7 @@ class kolabUser extends baseModule { // default invitation policy $defaultInvPol = $this->invitationPolicies['ACT_MANUAL']; for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) { - $parts = split(":", $this->attributes['kolabInvitationPolicy'][$i]); + $parts = explode(":", $this->attributes['kolabInvitationPolicy'][$i]); if (sizeof($parts) == 1) { $defaultInvPol = $this->invitationPolicies[$this->attributes['kolabInvitationPolicy'][$i]]; unset($this->attributes['kolabInvitationPolicy'][$i]); @@ -326,7 +326,7 @@ class kolabUser extends baseModule { array('kind' => 'help', 'value' => 'invPol')); // other invitation policies for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) { - $parts = split(":", $this->attributes['kolabInvitationPolicy'][$i]); + $parts = explode(":", $this->attributes['kolabInvitationPolicy'][$i]); if (sizeof($parts) == 2) { $returnPol[] = array( array('kind' => 'input', 'name' => 'invPol1' . $i, 'type' => 'text', 'value' => $parts[0]), @@ -647,7 +647,7 @@ class kolabUser extends baseModule { $policies = array_keys($this->invitationPolicies); $defaultFound = false; for ($p = 0; $p < sizeof($pols); $p++) { - $parts = split(":", $pols[$p]); + $parts = explode(":", $pols[$p]); // default policy if (sizeof($parts) == 1) { if (!$defaultFound && get_preg($parts[0], 'email')) { @@ -781,7 +781,7 @@ class kolabUser extends baseModule { } $return['kolabUser_invPol'][0] = '' . _('Invitation policy') . '' . _('Anyone') . ": " . $this->invitationPolicies[$default] . ''; for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) { - $parts = split(':', $this->attributes['kolabInvitationPolicy'][$i]); + $parts = explode(':', $this->attributes['kolabInvitationPolicy'][$i]); if (sizeof($parts) == 2) { $return['kolabUser_invPol'][] = '' . $parts[0] . ": " . $this->invitationPolicies[$parts[1]] . ''; } @@ -872,7 +872,7 @@ class kolabUser extends baseModule { // default invitation policy $defaultInvPol = $this->invitationPolicies['ACT_MANUAL']; for ($i = 0; $i < sizeof($attributes['kolabInvitationPolicy']); $i++) { - $parts = split(":", $attributes['kolabInvitationPolicy'][$i]); + $parts = explode(":", $attributes['kolabInvitationPolicy'][$i]); if (sizeof($parts) == 1) { $defaultInvPol = $this->invitationPolicies[$attributes['kolabInvitationPolicy'][$i]]; unset($attributes['kolabInvitationPolicy'][$i]); @@ -886,7 +886,7 @@ class kolabUser extends baseModule { array('kind' => 'text', 'text' => '')); // other invitation policies for ($i = 0; $i < sizeof($attributes['kolabInvitationPolicy']); $i++) { - $parts = split(":", $attributes['kolabInvitationPolicy'][$i]); + $parts = explode(":", $attributes['kolabInvitationPolicy'][$i]); if (sizeof($parts) == 2) { $returnPol[] = array( array('kind' => 'input', 'name' => 'invPol1' . $i, 'type' => 'text', 'value' => $parts[0]), diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index ddf8a665..1c5fe0a6 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -449,10 +449,10 @@ class quota extends baseModule { // Get quotas $quotas = lamdaemon(array("+ quota get " . $this->get_scope()), $server); - $dirs = split(":", $quotas[0]); + $dirs = explode(":", $quotas[0]); array_pop($dirs); // remove empty element at the end for ($i = 0; $i < sizeof($dirs); $i++) { - $dirs[$i] = split(",", $dirs[$i]); + $dirs[$i] = explode(",", $dirs[$i]); $dirs[$i] = $dirs[$i][0]; } if (sizeof($dirs) < 1) continue; // stop if no quota directories were found @@ -503,10 +503,10 @@ class quota extends baseModule { $id = $this->replaceSpecialChars($server); // Get quotas $quotas = lamdaemon(array("+ quota get " . $this->get_scope()), $server); - $dirs = split(":", $quotas[0]); + $dirs = explode(":", $quotas[0]); array_pop($dirs); // remove empty element at the end for ($i = 0; $i < sizeof($dirs); $i++) { - $dirs[$i] = split(",", $dirs[$i]); + $dirs[$i] = explode(",", $dirs[$i]); $dirs[$i] = $dirs[$i][0]; } for ($i = 0; $i < sizeof($dirs); $i++) { @@ -615,10 +615,10 @@ class quota extends baseModule { $server = $temp[0]; // Get quotas $quotas = lamdaemon(array("+ quota get " . $this->get_scope()), $server); - $dirs = split(":", $quotas[0]); + $dirs = explode(":", $quotas[0]); array_pop($dirs); // remove empty element at the end for ($i = 0; $i < sizeof($dirs); $i++) { - $dirs[$i] = split(",", $dirs[$i]); + $dirs[$i] = explode(",", $dirs[$i]); $dirs[$i] = $dirs[$i][0]; } for ($i = 0; $i < sizeof($dirs); $i++) { @@ -729,7 +729,7 @@ class quota extends baseModule { $mountPoints = array_keys($temp['accounts'][$name]); // set quota for ($m = 0; $m < sizeof($mountPoints); $m++) { - $mpParts = split(":", $mountPoints[$m]); + $mpParts = explode(":", $mountPoints[$m]); $server = $mpParts[0]; $dir = $mpParts[1]; $quotaString = $name . " quota set " . $this->get_scope() . " " . $dir . ',' . diff --git a/lam/lib/profiles.inc b/lam/lib/profiles.inc index 248cdf9a..ff703d01 100644 --- a/lam/lib/profiles.inc +++ b/lam/lib/profiles.inc @@ -75,7 +75,7 @@ function loadAccountProfile($profile, $scope) { if (($line == "\n")||($line[0] == "#")) continue; // ignore comments // search keywords $parts = array(); - $parts = split(": ", $line); + $parts = explode(": ", $line); if (sizeof($parts) != 2) continue; // ignore malformed settings else { $option = $parts[0]; diff --git a/lam/templates/tests/lamdaemonTest.php b/lam/templates/tests/lamdaemonTest.php index dfcd4d88..68074d53 100644 --- a/lam/templates/tests/lamdaemonTest.php +++ b/lam/templates/tests/lamdaemonTest.php @@ -155,7 +155,7 @@ function lamTestLamdaemon($command, $stopTest, $handle, $testText) { break; } usleep(100); - $read = split("\n", trim(fread($shell, 100000))); + $read = explode("\n", trim(fread($shell, 100000))); if ((sizeof($read) == 1) && (!isset($read[0]) || ($read[0] == ""))) continue; for ($i = 0; $i < sizeof($read); $i++) { $return[] = $read[$i]; @@ -181,7 +181,7 @@ function lamTestLamdaemon($command, $stopTest, $handle, $testText) { echo "" . $failImage . "  \n"; echo "\n"; for ($i = 0; $i < sizeof($return); $i++) { - call_user_func_array('StatusMessage', split(",", $return[$i])); + call_user_func_array('StatusMessage', explode(",", $return[$i])); } echo "\n"; $stopTest = true;