// gc hint
try {
    $fileString = file_get_contents($_FILES[$name]['tmp_name']);
    $fileWorkerArray = NULL;
    if (TRUE) {
        $fileWorkerArray = FiveDegreesCSV::parse($fileString);
        $fileString = NULL;
        // gc hint
    }
    $workerArray = array();
    $unknownArray = array();
    foreach ($fileWorkerArray as $fileWorker) {
        $error = $fileWorker->getError();
        if (is_null($error)) {
            try {
                $worker = Worker::selectUsername($fileWorker->email);
                if (!is_null($worker)) {
                    if (FALSE != array_search($worker->workerid, $checkWorkers)) {
                        $errorMessage .= "<tr><td>{$fileWorker->index}</td><td>{$fileWorker->email}</td><td>already assigned</td><td>no email</td><td>OK!</td></tr>\n";
                    } else {
                        $workerArray[] = $worker;
                        $errorMessage .= "<tr><td>{$fileWorker->index}</td><td>{$fileWorker->email}</td><td>account exists</td><td>email sent</td><td>OK!</td></tr>\n";
                    }
                    continue;
                }
                $unknownArray[] = newInviteFromFile($fileWorker);
                $errorMessage .= "<tr><td>{$fileWorker->index}</td><td>{$fileWorker->email}</td><td>invite issued</td><td>email sent</td><td>OK!</td></tr>\n";
            } catch (PDOException $ex) {
                // set on a per-line basis $_SESSION[PARAM_MESSAGE] = $ex + $error
                $errorMessage .= "<tr><td>{$fileWorker->index}</td><td>{$fileWorker->email}</td><td>bad data</td><td>no email</td><td>databse failure</td></tr>\n";
                $msg = $ex->getMessage();
Beispiel #2
0
 // parse via whitespace
 $invitationArray = Invitation::loadEmails($emails);
 $existingWorkers = Worker::selectExpo($expo->expoid);
 $checkWorkers = array();
 foreach ($existingWorkers as $worker) {
     $checkWorkers[] = $worker->workerid;
 }
 $existingWorkers = NULL;
 $workerArray = array();
 $unknownArray = array();
 $index = 0;
 foreach ($invitationArray as $invitation) {
     $index += 1;
     try {
         if (!empty($invitation->email)) {
             $worker = Worker::selectUsername($invitation->email);
             if (!is_null($worker)) {
                 if (FALSE != array_search($worker->workerid, $checkWorkers)) {
                     $errorMessage .= "<tr><td>{$index}</td><td>{$invitation->email}</td><td>already assigned</td><td>no email</td><td>OK!</td></tr>\n";
                 } else {
                     $workerArray[] = $worker;
                     $errorMessage .= "<tr><td>{$index}</td><td>{$invitation->email}</td><td>account exists</td><td>email sent</td><td>OK!</td></tr>\n";
                 }
                 continue;
             }
             $unknownArray[] = $invitation;
             $errorMessage .= "<tr><td>{$index}</td><td>{$invitation->email}</td><td>invite issued</td><td>email sent</td><td>OK!</td></tr>\n";
         }
     } catch (PDOException $ex) {
         $errorMessage .= "<tr><td>{$index}</td><td>{$invitation->email}</td><td>bad data</td><td>no email</td><td>databse failure</td></tr>\n";
         $msg = $ex->getMessage();
}
/*try
{
    $sms = swwat_parse_enum(html_entity_decode($_POST[PARAM_SMS_SERVICE]), SMSEnum::$SMS_ARRAY, true);
    if (0 == strcmp(SMSEnum::$NONE, $sms))
    {
        $sms = NULL;
    }
}
catch (ParseSWWATException $ex)
{
    $sms = NULL;
}
$worker->smsemail   = (is_null($worker->phone) || is_null($sms)) ? NULL : $worker->phone . "@" . $sms;*/
if (!is_null($worker->email)) {
    $check = Worker::selectUsername($worker->email);
    if (!is_null($check)) {
        $_SESSION[PARAM_MESSAGE] = "Registration was unsuccessful. This email is already registered.\n\n" . "Are you looking to <a href='/pages/WorkerLoginPage.php'>Reset Password</a>?\n";
        header('Location: RegistrationPage.php');
        include 'RegistrationPage.php';
        return;
    }
    $check = NULL;
    // gc hint
}
if (is_null($worker->email) || is_null($worker->firstName) || is_null($worker->lastName)) {
    $_SESSION[PARAM_MESSAGE] = "Registration was unsuccessful. First name, last name, and email are required.";
    header('Location: RegistrationPage.php');
    include 'RegistrationPage.php';
    return;
}