function process_lead($client_program_id, $request_id) { // Decode program name $program_name = $this->Programs_model->get_program_name($client_program_id); $apply_now = $this->session->userdata('apply_now'); if ($this->config->item('portal_active') == "true") { $this->load->library('curl'); // Check if our result is what we expect from Partners if ($request_id == NULL || !is_numeric($request_id)) { // Log the error $error = 'An error was found with Request_ID returning from Forms. The value was ' . ($request_id == null ? 'NULL' : $request_id) . '.'; log_message('error', $error); send_error_email('Request_ID is null or non numeric', $error); $this->load->view(SITE . '/thank_you'); exit; } $result = $this->Users_model->create_from_lead($request_id); // Store request id in session $this->session->set_userdata('uid', $request_id); $this->session->set_userdata('client_program_id', $client_program_id); $this->session->set_userdata('program_name', $program_name); $this->session->set_userdata('has_stp', $this->Programs_model->has_stp($client_program_id)); // Set this to mark first login for welcome modal to display $this->session->set_userdata('first_login', true); // Show errors if user wasn't able to register if (isset($result['errors'])) { $this->session->set_flashdata("error", $result['errors']); redirect('/auth/login'); exit; } // Login if ($this->tank_auth->login($result['email'], $result['password'], false, false, true)) { unset($result['password']); // Clear password (just for any case) $apply_now ? redirect('/leadform/welcome/apply') : redirect('/leadform/welcome'); } else { // Show errors if they exist after login $errors = $this->tank_auth->get_error_message(); show_error($errors); // Probably no longer needed, leaving here for now if (isset($errors['banned'])) { $this->_show_message($this->lang->line('auth_message_banned') . ' ' . $errors['banned']); } elseif (isset($errors['not_activated'])) { redirect('/auth/send_again/'); } else { foreach ($errors as $k => $v) { $result['errors'][$k] = $this->lang->line($v); } } } $this->load->view('lead_form', $result); } else { $this->load->view(SITE . '/thank_you'); } }
/** Main function to send email if necessary */ function sendemail($handler, $projectid) { include 'config/config.php'; include_once 'include/common.php'; require_once 'include/pdo.php'; require_once 'models/build.php'; require_once 'models/project.php'; require_once 'models/buildgroup.php'; $Project = new Project(); $Project->Id = $projectid; $Project->Fill(); $sendEmail = null; if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) { include_once 'local/sendemail.php'; $sendEmail = new SendEmail(); $sendEmail->SetProjectId($projectid); } // If we shouldn't sent any emails we stop if ($Project->EmailBrokenSubmission == 0) { return; } // If the handler has a buildid (it should), we use it if (isset($handler->BuildId) && $handler->BuildId > 0) { $buildid = $handler->BuildId; } else { // Get the build id $name = $handler->getBuildName(); $stamp = $handler->getBuildStamp(); $sitename = $handler->getSiteName(); $buildid = get_build_id($name, $stamp, $projectid, $sitename); } if ($buildid < 0) { return; } //add_log("Buildid ".$buildid,"sendemail ".$Project->Name,LOG_INFO); // Check if the group as no email $Build = new Build(); $Build->Id = $buildid; $groupid = $Build->GetGroup(); $BuildGroup = new BuildGroup(); $BuildGroup->SetId($groupid); // If we specified no email we stop here if ($BuildGroup->GetSummaryEmail() == 2) { return; } $emailCommitters = $BuildGroup->GetEmailCommitters(); $errors = check_email_errors($buildid, $Project->EmailTestTimingChanged, $Project->TestTimeMaxStatus, !$Project->EmailRedundantFailures); // We have some fixes if ($errors['hasfixes']) { $Build->FillFromId($Build->Id); // Get the list of person who should get the email $lookup_result = lookup_emails_to_send($errors, $buildid, $projectid, $Build->Type, true, $emailCommitters); $userids = $lookup_result['userids']; foreach ($userids as $userid) { $emailtext = array(); $emailtext['nfixes'] = 0; // Check if an email has been sent already for this user foreach ($errors['fixes'] as $fixkey => $nfixes) { if ($nfixes == 0) { continue; } if (!check_email_sent($userid, $buildid, $fixkey)) { $emailtext['category'][$fixkey] = $nfixes; $emailtext['nfixes'] = 1; } } // Send the email if ($emailtext['nfixes'] == 1) { send_email_fix_to_user($userid, $emailtext, $Build, $Project); } } } // No error we return if (!$errors['errors']) { return; } if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) { $sendEmail->BuildId = $Build->Id; $sendEmail->Errors = $errors; } // If we should send a summary email if ($BuildGroup->GetSummaryEmail() == 1) { // Send the summary email sendsummaryemail($projectid, $groupid, $errors, $buildid); if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) { $sendEmail->SendSummary(); } return; } $Build->FillFromId($Build->Id); // Send build error if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) { $sendEmail->SendBuildError(); } // Lookup the list of people who should get the email, both registered // users *and* committers: // $lookup_result = lookup_emails_to_send($errors, $buildid, $projectid, $Build->Type, false, $emailCommitters); // Loop through the *registered* users: // $userids = $lookup_result['userids']; foreach ($userids as $userid) { send_error_email($userid, '', $sendEmail, $errors, $Build, $Project); } // Loop through "other" users, if necessary: // // ...people who committed code, but are *not* registered CDash users, but // only if the 'emailcommitters' field is on for this build group. // if ($emailCommitters) { $committeremails = $lookup_result['committeremails']; foreach ($committeremails as $committeremail) { send_error_email(0, $committeremail, $sendEmail, $errors, $Build, $Project, getHandlerErrorKeyPrefix($handler)); } } }
<?php include_once 'header.php'; include_once 'menubar.php'; ?> <div id="content"> <?php try { render_page(); } catch (Exception $exception) { log_al_error($exception->getMessage()); send_error_email($exception->getMessage()); ?> <p>An error was encountered processing your request. Technical support has been notified and we hope to correct the problem soon. We apologize for this inconvenience.</p> <?php } ?> </div> <?php include_once 'footer.php';