$tpl_data['mantis_url'] = $config->getSetting('mantis_url'); //Display the links, as specified in the config file $links = $config->getExternalLinks('FooterLink'); foreach ($links as $label => $url) { $WindowName = md5($url); $tpl_data['links'][] = array('url' => $url, 'label' => $label, 'windowName' => $WindowName); } if ($config->getSetting("sandbox") === '1') { $tpl_data['sandbox'] = true; } // This should be array_filter, but to have access to both key and value // in array_filter we need to require PHP >= 5.6 $realPerms = array(); foreach ($user->getPermissions() as $permName => $hasPerm) { if ($hasPerm === true) { $realPerms[] = $permName; } } $tpl_data['userPerms'] = $realPerms; $tpl_data['jsonParams'] = json_encode(array('BaseURL' => $tpl_data['baseurl'], 'TestName' => $tpl_data['test_name'], 'Subtest' => $tpl_data['subtest'], 'CandID' => $tpl_data['candID'], 'SessionID' => $tpl_data['sessionID'], 'CommentID' => $tpl_data['commentID'])); $tpl_data['css'] = $config->getSetting('css'); //-------------------------------------------------- //Output template using Smarty // Assign the console output to a variable, then stop // capturing output so that smarty can render $tpl_data['console'] = htmlspecialchars(ob_get_contents()); ob_end_clean(); $smarty = new Smarty_neurodb(); $smarty->assign($tpl_data); $smarty->display('main.tpl'); ob_end_flush();
// insert into db only if email address if it doesnt exist $success = $DB->insert('users', $vals); if (Utility::isErrorX($success)) { return PEAR::raiseError("DB Error: " . $success->getMessage()); } } unset($_SESSION['tntcon']); //redirect to a new page header("Location: thank-you.html", true, 301); exit; } } /** * Check that the user input for a field meets minimum length requirements * * @param string $str The request parameter to check * @param integer $len The minimum length for the parameter * * @return True if the parameter was sent and meets minimum length, false * otherwise */ function checkLen($str, $len = 2) { return isset($_REQUEST[$str]) && mb_strlen(strip_tags($_REQUEST[$str]), "utf-8") > $len; } //Output template using Smarty $smarty = new Smarty_neurodb(); $smarty->assign($tpl_data); $smarty->display('process_new_account.tpl'); ob_end_flush(); exit;
/** * Loads the correct page and renders it to the user * * @return none */ function display() { $DB = Database::singleton(); $nextpage = null; $this->logRequest(); if (isset($_REQUEST['nextpage'])) { $nextpage = "survey.php?key={$_REQUEST['key']}&pageNum={$_REQUEST['nextpage']}"; } if (isset($_POST['ease'])) { // Comments is too comment of an instrument fieldname, // so just check if ease is set $this->updateComments($_POST['ease'], $_POST['comments']); } $workspace = $this->caller->load($this->TestName, $this->Subtest, $this->CommentID, $nextpage); // Caller calls instrument's save function and might have errors, // so we still need to call it. But if nextpage is 'complete', // then after that override with a "Thank you" message if ($_REQUEST['pageNum'] === 'finalpage') { if (isset($_POST['FinalPageSubmission']) && $_POST['FinalPageSubmission'] == "Yes") { // Data was submitted on the last page. $this->tpl_data['workspace'] = $workspace; } else { // We're just getting to the last page for the first time $this->tpl_data['workspace'] = ''; $this->tpl_data['review'] = $this->caller->instrument->getReview(); } $this->tpl_data['lastpage'] = "survey.php?key={$_REQUEST['key']}"; $this->tpl_data['finalpage'] = true; } else { if ($_REQUEST['pageNum'] === 'complete') { $this->tpl_data['workspace'] = "Thank you for completing this survey."; $this->tpl_data['complete'] = true; $this->updateStatus('Complete'); $Responses = $DB->update($this->TestName, array('Date_taken' => date('Y-m-d')), array('CommentID' => $this->CommentID)); $Responses_flag = $DB->update('flag', array('Data_entry' => 'Complete', 'Administration' => 'All'), array('CommentID' => $this->CommentID)); } else { $this->updateStatus('In Progress'); $this->tpl_data['workspace'] = $workspace; } } $smarty = new Smarty_neurodb(); $smarty->assign($this->tpl_data); $smarty->display('directentry.tpl'); }
$threadList['error_message'] = $success1->getMessage(); } else { $tpl_data['thread_entry'][] = $success1; $threadList['QC_color'] = $feedback->getThreadColor($thread['QC_status']); } $z++; } } // option array for select boxes - 2 arrays; one is for labels $tpl_data['threadYNLabelArray'] = array('Y' => 'Yes', 'N' => 'No'); $tpl_data['threadYNArray'] = array('Y' => 'Y', 'N' => 'N'); } //prepare form data //define action url for the feedback form in the template $tpl_data['formAction'] = $_SERVER['PHP_SELF'] . "?candID=" . $_REQUEST['candID'] . "&"; if (!empty($_REQUEST['sessionID'])) { $tpl_data['formAction'] .= "sessionID=" . $_REQUEST['sessionID'] . "&"; } if (!empty($_REQUEST['commentID'])) { $tpl_data['formAction'] .= "commentID=" . $_REQUEST['commentID'] . "&" . "test_name=" . $_REQUEST['test_name'] . ""; } //set study name $tpl_data['study_title'] = $config->getSetting('title'); //Output template using Smarty $tpl_data['css'] = $config->getSetting('css'); $smarty = new Smarty_neurodb(); if (is_array($tpl_data)) { $smarty->assign($tpl_data); } $smarty->display('feedback_bvl_popup.tpl'); ob_end_flush();
$user =& User::singleton($_POST['username']); $email = $user->getData('Email'); // check that it is a valid user if (!empty($email)) { // check that the email is valid if ($user->isEmailValid()) { // generate a new password $password = User::newPassword(); // reset the password in the database // expire password so user must change it upon login $success = $user->updatePassword($password, '0000-00-00'); // send the user an email $msg_data['study'] = $config->getSetting('title'); $msg_data['url'] = $config->getSetting('url'); $msg_data['realname'] = $user->getData('Real_name'); $msg_data['password'] = $password; Email::send($email, 'lost_password.tpl', $msg_data); $tpl_data['confirm'] = $user->getData('Real_name') . ', you should receive an email within a few minutes.'; } else { $tpl_data['error_message'] = 'That user has an invalid email address.'; } } else { $tpl_data['error_message'] = 'That user is not in the system.'; } } //Output template using Smarty $smarty = new Smarty_neurodb(); $smarty->assign($tpl_data); $smarty->display('lost_password.tpl'); ob_end_flush(); exit;