'; // create accounts $accounts = unserialize($_SESSION['ldap']->decrypt($_SESSION['mass_accounts'])); if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_postActions']['finished'])) { $startTime = time(); $maxTime = get_cfg_var('max_execution_time') - 5; if ($maxTime > 60) $maxTime = 60; if ($maxTime <= 0) $maxTime = 60; $refreshTime = $maxTime + 7; echo "
\n"; echo "

" . _("LDAP upload in progress. Please wait.") . "

\n"; echo "
"; echo "\n"; echo ""; echo "\n"; echo "
  
"; flush(); // send HTML to browser // add accounts to LDAP while (($_SESSION['mass_counter'] < sizeof($accounts)) && (($startTime + $maxTime) > time())) { // create accounts as long as max_execution_time is not near $attrs = $accounts[$_SESSION['mass_counter']]; $dn = $attrs['dn']; unset($attrs['dn']); $success = @ldap_add($_SESSION['ldap']->server(), $dn, $attrs); if (!$success) { $errorMessage = array( "ERROR", _("LAM was unable to create account %s! An LDAP error occured."), ldap_errno($_SESSION['ldap']->server()) . ": " . ldap_error($_SESSION['ldap']->server()), array($_SESSION['mass_counter'])); $_SESSION['mass_errors'][] = $errorMessage; $_SESSION['mass_failed'][] = $_SESSION['mass_counter']; } $_SESSION['mass_counter']++; } // do post upload actions if ($_SESSION['mass_counter'] >= sizeof($accounts)) { $data = unserialize($_SESSION['ldap']->decrypt($_SESSION['mass_data'])); $return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules'], $accounts); if ($return['status'] == 'finished') { $_SESSION['mass_postActions']['finished'] = true; } for ($i = 0; $i < sizeof($return['errors']); $i++) $_SESSION['mass_errors'][] = $return['errors'][$i]; echo "

" . _("Additional tasks for module:") . ' ' . getModuleAlias($return['module'], $_SESSION['mass_scope']) . "

\n"; echo "\n"; echo ""; echo "\n"; echo "
  
"; flush(); while (!isset($_SESSION['mass_postActions']['finished']) && (($startTime + $maxTime) > time())) { $return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules'], $accounts); if ($return['status'] == 'finished') { $_SESSION['mass_postActions']['finished'] = true; } for ($i = 0; $i < sizeof($return['errors']); $i++) $_SESSION['mass_errors'][] = $return['errors'][$i]; } } // refresh with JavaScript echo "\n"; } // all accounts have been created else { echo "
\n"; echo "

" . _("Upload has finished") . "

\n"; echo "
"; if (sizeof($_SESSION['mass_errors']) > 0) { echo "
\n"; echo "

" . _("There were errors while uploading:") . "

\n"; echo "
"; for ($i = 0; $i < sizeof($_SESSION['mass_errors']); $i++) { call_user_func_array('StatusMessage', $_SESSION['mass_errors'][$i]); echo "
"; } } else { // redirect to list if no errors occured echo "\n"; } } echo ''; include 'main_footer.php'; ?>