/** * Change of Address Email * * Function used to send change of address to * appropriate staff member. * * @since 6.2.11 */ function etsis_nodeq_change_address() { $app = \Liten\Liten::getInstance(); $email = _etsis_email(); $host = $app->req->server['HTTP_HOST']; $site = _t('myeduTrac :: ') . _h(get_option('institution_name')); // Creates node's schema if does not exist. Node::dispense('change_address'); try { $sql = Node::table('change_address')->where('sent', '=', 0)->findAll(); if ($sql->count() == 0) { Node::table('change_address')->delete(); } $numItems = $sql->count(); $i = 0; if ($sql->count() > 0) { foreach ($sql as $r) { $message = _escape(get_option('coa_form_text')); $message = str_replace('#uname#', _h($r->uname), $message); $message = str_replace('#fname#', _h($r->fname), $message); $message = str_replace('#lname#', _h($r->lname), $message); $message = str_replace('#name#', get_name(_h($r->personid)), $message); $message = str_replace('#id#', _h($r->personid), $message); $message = str_replace('#address1#', _h($r->address1), $message); $message = str_replace('#address2#', _h($r->address2), $message); $message = str_replace('#city#', _h($r->city), $message); $message = str_replace('#state#', _h($r->state), $message); $message = str_replace('#zip#', _h($r->zip), $message); $message = str_replace('#country#', _h($r->country), $message); $message = str_replace('#phone#', _h($r->phone), $message); $message = str_replace('#email#', _h($r->email), $message); $message = str_replace('#adminemail#', _h(get_option('system_email')), $message); $message = str_replace('#url#', get_base_url(), $message); $message = str_replace('#helpdesk#', _h(get_option('help_desk')), $message); $message = str_replace('#currentterm#', _h(get_option('current_term_code')), $message); $message = str_replace('#instname#', _h(get_option('institution_name')), $message); $message = str_replace('#mailaddr#', _h(get_option('mailing_address')), $message); $headers = "From: {$site} <auto-reply@{$host}>\r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); $headers .= "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $email->etsis_mail(_h(get_option('contact_email')), _t('Change of Address Request'), $message, $headers); $upd = Node::table('change_address')->find(_h($r->id)); $upd->sent = 1; $upd->save(); if (++$i === $numItems) { //If we reach the last item, send user a desktop notification. etsis_push_notify('Change of Address', 'Request has been submitted.'); } } } } catch (\Exception $e) { return new \app\src\Core\Exception\Exception($e->getMessage(), 'NodeQ'); } }
} }); $app->get('/resetPassword/(\\d+)/', function ($id) use($app, $flashNow, $email) { $passSuffix = 'eT*'; $person = get_person_by('personID', $id); $dob = str_replace('-', '', $person->dob); $ssn = str_replace('-', '', $person->ssn); if ($ssn > 0) { $pass = $ssn . $passSuffix; } elseif ($person->dob > '0000-00-00') { $pass = $dob . $passSuffix; } else { $pass = '******' . $passSuffix; } Node::dispense('reset_password'); $node = Node::table('reset_password'); $node->uname = (string) _h($person->uname); $node->email = (string) _h($person->email); $node->name = (string) get_name(_h($person->personID)); $node->personid = (int) _h($person->personID); $node->fname = (string) _h($person->fname); $node->lname = (string) _h($person->lname); $node->password = (string) $pass; $node->sent = (int) 0; $node->save(); $password = etsis_hash_password($pass); $q2 = $app->db->person(); $q2->password = $password; $q2->where('personID = ?', $id); if ($q2->update()) { /**