PHP 5.3 compatibility

This commit is contained in:
Roland Gruber 2009-08-14 20:18:08 +00:00
parent 2bd8c5f569
commit f1e3cb7ad0
7 changed files with 19 additions and 19 deletions

View File

@ -128,7 +128,7 @@ function lamdaemonSSH($commands, $server) {
return $return; return $return;
} }
usleep(100); 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; if ((sizeof($read) == 1) && (!isset($read[0]) || ($read[0] == ""))) continue;
for ($i = 0; $i < sizeof($read); $i++) { for ($i = 0; $i < sizeof($read); $i++) {
$return[] = $read[$i]; $return[] = $read[$i];

View File

@ -1482,7 +1482,7 @@ class accountContainer {
$this->dn = substr($dn, strpos($dn, ',')+1); $this->dn = substr($dn, strpos($dn, ',')+1);
$this->dn_orig = $dn; $this->dn_orig = $dn;
// extract RDN // extract RDN
$this->rdn = split("=", substr($dn, 0, strpos($dn, ','))); $this->rdn = explode("=", substr($dn, 0, strpos($dn, ',')));
$this->rdn = $this->rdn[0]; $this->rdn = $this->rdn[0];
$attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry); $attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry);
// remove 'count' entries and numerical entries // remove 'count' entries and numerical entries

View File

@ -40,7 +40,7 @@ $Id$
**/ **/
if (!function_exists('check_ip')) { if (!function_exists('check_ip')) {
function check_ip($ip,$subnet=false) { function check_ip($ip,$subnet=false) {
$part = split("[.]", $ip); $part = explode(".", $ip);
// Wenn... Keine 4 Segmente gefunden wurde // Wenn... Keine 4 Segmente gefunden wurde
if (count($part) != 4) { if (count($part) != 4) {
return false; return false;

View File

@ -312,7 +312,7 @@ class kolabUser extends baseModule {
// default invitation policy // default invitation policy
$defaultInvPol = $this->invitationPolicies['ACT_MANUAL']; $defaultInvPol = $this->invitationPolicies['ACT_MANUAL'];
for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) { 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) { if (sizeof($parts) == 1) {
$defaultInvPol = $this->invitationPolicies[$this->attributes['kolabInvitationPolicy'][$i]]; $defaultInvPol = $this->invitationPolicies[$this->attributes['kolabInvitationPolicy'][$i]];
unset($this->attributes['kolabInvitationPolicy'][$i]); unset($this->attributes['kolabInvitationPolicy'][$i]);
@ -326,7 +326,7 @@ class kolabUser extends baseModule {
array('kind' => 'help', 'value' => 'invPol')); array('kind' => 'help', 'value' => 'invPol'));
// other invitation policies // other invitation policies
for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) { 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) { if (sizeof($parts) == 2) {
$returnPol[] = array( $returnPol[] = array(
array('kind' => 'input', 'name' => 'invPol1' . $i, 'type' => 'text', 'value' => $parts[0]), array('kind' => 'input', 'name' => 'invPol1' . $i, 'type' => 'text', 'value' => $parts[0]),
@ -647,7 +647,7 @@ class kolabUser extends baseModule {
$policies = array_keys($this->invitationPolicies); $policies = array_keys($this->invitationPolicies);
$defaultFound = false; $defaultFound = false;
for ($p = 0; $p < sizeof($pols); $p++) { for ($p = 0; $p < sizeof($pols); $p++) {
$parts = split(":", $pols[$p]); $parts = explode(":", $pols[$p]);
// default policy // default policy
if (sizeof($parts) == 1) { if (sizeof($parts) == 1) {
if (!$defaultFound && get_preg($parts[0], 'email')) { if (!$defaultFound && get_preg($parts[0], 'email')) {
@ -781,7 +781,7 @@ class kolabUser extends baseModule {
} }
$return['kolabUser_invPol'][0] = '<block><key>' . _('Invitation policy') . '</key><tr><td align=\"L\">' . _('Anyone') . ": " . $this->invitationPolicies[$default] . '</td></tr></block>'; $return['kolabUser_invPol'][0] = '<block><key>' . _('Invitation policy') . '</key><tr><td align=\"L\">' . _('Anyone') . ": " . $this->invitationPolicies[$default] . '</td></tr></block>';
for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) { 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) { if (sizeof($parts) == 2) {
$return['kolabUser_invPol'][] = '<block><tr><td align=\"L\">' . $parts[0] . ": " . $this->invitationPolicies[$parts[1]] . '</td></tr></block>'; $return['kolabUser_invPol'][] = '<block><tr><td align=\"L\">' . $parts[0] . ": " . $this->invitationPolicies[$parts[1]] . '</td></tr></block>';
} }
@ -872,7 +872,7 @@ class kolabUser extends baseModule {
// default invitation policy // default invitation policy
$defaultInvPol = $this->invitationPolicies['ACT_MANUAL']; $defaultInvPol = $this->invitationPolicies['ACT_MANUAL'];
for ($i = 0; $i < sizeof($attributes['kolabInvitationPolicy']); $i++) { for ($i = 0; $i < sizeof($attributes['kolabInvitationPolicy']); $i++) {
$parts = split(":", $attributes['kolabInvitationPolicy'][$i]); $parts = explode(":", $attributes['kolabInvitationPolicy'][$i]);
if (sizeof($parts) == 1) { if (sizeof($parts) == 1) {
$defaultInvPol = $this->invitationPolicies[$attributes['kolabInvitationPolicy'][$i]]; $defaultInvPol = $this->invitationPolicies[$attributes['kolabInvitationPolicy'][$i]];
unset($attributes['kolabInvitationPolicy'][$i]); unset($attributes['kolabInvitationPolicy'][$i]);
@ -886,7 +886,7 @@ class kolabUser extends baseModule {
array('kind' => 'text', 'text' => '')); array('kind' => 'text', 'text' => ''));
// other invitation policies // other invitation policies
for ($i = 0; $i < sizeof($attributes['kolabInvitationPolicy']); $i++) { for ($i = 0; $i < sizeof($attributes['kolabInvitationPolicy']); $i++) {
$parts = split(":", $attributes['kolabInvitationPolicy'][$i]); $parts = explode(":", $attributes['kolabInvitationPolicy'][$i]);
if (sizeof($parts) == 2) { if (sizeof($parts) == 2) {
$returnPol[] = array( $returnPol[] = array(
array('kind' => 'input', 'name' => 'invPol1' . $i, 'type' => 'text', 'value' => $parts[0]), array('kind' => 'input', 'name' => 'invPol1' . $i, 'type' => 'text', 'value' => $parts[0]),

View File

@ -449,10 +449,10 @@ class quota extends baseModule {
// Get quotas // Get quotas
$quotas = lamdaemon(array("+ quota get " . $this->get_scope()), $server); $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 array_pop($dirs); // remove empty element at the end
for ($i = 0; $i < sizeof($dirs); $i++) { for ($i = 0; $i < sizeof($dirs); $i++) {
$dirs[$i] = split(",", $dirs[$i]); $dirs[$i] = explode(",", $dirs[$i]);
$dirs[$i] = $dirs[$i][0]; $dirs[$i] = $dirs[$i][0];
} }
if (sizeof($dirs) < 1) continue; // stop if no quota directories were found if (sizeof($dirs) < 1) continue; // stop if no quota directories were found
@ -503,10 +503,10 @@ class quota extends baseModule {
$id = $this->replaceSpecialChars($server); $id = $this->replaceSpecialChars($server);
// Get quotas // Get quotas
$quotas = lamdaemon(array("+ quota get " . $this->get_scope()), $server); $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 array_pop($dirs); // remove empty element at the end
for ($i = 0; $i < sizeof($dirs); $i++) { for ($i = 0; $i < sizeof($dirs); $i++) {
$dirs[$i] = split(",", $dirs[$i]); $dirs[$i] = explode(",", $dirs[$i]);
$dirs[$i] = $dirs[$i][0]; $dirs[$i] = $dirs[$i][0];
} }
for ($i = 0; $i < sizeof($dirs); $i++) { for ($i = 0; $i < sizeof($dirs); $i++) {
@ -615,10 +615,10 @@ class quota extends baseModule {
$server = $temp[0]; $server = $temp[0];
// Get quotas // Get quotas
$quotas = lamdaemon(array("+ quota get " . $this->get_scope()), $server); $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 array_pop($dirs); // remove empty element at the end
for ($i = 0; $i < sizeof($dirs); $i++) { for ($i = 0; $i < sizeof($dirs); $i++) {
$dirs[$i] = split(",", $dirs[$i]); $dirs[$i] = explode(",", $dirs[$i]);
$dirs[$i] = $dirs[$i][0]; $dirs[$i] = $dirs[$i][0];
} }
for ($i = 0; $i < sizeof($dirs); $i++) { for ($i = 0; $i < sizeof($dirs); $i++) {
@ -729,7 +729,7 @@ class quota extends baseModule {
$mountPoints = array_keys($temp['accounts'][$name]); $mountPoints = array_keys($temp['accounts'][$name]);
// set quota // set quota
for ($m = 0; $m < sizeof($mountPoints); $m++) { for ($m = 0; $m < sizeof($mountPoints); $m++) {
$mpParts = split(":", $mountPoints[$m]); $mpParts = explode(":", $mountPoints[$m]);
$server = $mpParts[0]; $server = $mpParts[0];
$dir = $mpParts[1]; $dir = $mpParts[1];
$quotaString = $name . " quota set " . $this->get_scope() . " " . $dir . ',' . $quotaString = $name . " quota set " . $this->get_scope() . " " . $dir . ',' .

View File

@ -75,7 +75,7 @@ function loadAccountProfile($profile, $scope) {
if (($line == "\n")||($line[0] == "#")) continue; // ignore comments if (($line == "\n")||($line[0] == "#")) continue; // ignore comments
// search keywords // search keywords
$parts = array(); $parts = array();
$parts = split(": ", $line); $parts = explode(": ", $line);
if (sizeof($parts) != 2) continue; // ignore malformed settings if (sizeof($parts) != 2) continue; // ignore malformed settings
else { else {
$option = $parts[0]; $option = $parts[0];

View File

@ -155,7 +155,7 @@ function lamTestLamdaemon($command, $stopTest, $handle, $testText) {
break; break;
} }
usleep(100); 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; if ((sizeof($read) == 1) && (!isset($read[0]) || ($read[0] == ""))) continue;
for ($i = 0; $i < sizeof($read); $i++) { for ($i = 0; $i < sizeof($read); $i++) {
$return[] = $read[$i]; $return[] = $read[$i];
@ -181,7 +181,7 @@ function lamTestLamdaemon($command, $stopTest, $handle, $testText) {
echo "<td>" . $failImage . "&nbsp;&nbsp;</td>\n"; echo "<td>" . $failImage . "&nbsp;&nbsp;</td>\n";
echo "<td>\n"; echo "<td>\n";
for ($i = 0; $i < sizeof($return); $i++) { for ($i = 0; $i < sizeof($return); $i++) {
call_user_func_array('StatusMessage', split(",", $return[$i])); call_user_func_array('StatusMessage', explode(",", $return[$i]));
} }
echo "</td>\n"; echo "</td>\n";
$stopTest = true; $stopTest = true;