Ejemplo n.º 1
0
$withCode = 0 == strcmp(PARAM_WITHCODE, swwat_parse_string(html_entity_decode($_POST[PARAM_WITHCODE])));
$uniqueCode = 0 == strcmp(PARAM_UNIQUE, swwat_parse_string(html_entity_decode($_POST[PARAM_UNIQUE])));
$errorMessage = "";
// invite or upload file button?
$invite = isset($_POST[PARAM_SAVE]);
$upload = isset($_POST[PARAM_UPLOAD]);
//
// todo should be _enum(, get if we ever have anything other than 5degrees
// $uploadFileType = swwat_parse_string(html_entity_decode($_POST[PARAM_UPLOADFILETYPE]));
if ($invite) {
    // get emails typed in
    $emails = swwat_parse_string(html_entity_decode($_POST[PARAM_EMAIL]));
    $emails = preg_replace('/\\s+/', ':', $emails);
    logMessage("message", $emails);
    // 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)) {